Skip to content

Commit

Permalink
[FIX] purchase: change invoice date
Browse files Browse the repository at this point in the history
- Create a PO, generate the vendor bill
- Change a price unit
- Change the invoice date

The price unit is reset to the PO value.

We only recompute it if the currency of the invoice is different from
the currency of the PO.

Fixes odoo#22164
opw-804894
  • Loading branch information
nim-odoo committed Jan 15, 2018
1 parent aa875b0 commit d8112b0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion addons/purchase/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ def purchase_order_change(self):
def _onchange_currency_id(self):
if self.currency_id:
for line in self.invoice_line_ids.filtered(lambda r: r.purchase_line_id):
line.price_unit = line.purchase_id.currency_id.with_context(date=self.date_invoice).compute(line.purchase_line_id.price_unit, self.currency_id, round=False)
if line.purchase_id.currency_id != self.currency_id:
line.price_unit = line.purchase_id.currency_id.with_context(date=self.date_invoice)\
.compute(line.purchase_line_id.price_unit, self.currency_id, round=False)

@api.onchange('invoice_line_ids')
def _onchange_origin(self):
Expand Down

0 comments on commit d8112b0

Please sign in to comment.