diff --git a/odex25_purchase/purchase_requisition_custom/models/purchase_order.py b/odex25_purchase/purchase_requisition_custom/models/purchase_order.py
index 9241c22d8..589e927da 100644
--- a/odex25_purchase/purchase_requisition_custom/models/purchase_order.py
+++ b/odex25_purchase/purchase_requisition_custom/models/purchase_order.py
@@ -124,6 +124,19 @@ 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(
+ 'hr.department',
+ string='Branch',
+ compute='_compute_branch_id',
+ store=True,
+ readonly=True
+ )
+ branch_short_name = fields.Char(
+ string='Branch',
+ related='branch_id.branch_short_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')
@@ -187,6 +200,16 @@ class PurchaseOrderCustom(models.Model):
for rec in self:
rec.department_id = rec.request_id.department_id
+ @api.depends('request_id.branch_id', 'department_id.branch_name')
+ def _compute_branch_id(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
+
def _recompute_all_department_id(self):
for rec in self.sudo().search([('request_id', '!=', False), ('department_id', '=', False)]):
rec._compute_department_id()
diff --git a/odex25_purchase/purchase_requisition_custom/views/purchase_request.xml b/odex25_purchase/purchase_requisition_custom/views/purchase_request.xml
index e177f027e..52c2b8d28 100644
--- a/odex25_purchase/purchase_requisition_custom/views/purchase_request.xml
+++ b/odex25_purchase/purchase_requisition_custom/views/purchase_request.xml
@@ -67,7 +67,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -153,7 +153,7 @@
-
+
diff --git a/odex25_purchase/purchase_requisition_custom/views/purchase_requisition_custom.xml b/odex25_purchase/purchase_requisition_custom/views/purchase_requisition_custom.xml
index ce7b09505..55fab3a51 100644
--- a/odex25_purchase/purchase_requisition_custom/views/purchase_requisition_custom.xml
+++ b/odex25_purchase/purchase_requisition_custom/views/purchase_requisition_custom.xml
@@ -99,6 +99,10 @@
+
+
+
+
@@ -304,6 +308,7 @@
+