[FIX] account: do not override accounting date for vendor bills

The accounting date must be today by default and changing the bill date
must not affect that.

Kind of followup after this change of behavior fcaa54939e9a4f0dd5e47cd0ccffe7aa24bd451c

task-2550985

closes odoo/odoo#71977

X-original-commit: c63af09774414a004ef34644b4f38b4fdb1d12bd
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
wan
2021-06-10 12:27:17 +00:00
parent 38aec52209
commit b42313474e
2 changed files with 6 additions and 2 deletions
+5 -2
View File
@@ -381,9 +381,12 @@ class AccountMove(models.Model):
if self.invoice_date:
if not self.invoice_payment_term_id and (not self.invoice_date_due or self.invoice_date_due < self.invoice_date):
self.invoice_date_due = self.invoice_date
if self.date != self.invoice_date: # Don't flag date as dirty if not needed
if (
self.is_sale_document() and self.date != self.invoice_date
or self.is_purchase_document() and not self.date
):
self.date = self.invoice_date
self._onchange_currency()
self._onchange_currency()
@api.onchange('journal_id')
def _onchange_journal(self):
+1
View File
@@ -373,6 +373,7 @@ class AccountTestInvoicingCommon(TransactionCase):
.with_company(company or cls.env.company) \
.with_context(default_move_type=move_type, account_predictive_bills_disable_prediction=True))
move_form.invoice_date = invoice_date or fields.Date.from_string('2019-01-01')
move_form.date = move_form.invoice_date
move_form.partner_id = partner or cls.partner_a
for product in (products or []):