commit
54862ed26e
|
|
@ -1956,6 +1956,7 @@ msgid "Request id"
|
|||
msgstr ""
|
||||
|
||||
#. module: purchase_requisition_custom
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_purchase_order__branch_name
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_purchase_request__branch_id
|
||||
msgid "Branch"
|
||||
msgstr "الفرع"
|
||||
|
|
|
|||
|
|
@ -124,13 +124,14 @@ class PurchaseOrderCustom(models.Model):
|
|||
('budget_rejected', 'Rejected By Budget'),
|
||||
('wait_for_send', 'Waiting For Send to Budget')], default='wait')
|
||||
department_id = fields.Many2one('hr.department', compute="_compute_department_id", store=True, readonly=False)
|
||||
branch_id = fields.Many2one(
|
||||
branch_name = fields.Many2one(
|
||||
'hr.department',
|
||||
string='Branch',
|
||||
compute='_compute_branch_id',
|
||||
compute='_compute_branch_name',
|
||||
store=True,
|
||||
readonly=True
|
||||
)
|
||||
|
||||
purpose = fields.Char()
|
||||
category_ids = fields.Many2many('product.category', string='Categories')
|
||||
committe_members = fields.One2many('committe.member', inverse_name='po_id')
|
||||
|
|
@ -195,14 +196,14 @@ class PurchaseOrderCustom(models.Model):
|
|||
rec.department_id = rec.request_id.department_id
|
||||
|
||||
@api.depends('request_id.branch_id', 'department_id.branch_name')
|
||||
def _compute_branch_id(self):
|
||||
def _compute_branch_name(self):
|
||||
for rec in self:
|
||||
branch = False
|
||||
if rec.request_id and rec.request_id.branch_id:
|
||||
branch = rec.request_id.branch_id
|
||||
elif rec.department_id and rec.department_id.branch_name:
|
||||
branch = rec.department_id.branch_name
|
||||
rec.branch_id = branch
|
||||
rec.branch_name = branch
|
||||
|
||||
def _recompute_all_department_id(self):
|
||||
for rec in self.sudo().search([('request_id', '!=', False), ('department_id', '=', False)]):
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="recommendation_order" string="Recommend Order"/>
|
||||
<field name="branch_id" context="{'from_branch_field': True}"/>
|
||||
<field name="branch_name" context="{'from_branch_field': True}"/>
|
||||
</xpath>
|
||||
|
||||
|
||||
|
|
@ -308,7 +308,7 @@
|
|||
<!--here -->
|
||||
<field name="purchase_cost" invisible="1"/>
|
||||
<field name="department_id" invisible="0" context="{'show_department_short': True}"/>
|
||||
<field name="branch_id" readonly="1" context="{'show_branch_short': True}"/>
|
||||
<field name="branch_name" readonly="1" context="{'show_branch_short': True}"/>
|
||||
<field name="purchase_request_employee_id"/>
|
||||
<field name="purpose" attrs="{'readonly': [('state','in',['done','cancel'])]}"/>
|
||||
</xpath>
|
||||
|
|
|
|||
Loading…
Reference in New Issue