Skip to content

Commit

Permalink
[FIX]type error purchase analytic
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronHForgeFlow authored and JasminSForgeFlow committed Sep 26, 2023
1 parent 23d3bde commit 962a813
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rma_purchase_analytic/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
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"
Expand Down
2 changes: 1 addition & 1 deletion rma_purchase_analytic/wizards/rma_add_purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 962a813

Please sign in to comment.