diff options
| author | Yannick Tivisse <yti@odoo.com> | 2019-11-04 16:39:38 +0100 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-11-05 16:18:10 +0100 |
| commit | 293f5c28f7db966bb7dacdf222e8c4b35b9a529c (patch) | |
| tree | b7e6b705bf04da85fdf179400071d9fdc170f6ca /addons | |
| parent | 4dcef34df0e55f7b8677a35910351b56ae64dfda (diff) | |
[IMP] product_margin: Adapt tests to work with/without demo data
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/product_margin/tests/test_product_margin.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/addons/product_margin/tests/test_product_margin.py b/addons/product_margin/tests/test_product_margin.py index 0e950a77b17..dc3f8a32bd9 100644 --- a/addons/product_margin/tests/test_product_margin.py +++ b/addons/product_margin/tests/test_product_margin.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. + from odoo import tools -from odoo.tests import common, Form +from odoo.addons.account.tests.account_minimal_test import AccountMinimalTest +from odoo.tests import Form from odoo.modules.module import get_resource_path -class TestProductMargin(common.TransactionCase): +class TestProductMargin(AccountMinimalTest): def create_account_invoice(self, invoice_type, partner, product, quantity=0.0, price_unit=0.0): """ Create an invoice as in a view by triggering its onchange methods""" @@ -19,19 +21,17 @@ class TestProductMargin(common.TransactionCase): invoice = invoice_form.save() invoice.post() - return invoice def test_product_margin(self): ''' In order to test the product_margin module ''' - # load account_minimal_test.xml file for chart of account in configuration - tools.convert_file(self.cr, 'product_margin', - get_resource_path('account', 'test', 'account_minimal_test.xml'), - {}, 'init', False, 'test', self.registry._assertion_report) - supplier = self.env['res.partner'].create({'name': 'Supplier'}) customer = self.env['res.partner'].create({'name': 'Customer'}) - ipad = self.env.ref("product.product_product_4") + ipad = self.env['product.product'].create({ + 'name': 'Ipad', + 'standard_price': 500.0, + 'list_price': 750.0, + }) # Create supplier invoice and customer invoice to test product margin. # Define supplier invoices |
