mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX]type error purchase analytic
This commit is contained in:
committed by
Aaron ForgeFlow
parent
b7ecd0d639
commit
ca61ef4b21
@@ -8,10 +8,10 @@ from odoo import _, api, exceptions, models
|
||||
class PurchaseOrderLine(models.Model):
|
||||
_inherit = "purchase.order.line"
|
||||
|
||||
@api.constrains('analytic_account_id')
|
||||
@api.constrains('account_analytic_id')
|
||||
def check_analytic(self):
|
||||
for line in self:
|
||||
if (line.analytic_account_id !=
|
||||
for line in self.filtered(lambda p: p.rma_line_id):
|
||||
if (line.account_analytic_id !=
|
||||
line.rma_line_id.analytic_account_id):
|
||||
raise exceptions.ValidationError(
|
||||
_("The analytic account in the PO line it's not the same"
|
||||
|
||||
@@ -22,5 +22,5 @@ class RmaLineMakePurchaseOrder(models.TransientModel):
|
||||
@api.model
|
||||
def _prepare_purchase_order_line(self, po, item):
|
||||
res = super(RmaLineMakePurchaseOrder, self)._prepare_purchase_order_line(po, item)
|
||||
res['analytic_account_id'] = item.line_id.analytic_account_id.id
|
||||
res['account_analytic_id'] = item.line_id.analytic_account_id.id
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user