[FIX] account,point_of_sale: increment customer supplier rank to commercial partner

Before this commit, if a customer/supplier has an invoice address, when
creating an invoice/bill it's the invoice address that will be
identified as the customer/supplier and that will have its rank
increased and not the commercial partner.

Now, the rank increment is done to the commercial partner as well.

opw-2377870

closes odoo/odoo#61778

X-original-commit: dbf042611ccb134a220704d6b775aab650364ca2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2020-11-16 12:25:34 +00:00
committed by Nicolas Martinelli
parent 46cc27cc6e
commit 6e594f9537
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -2453,9 +2453,9 @@ class AccountMove(models.Model):
elif move.is_purchase_document():
supplier_count[move.partner_id] += 1
for partner, count in customer_count.items():
partner._increase_rank('customer_rank', count)
(partner | partner.commercial_partner_id)._increase_rank('customer_rank', count)
for partner, count in supplier_count.items():
partner._increase_rank('supplier_rank', count)
(partner | partner.commercial_partner_id)._increase_rank('supplier_rank', count)
# Trigger action for paid invoices in amount is zero
to_post.filtered(
+2 -1
View File
@@ -480,7 +480,8 @@ class PosSession(models.Model):
rounding_difference = self._update_amounts(rounding_difference, {'amount': diff}, order.date_order)
# Increasing current partner's customer_rank
order.partner_id._increase_rank('customer_rank')
partners = (order.partner_id | order.partner_id.commercial_partner_id)
partners._increase_rank('customer_rank')
if self.company_id.anglo_saxon_accounting:
global_session_pickings = self.picking_ids.filtered(lambda p: not p.pos_order_id)