diff options
| author | Jorge Pinna Puissant <jpp@odoo.com> | 2020-11-12 14:59:07 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-11-16 11:59:39 +0000 |
| commit | c7bb37d43cc85d3d0eaeb24f2e4e331835e22f5b (patch) | |
| tree | 8f8c99ddb931868a4d2313d972b55a2af2b3d7a1 | |
| parent | 629b54dc1249c77d1e30240c0b5a91e22a1ae110 (diff) | |
[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#61774
X-original-commit: dbf042611ccb134a220704d6b775aab650364ca2
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
| -rw-r--r-- | addons/account/models/account_move.py | 4 | ||||
| -rw-r--r-- | addons/point_of_sale/models/pos_session.py | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 6e9e9f0929b..24aa7459e59 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -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( diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index a046c9707f7..13eb7fe347e 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -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) |
