[FIX]type error purchase analytic

This commit is contained in:
Aaron Henriquez
2019-05-15 18:31:21 +02:00
committed by Aaron ForgeFlow
parent b7ecd0d639
commit ca61ef4b21
2 changed files with 4 additions and 4 deletions

View File

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

View File

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