From 1409421b261db43d1afcb3c38c398e11c442b8a1 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 18 Jul 2018 10:36:27 +0200 Subject: [PATCH] [FIX] account: payment cashbasis' move posted once Make an invoice with a line having a cashbasis tax Make a payment at a future date compared to the invoice's date Before this commit, the cashbasis move attempted to post many times which could lead to errors when posting is forbidden (in the case of the french localization) After this commit, the cashbasis move is posted only once OPW 1865179 closes #25832 --- addons/account/models/account_move.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 397a507ebbc..d8b1bc81af9 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1633,15 +1633,15 @@ class AccountPartialReconcile(models.Model): 'amount_currency': self.amount_currency and line.currency_id.round(-line.amount_currency * amount / line.balance) or 0.0, 'partner_id': line.partner_id.id, }) - if newly_created_move: - if move_date > self.company_id.period_lock_date and newly_created_move.date != move_date: - # The move date should be the maximum date between payment and invoice (in case - # of payment in advance). However, we should make sure the move date is not - # recorded before the period lock date as the tax statement for this period is - # probably already sent to the estate. - newly_created_move.write({'date': move_date}) - # post move - newly_created_move.post() + if newly_created_move: + if move_date > self.company_id.period_lock_date and newly_created_move.date != move_date: + # The move date should be the maximum date between payment and invoice (in case + # of payment in advance). However, we should make sure the move date is not + # recorded before the period lock date as the tax statement for this period is + # probably already sent to the estate. + newly_created_move.write({'date': move_date}) + # post move + newly_created_move.post() def _create_tax_basis_move(self): # Check if company_journal for cash basis is set if not, raise exception