fix issue with blue

This commit is contained in:
ronozoro 2024-12-01 05:11:17 -08:00
parent 5c4082ab75
commit 62e3f8cc9b
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
1 changed files with 14 additions and 0 deletions

View File

@ -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"