Thursday, April 17, 2025
1 change · saas-18.1
Resolved issues and error corrections
Fixed an issue that could prevent users from registering payments on customer invoices that include a referrer. This ensures commission-related invoice payments can be completed without an unexpected error.
Original PR description
Currently a traceback is occurring when the user tries to create an invoice payment with referrer in invoice. <b>To reproduce this issue:</b> 1) Install partner_commission without demo 2) Create a…
Currently a traceback is occurring when the user tries to create an invoice payment with referrer in invoice.
<b>To reproduce this issue:</b>
1) Install partner_commission without demo
2) Create a commission plan from crm with a rule containing category and rate
3) Create a product with the same category used in the above commission rule
4) Create a contact with commission plan and partner level in partner assignment
5) Create a confirmed customer invoice with line as above product and referrer as
above contact and register a payment.
<b>Error:- </b>
```
AttributeError: 'bool' object has no attribute 'partner_id'
```
The above traceback is occurring because we are trying to get the partner_id value from `_get_sales_representative` method.
https://github.com/odoo/enterprise/blob/313593cf176271060878dda5ebc677fa44b519db/partner_commission/models/account_move.py#L124-L125
But the above method tries to get the user_id from the sale order. Here in this case, we don't have any SO, so we the above method will return False.
https://github.com/odoo/enterprise/blob/313593cf176271060878dda5ebc677fa44b519db/partner_commission/models/account_move.py#L26-L27
This leads to the above traceback when parter_id is retrieved from the method.
<b>Solution:-</b>
Take the value of partner_id from purchase. Since the partner_id value is getting from move.referrer_id in purchase.
https://github.com/odoo/enterprise/blob/313593cf176271060878dda5ebc677fa44b519db/partner_commission/models/account_move.py#L46-L50
opw-4676967