Skip to content

Commit

Permalink
[FIX] sale_commission_salesman: partner fetch for agents creation on …
Browse files Browse the repository at this point in the history
…move lines

Fetch the partner by move line record instead of fetching all partners
for all invoice users related to the moves. The previous method could
fetch more than one partner, including those not related to the move,
when multiple lines for different moves are being processed, causing an
error when trying to obtain the values of the `agent` and
`salesman_as_agent` fields.
  • Loading branch information
CLaurelB committed Aug 8, 2024
1 parent e82f4c6 commit 9a2951d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sale_commission_salesman/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _compute_agent_ids(self):
and x.product_id
and not x.agent_ids
):
partner = self.move_id.invoice_user_id.partner_id
partner = record.move_id.invoice_user_id.partner_id
if partner.agent and partner.salesman_as_agent:
record.agent_ids = [(0, 0, self._prepare_agent_vals(partner))]
record.agent_ids = [(0, 0, record._prepare_agent_vals(partner))]
return result

0 comments on commit 9a2951d

Please sign in to comment.