Skip to content

Commit

Permalink
[MIG] account_invoice_pricelist: Migration to 15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomacr committed Mar 10, 2022
1 parent 91ce88b commit 3e1c394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion account_invoice_pricelist/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "Account - Pricelist on Invoices",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"summary": "Add partner pricelist on invoices",
"category": "Accounting & Finance",
"author": "GRAP," "Therp BV," "Tecnativa," "Odoo Community Association (OCA)",
Expand Down
13 changes: 6 additions & 7 deletions account_invoice_pricelist/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ def _onchange_uom_id(self):
sel.with_context(check_move_validity=False).update(
{"price_unit": price_unit}
)
return
else:
super(AccountMoveLine, self)._onchange_uom_id()
return super(AccountMoveLine, self)._onchange_uom_id()

def _get_real_price_currency(self, product, rule_id, qty, uom, pricelist_id):
PricelistItem = self.env["product.pricelist.item"]
Expand Down Expand Up @@ -188,19 +189,17 @@ def _get_price_with_pricelist(self):
)
self.with_context(check_move_validity=False).discount = 0.0
else:
product_context = dict(
self.env.context,
final_price, rule_id = self.move_id.pricelist_id.with_context(
partner_id=self.move_id.partner_id.id,
date=self.move_id.invoice_date or fields.Date.today(),
uom=self.product_uom_id.id,
)
final_price, rule_id = self.move_id.pricelist_id.with_context(
product_context
).get_product_price_rule(
self.product_id, self.quantity or 1.0, self.move_id.partner_id
)
base_price, currency = self.with_context(
product_context
partner_id=self.move_id.partner_id.id,
date=self.move_id.invoice_date or fields.Date.today(),
uom=self.product_uom_id.id,
)._get_real_price_currency(
self.product_id,
rule_id,
Expand Down

0 comments on commit 3e1c394

Please sign in to comment.