Skip to content

Commit 1d328ce

Browse files
committed
[FIX] l10n_es_pos: set simplifed partner only when we will invoice
Currently we also set the simplified partner directly on pos orders even in case we do not invoice the pos order directly. This is unnecessary; we only need to set a partner in case we invoice. (Since we need a partner to put on the invoice.) After this commit we only set the simplified partner on pos orders that will be invoiced as simplified invoice. (This happens automatically in case a simplified invoice journal is set in the settings; see field `pos_l10n_es_simplified_invoice_journal_id`) part of task-3745982 X-original-commit: 5cc84e1 Part-of: odoo#221431 Signed-off-by: Sven Führ (svfu) <[email protected]>
1 parent b35b8fd commit 1d328ce

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

addons/l10n_es_pos/models/pos_order.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ def _compute_l10n_es_simplified_invoice_number(self):
1515
else:
1616
order.l10n_es_simplified_invoice_number = False
1717

18+
def _generate_pos_order_invoice(self):
19+
# Extend 'point_of_sale'
20+
# Add the simplified partner in case we do a simplified invoice and no partner is set
21+
if not self.config_id.is_spanish:
22+
return super()._generate_pos_order_invoice()
23+
for order in self:
24+
if order.account_move or not order.to_invoice or not order.is_l10n_es_simplified_invoice:
25+
continue
26+
if not order.partner_id:
27+
order.partner_id = self.config_id.simplified_partner_id
28+
return super()._generate_pos_order_invoice()
29+
1830
def _prepare_invoice_vals(self):
1931
res = super()._prepare_invoice_vals()
2032
if self.config_id.is_spanish and self.is_l10n_es_simplified_invoice:

addons/l10n_es_pos/static/src/app/screens/payment_screen/payment_screen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ patch(PaymentScreen.prototype, {
2525
if ((await this._askForCustomerIfRequired()) === false) {
2626
return false;
2727
}
28-
if (!order.partner_id) {
28+
if (!order.partner_id && order.to_invoice) {
2929
const setPricelist =
3030
this.pos.config.pricelist_id?.id != order.pricelist_id?.id
3131
? order.pricelist_id

0 commit comments

Comments
 (0)