-
Notifications
You must be signed in to change notification settings - Fork 87
[IMP] headhunter: Talent Acquisition V2 #1446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.0
Are you sure you want to change the base?
Conversation
563e56d to
301a4d4
Compare
pgu-odoo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dhrs-odoo I have added a few comments. But still its going on.
| "res_model_id": env.ref("hr_recruitment.model_hr_applicant").id, | ||
| "res_id": record.pool_applicant_id.id if record.pool_applicant_id else record.id, | ||
| "user_id": record.user_id.id if record.user_id else record.create_uid.id, | ||
| "date_deadline": datetime.date.today(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "date_deadline": datetime.date.today(), |
default value for date_deadline is context_today already.
| invoices = record.x_invoices | ||
| action = { | ||
| 'res_model': 'account.move', | ||
| 'type': 'ir.actions.act_window', | ||
| } | ||
| if len(invoices) == 1: | ||
| action.update({ | ||
| 'view_mode': 'form', | ||
| 'res_id': invoices.id, | ||
| }) | ||
| elif invoices: | ||
| action.update({ | ||
| 'view_mode': 'list,form', | ||
| 'domain': [('id', 'in', invoices.ids)], | ||
| }) | ||
| action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| invoices = record.x_invoices | |
| action = { | |
| 'res_model': 'account.move', | |
| 'type': 'ir.actions.act_window', | |
| } | |
| if len(invoices) == 1: | |
| action.update({ | |
| 'view_mode': 'form', | |
| 'res_id': invoices.id, | |
| }) | |
| elif invoices: | |
| action.update({ | |
| 'view_mode': 'list,form', | |
| 'domain': [('id', 'in', invoices.ids)], | |
| }) | |
| action | |
| invoices = record.x_invoices | |
| action = { | |
| 'type': 'ir.actions.act_window', | |
| 'res_model': 'account.move', | |
| } | |
| if invoices: | |
| action.update( | |
| {'view_mode': 'form', 'res_id': invoices.id} | |
| if len(invoices) == 1 | |
| else {'view_mode': 'list,form', 'domain': [('id', 'in', invoices.ids)]} | |
| ) | |
| action |
can be reduced to have single update method.
| action = { | ||
| 'view_mode': 'form', | ||
| 'type': 'ir.actions.act_window', | ||
| 'res_model': 'sale.order', | ||
| 'context': { | ||
| 'default_x_job_id': record.id, | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we think to have the xml code for ir act window and just pass the id over here? like -
<record id="action_sale_order_from_job" model="ir.actions.act_window"> <field name="name">Create Sale Order</field> <field name="res_model">sale.order</field> <field name="view_mode">form</field> <field name="context">{'default_x_job_id': active_id}</field> </record>
and something like -
<record id="ir_actions_server_create_sale_order_from_job" model="ir.actions.server"> <field name="name">Create sale order</field> <field name="model_id" ref="hr.model_hr_job"/> <field name="binding_model_id" ref="hr.model_hr_job"/> <field name="state">code</field> <field name="code"><![CDATA[ action = env.ref('headhunter.action_sale_order_from_job').read()[0] action['context'] = dict(action.get('context', {}), default_x_job_id=record.id) ]]></field> </record>
or if called from button only then -
<button name="%(action_sale_order_from_job)d" type="action" string="Create Sale Order"/>
everywhere. It will reduce our python code.
| if not (record.x_status_bar == 'open' and record.active and record.is_published): | ||
| for job in record.x_similar_job_ids: | ||
| if record.id in job.x_similar_job_ids.ids: | ||
| job['x_similar_job_ids'] = [(3, record.id)] | ||
| else: | ||
| for job in record.x_similar_job_ids: | ||
| if record.id not in job.x_similar_job_ids.ids: | ||
| job['x_similar_job_ids'] = [(4, record.id)]]]></field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not (record.x_status_bar == 'open' and record.active and record.is_published): | |
| for job in record.x_similar_job_ids: | |
| if record.id in job.x_similar_job_ids.ids: | |
| job['x_similar_job_ids'] = [(3, record.id)] | |
| else: | |
| for job in record.x_similar_job_ids: | |
| if record.id not in job.x_similar_job_ids.ids: | |
| job['x_similar_job_ids'] = [(4, record.id)]]]></field> | |
| record_to_update = record.x_status_bar == 'open' and record.active and record.is_published | |
| for j in record.x_similar_job_ids: | |
| j.x_similar_job_ids = [(4, record.id)] if record_to_update and record.id not in j.x_similar_job_ids.ids \ | |
| else [(3, record.id)] if not record_to_update and record.id in j.x_similar_job_ids.ids else j.x_similar_job_ids | |
| for similar in record.x_similar_job_ids: | ||
| if similar.x_status_bar == 'open' and similar.active and similar.is_published: | ||
| if record.id not in similar.x_similar_job_ids.ids: | ||
| similar['x_similar_job_ids'] = [(4, record.id)]]]></field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for similar in record.x_similar_job_ids: | |
| if similar.x_status_bar == 'open' and similar.active and similar.is_published: | |
| if record.id not in similar.x_similar_job_ids.ids: | |
| similar['x_similar_job_ids'] = [(4, record.id)]]]></field> | |
| for similar in record.x_similar_job_ids.filtered( | |
| lambda j: j.x_status_bar == 'open' and j.active and j.is_published | |
| and record not in j.x_similar_job_ids | |
| ): | |
| similar.x_similar_job_ids = [(4, record.id)]></field> |
| compose_form = env.ref('mail.email_compose_message_wizard_form') | ||
| job_partner = record.job_id.x_customer | ||
| ctx = { | ||
| 'default_model': 'hr.applicant', | ||
| 'default_res_ids': [record.id], | ||
| 'default_template_id': record.stage_id.template_id.id, | ||
| 'default_composition_mode': 'comment', | ||
| 'default_attachment_ids': [(6, 0, record.x_is_shared_cv.ids)], | ||
| 'force_email': True, | ||
| 'x_from_cv_send': True, | ||
| } | ||
| if job_partner: | ||
| ctx['default_partner_ids'] = [(6, 0, [job_partner.id])] | ||
| action = { | ||
| 'type': 'ir.actions.act_window', | ||
| 'res_model': 'mail.compose.message', | ||
| 'view_mode': 'form', | ||
| 'views': [(compose_form.id, 'form')], | ||
| 'target': 'new', | ||
| 'context': ctx, | ||
| }]]></field> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| compose_form = env.ref('mail.email_compose_message_wizard_form') | |
| job_partner = record.job_id.x_customer | |
| ctx = { | |
| 'default_model': 'hr.applicant', | |
| 'default_res_ids': [record.id], | |
| 'default_template_id': record.stage_id.template_id.id, | |
| 'default_composition_mode': 'comment', | |
| 'default_attachment_ids': [(6, 0, record.x_is_shared_cv.ids)], | |
| 'force_email': True, | |
| 'x_from_cv_send': True, | |
| } | |
| if job_partner: | |
| ctx['default_partner_ids'] = [(6, 0, [job_partner.id])] | |
| action = { | |
| 'type': 'ir.actions.act_window', | |
| 'res_model': 'mail.compose.message', | |
| 'view_mode': 'form', | |
| 'views': [(compose_form.id, 'form')], | |
| 'target': 'new', | |
| 'context': ctx, | |
| }]]></field> | |
| ctx = { | |
| 'default_model': 'hr.applicant', | |
| 'default_res_ids': [record.id], | |
| 'default_template_id': record.stage_id.template_id.id, | |
| 'default_composition_mode': 'comment', | |
| 'default_attachment_ids': [(6, 0, record.x_is_shared_cv.ids)], | |
| 'force_email': True, | |
| 'x_from_cv_send': True, | |
| } | |
| if record.job_id.x_customer: | |
| ctx['default_partner_ids'] = [(6, 0, [record.job_id.x_customer.id])] | |
| action = { | |
| 'type': 'ir.actions.act_window', | |
| 'res_model': 'mail.compose.message', | |
| 'view_mode': 'form', | |
| 'views': [(env.ref('mail.email_compose_message_wizard_form').id, 'form')], | |
| 'target': 'new', | |
| 'context': ctx, | |
| }]]></field> |
0597555 to
c5ff7f7
Compare
c5ff7f7 to
ae11503
Compare
900e87d to
6f489de
Compare
f5bf6cd to
a776b38
Compare
a776b38 to
8a55925
Compare

Task-5125645