summaryrefslogtreecommitdiff
path: root/addons/sale_timesheet/tests/test_project_billing_multicompany.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/sale_timesheet/tests/test_project_billing_multicompany.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/sale_timesheet/tests/test_project_billing_multicompany.py')
-rw-r--r--addons/sale_timesheet/tests/test_project_billing_multicompany.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/addons/sale_timesheet/tests/test_project_billing_multicompany.py b/addons/sale_timesheet/tests/test_project_billing_multicompany.py
new file mode 100644
index 00000000..ef4b8557
--- /dev/null
+++ b/addons/sale_timesheet/tests/test_project_billing_multicompany.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo.addons.sale_timesheet.tests.common import TestCommonSaleTimesheet
+from odoo.tests import tagged
+
+
+@tagged('-at_install', 'post_install')
+class TestProjectBillingMulticompany(TestCommonSaleTimesheet):
+
+ @classmethod
+ def setUpClass(cls, chart_template_ref=None):
+ super().setUpClass(chart_template_ref=chart_template_ref)
+
+ Project = cls.env['project.project'].with_context(tracking_disable=True)
+ cls.project_non_billable = Project.create({
+ 'name': "Non Billable Project",
+ 'allow_timesheets': True,
+ 'allow_billable': True,
+ 'bill_type': 'customer_project',
+ 'company_id': cls.env.company.id,
+ })
+
+ def test_makeBillable_multiCompany(self):
+ wizard = self.env['project.create.sale.order'].with_context(allowed_company_ids=[self.company_data_2['company'].id, self.env.company.id], company_id=self.company_data_2['company'].id, active_id=self.project_non_billable.id, active_model='project.project').create({
+ 'line_ids': [(0, 0, {
+ 'product_id': self.product_delivery_timesheet3.id, # product creates new Timesheet in new Project
+ 'price_unit': self.product_delivery_timesheet3.list_price
+ })],
+ 'partner_id': self.partner_a.id,
+ })
+
+ action = wizard.action_create_sale_order()
+ sale_order = self.env['sale.order'].browse(action['res_id'])
+
+ self.assertEqual(sale_order.company_id.id, self.project_non_billable.company_id.id, "The company on the sale order should be the same as the one on the project")