Skip to content
Snippets Groups Projects
Commit 8f315eb2 authored by Abdelouahab (abla)'s avatar Abdelouahab (abla)
Browse files

[FIX] purchase: no recomputing date when autocomplete


To reproduce
============
- create a purchase order and confirm it
- create a Bill, set its Bill date and Accounting date to different dates
to today
- save it, then choose the created PO in autocomplete field
the Accounting day will be changed to today

Problem
=======
when calling the autocomplete, some values will be updated on the record,
where `move_type` is one of them, and updating this field will trigger the
compute of accounting date.

Solution
========
if the value of `move_type` on the record is the same as the one of the update,
it should not be taken into account which will avoid uneeded recompute.

opw-3381530

closes odoo/odoo#132841

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 1e96c21e
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,8 @@ class AccountMove(models.Model):
new_currency_id = self.invoice_line_ids and self.currency_id or invoice_vals.get('currency_id')
del invoice_vals['ref']
del invoice_vals['company_id'] # avoid recomputing the currency
if self.move_type == invoice_vals['move_type']:
del invoice_vals['move_type'] # no need to be updated if it's same value, to avoid recomputes
self.update(invoice_vals)
self.currency_id = new_currency_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment