Skip to content
Snippets Groups Projects
Commit ddab2798 authored by Florian Damhaut's avatar Florian Damhaut Committed by Thibault Libioulle
Browse files

[FIX] sale_timesheet : test fixed price invoiced accounted for twice


Description of the issue/feature this PR addresses:

When using analytical account and invoicing a fixed price sales order
item, which is linked to a project task, where timesheet has been
recorded, the invoice gets double counted into the project revenues -
both as Invoiced and as Other revenues on the project overview
profitability.

Current behavior before PR:

The invoice gets double counted into the project revenues - both as
Invoiced and as Other revenues on the project overview profitability.

Desired behavior after PR is merged:

The invoice gets counted only in the project revenues as invoiced/to
invoice on the project overview profitability.

This commit adds tests to assess this use case is covered.

PR : #78230

opw-2631163

closes odoo/odoo#78523

X-original-commit: 6e1850e1300949d7be09c5ab462527811c0a2ebc
X-original-commit: 8442a7f814008e115e3d895bac6f56feb6663c17
Signed-off-by: default avatarLTU-Odoo <IT-Ideas@users.noreply.github.com>
Co-authored-by: default avatarThibault Libioulle <tle@odoo.com>
parent 69c5a558
Branches
Tags
No related merge requests found
......@@ -37,8 +37,15 @@ class TestCommonReporting(TestCommonSaleTimesheet):
'company_id': cls.company_data['company'].id,
'partner_id': cls.partner_a.id
})
cls.analytic_account_3 = cls.env['account.analytic.account'].create({
'name': 'Test AA 3',
'code': 'AA3',
'company_id': cls.company_data['company'].id,
'partner_id': cls.partner_a.id
})
# Sale orders each will create project and a task in a global project (one SO is 'delivered', the other is 'ordered')
# and a third one using fixed_price (which is 'delivered')
cls.sale_order_1 = cls.env['sale.order'].with_context(mail_notrack=True, mail_create_nolog=True).create({
'partner_id': cls.partner_a.id,
'partner_invoice_id': cls.partner_a.id,
......@@ -85,6 +92,21 @@ class TestCommonReporting(TestCommonSaleTimesheet):
'order_id': cls.sale_order_2.id,
})
cls.sale_order_3 = cls.env['sale.order'].with_context(mail_notrack=True, mail_create_nolog=True).create({
'partner_id': cls.partner_a.id,
'partner_invoice_id': cls.partner_a.id,
'partner_shipping_id': cls.partner_a.id,
'analytic_account_id': cls.analytic_account_3.id,
})
cls.so_line_deliver_manual_project = cls.env['sale.order.line'].create({
'name': cls.product_delivery_manual3.name,
'product_id': cls.product_delivery_manual3.id,
'product_uom_qty': 11,
'product_uom': cls.product_delivery_manual3.uom_id.id,
'price_unit': cls.product_delivery_manual3.list_price,
'order_id': cls.sale_order_3.id,
})
def _log_timesheet_user(self, project, unit_amount, task=False):
""" Utility method to log timesheet """
Timesheet = self.env['account.analytic.line']
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment