[FIX] project_sale_expense, sale_project: fix project updates
To reproduce:
- with service product S with create project & task
- create sale order with that product
- with another service product E with Re-invoice Expenses at cost
- create expense with this product and link it to the first sale order
- go back to sale order, we find product E added to sale order
- create invoice and post it
Problem:
on project updates we have the expense + the customer invoice which gives wrong profits in stats
Solution:
exclude the customer invoice from the revenues when it's linked to an expense, as the expense is already included in the revenues
opw-4000095
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
@xavierbol any news about this ?
Hello @abla001 ,
I asked to @damrOdoo to check that PR and he thinks it would probably be easier to override the _get_revenues_items_from_invoices_domain method to add additional domain to be more restrictive and avoid fetching the revenues linked to an expense.
We did not have the time to check if the suggestion is right or not. Can you check when you have time?
If it works we will avoid doing an extra RPC. 🙂
I mean maybe this extra condition was actually enough to fix the issue: ('move_id.expense_sheet_id', '=', False)
@xavierbol After investigating, the condition ('move_id.expense_sheet_id', '=', False) won't resolve the issue, as it only excludes bills linked to the expense. The problem originates from the invoices, which can only be accessed through the sale order connected to the expense. Therefore, it seems we cannot avoid the extra RPC unless there's a method to retrieve the expense from the project.
Hello @xavierbol , any news about this ?
@abla001 @xavierbol staging failed: ci/runbot (view more at https://runbot.odoo.com/runbot/build/70089564)
@robodoo retry
