summaryrefslogtreecommitdiff
path: root/doc/python3.rst
diff options
context:
space:
mode:
authorYannick Tivisse <yti@odoo.com>2020-01-02 14:39:19 +0000
committerYannick Tivisse <yti@odoo.com>2020-01-10 15:07:33 +0000
commitdce3a4323b07505f3db468be5ba6f97b0bfb7e4c (patch)
tree8bd2a0b86f67a42ad12a5478b124da1d957dd02c /doc/python3.rst
parent3d4369c26ff7f354fd7183e1a40f4c4b642626f4 (diff)
[IMP] sale_timesheet: Fix undeterministic crashing test
The method 'test_timesheet_delivery' tests the following use case: Test timesheet invoicing with 'invoice on delivery' timetracked products 1. Create SO and confirm it 2. log timesheet 3. create invoice 4. log other timesheet 5. create a second invoice 6. add new SO line (delivered service) 7. And finally check the AMOUNTS But it could happen, according to the installed modules, that the class TestSaleTimesheet, which is directly linked to -> TestCommonSaleTimesheetNoChart (sale_timesheet) --> TestCommonSaleNoChart (sale) ---> AccountTestNoChartCommon (account) ----> SavepointCaseWithUserDemo (base) -----> SavepointCase (base) is influenced by other installed modules, that in our case, introduce new res.currency.rate values. In our test, on the sale.order.line 'so_line_ordered_global_project', we use the product 'product_order_timesheet2', with a price_unit=90. Then we call manually the onchange method: ``` python3 so_line_ordered_global_project.product_id_change() ``` As the order has a pricelist and a partner, we recompute the price unit, in case a discount applies: ``` python3 if self.order_id.pricelist_id and self.order_id.partner_id: vals['price_unit'] = self.env['account.tax']._fix_tax_included_price_company(self._get_display_price(product), product.taxes_id, self.tax_id, self.company_id) self.update(vals) ``` And then , the call the _get_display_price returns an different amount that what we expect, as ``` python3 product.with_context(pricelist=self.order_id.pricelist_id.id).price ``` will return the price converted using the related res.currency.rate at the current date. As we don't wish to test the conversion into another currency in this test, we simply unlink all the currency rates, to avoid any external influence. closes odoo/odoo#42606 Taskid: 2166237 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'doc/python3.rst')
0 files changed, 0 insertions, 0 deletions