odoo icon indicating copy to clipboard operation
odoo copied to clipboard

[FIX] project_sale_expense, sale_project: fix project updates

Open abla001 opened this issue 1 year ago • 1 comments

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

abla001 avatar Sep 30 '24 14:09 abla001

Pull request status dashboard

robodoo avatar Sep 30 '24 14:09 robodoo

@xavierbol any news about this ?

abla001 avatar Oct 07 '24 08:10 abla001

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. 🙂

xavierbol avatar Oct 07 '24 09:10 xavierbol

I mean maybe this extra condition was actually enough to fix the issue: ('move_id.expense_sheet_id', '=', False)

xavierbol avatar Oct 07 '24 09:10 xavierbol

@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.

abla001 avatar Oct 21 '24 11:10 abla001

Hello @xavierbol , any news about this ?

abla001 avatar Oct 28 '24 08:10 abla001

@abla001 @xavierbol staging failed: ci/runbot (view more at https://runbot.odoo.com/runbot/build/70089564)

robodoo avatar Oct 31 '24 14:10 robodoo

@robodoo retry

abla001 avatar Oct 31 '24 18:10 abla001