Skip to content
Snippets Groups Projects
Commit 5fa8b13b authored by Thomas Lefebvre (thle)'s avatar Thomas Lefebvre (thle)
Browse files

[FIX] sale_timesheet: link timesheets that have a reversed invoice


Steps to reproduce:
- create a sale order;
- add products which are based on timesheets for invoicing policy;
- create an invoice an confirm it;
- make a full refund for this invoice with "ADD CREDIT NOTE" button;
- create an new invoice for the sale order.

Issue:
There is no longer a statistics button
that displays the hours worked on the invoice view.

Cause:
To reassign an account move to an account analytic line,
it is necessary either that there is no invoice
or that the invoice is in the cancel state.
The case where the invoice has been refunded is not taken into account.

Solution:
Correct the domain that determines the timesheets (account analytic line)
to be linked with the invoice being created.

opw-3187219

closes odoo/odoo#113985

Signed-off-by: default avatarXavier Bol (xbo) <xbo@odoo.com>
parent 68090907
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,10 @@ class AccountMoveLine(models.Model):
return [
('so_line', 'in', sale_line_delivery.ids),
('project_id', '!=', False),
'|', ('timesheet_invoice_id', '=', False), ('timesheet_invoice_id.state', '=', 'cancel')
'|', '|',
('timesheet_invoice_id', '=', False),
('timesheet_invoice_id.state', '=', 'cancel'),
('timesheet_invoice_id.payment_state', '=', 'reversed')
]
def unlink(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment