From 62e3f8cc9bf084e53084d72e3cbf616c989bd448 Mon Sep 17 00:00:00 2001 From: ronozoro Date: Sun, 1 Dec 2024 05:11:17 -0800 Subject: [PATCH] fix issue with blue --- .../models/purchase_order.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/odex25_purchase/purchase_requisition_custom/models/purchase_order.py b/odex25_purchase/purchase_requisition_custom/models/purchase_order.py index 7c24e2c9d..903698e27 100644 --- a/odex25_purchase/purchase_requisition_custom/models/purchase_order.py +++ b/odex25_purchase/purchase_requisition_custom/models/purchase_order.py @@ -18,6 +18,20 @@ class AccountMove(models.Model): else: self.purpose = '' + @api.model_create_multi + def create(self, vals_list): + moves = super(AccountMove, self).create(vals_list) + for move in moves: + if move.purchase_id: + move.purpose = move.purchase_id.purpose + return moves + + def write(self, vals): + if vals.get('purchase_id'): + po = self.env['purchase.order'].browse(vals['purchase_id']) + vals['purpose'] = po.purpose + super(AccountMove, self).write(vals) + class PurchaseOrderCustom(models.Model): _inherit = "purchase.order"