Skip to content

Commit

Permalink
[FIX] account,point_of_sale: increment customer supplier rank to comm…
Browse files Browse the repository at this point in the history
…ercial 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#61778

X-original-commit: dbf0426
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
  • Loading branch information
jpp-odoo authored and nim-odoo committed Nov 16, 2020
1 parent 46cc27c commit 6e594f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,9 +2453,9 @@ def _post(self, soft=True):
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(
Expand Down
3 changes: 2 additions & 1 deletion addons/point_of_sale/models/pos_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ def _accumulate_amounts(self, data):
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)
Expand Down

0 comments on commit 6e594f9

Please sign in to comment.