From 35a2fff2dd51406c6536317a9409fed69445e62f Mon Sep 17 00:00:00 2001 From: "Ricardo Gomes Rodrigues (rigr)" Date: Wed, 5 Oct 2022 09:48:02 +0000 Subject: [PATCH] [FIX] account: allow quick invoice encoding even if the partner is not set Currently, when using the quick invoice encoding feature, we do not create the invoice line if no partner is set. This commit fixes by falling back on the default values of the account and the tax. closes odoo/odoo#102297 X-original-commit: a387b3b07b806eb82f359767e01be8555c79ee9f Signed-off-by: Florian Gilbert (flg) Signed-off-by: Ricardo Gomes Rodrigues (rigr) --- addons/account/models/account_move.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 3551587776e..f64791e1e20 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2478,6 +2478,8 @@ class AccountMove(models.Model): Returns the most used accounts and taxes for a given partner and company, eventually filtered according to the move type. """ + if not partner_id: + return 0, False, False where_internal_group = "" if move_type in self.env['account.move'].get_inbound_types(include_receipts=True): where_internal_group = "AND account.internal_group = 'income'" @@ -2566,8 +2568,7 @@ class AccountMove(models.Model): and the tax) such that the total amount matches the quick total amount. """ if ( - not self.partner_id - or not self.quick_edit_total_amount + not self.quick_edit_total_amount or not self.quick_edit_mode or len(self.invoice_line_ids) > 0 ):