[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) <flg@odoo.com>
Signed-off-by: Ricardo Gomes Rodrigues (rigr) <rigr@odoo.com>
This commit is contained in:
Ricardo Gomes Rodrigues (rigr)
2022-10-06 14:57:06 +02:00
parent f52c731965
commit 35a2fff2dd
+3 -2
View File
@@ -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
):