diff --git a/contract_sale_payment_mode/__init__.py b/contract_sale_payment_mode/__init__.py index 0650744f..0ee8b507 100644 --- a/contract_sale_payment_mode/__init__.py +++ b/contract_sale_payment_mode/__init__.py @@ -1 +1,2 @@ from . import models +from . import tests diff --git a/contract_sale_payment_mode/tests/__init__.py b/contract_sale_payment_mode/tests/__init__.py new file mode 100644 index 00000000..6f699d0d --- /dev/null +++ b/contract_sale_payment_mode/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_order diff --git a/contract_sale_payment_mode/tests/test_sale_order.py b/contract_sale_payment_mode/tests/test_sale_order.py new file mode 100644 index 00000000..158b2cf6 --- /dev/null +++ b/contract_sale_payment_mode/tests/test_sale_order.py @@ -0,0 +1,19 @@ +# Copyright 2018 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + + +from odoo.addons.product_contract.tests.test_sale_order import TestSaleOrder + + +class TestSaleOrderPaymentMode(TestSaleOrder): + def setUp(self): + super(TestSaleOrderPaymentMode, self).setUp() + self.payment_mode = self.env['account.payment.mode'].search([], limit=1) + self.sale.payment_mode_id = self.payment_mode + + def test_action_confirm_with_payment_mode(self): + self.test_action_confirm() + self.assertEqual( + self.sale.order_line.mapped('contract_id.payment_mode_id'), + self.payment_mode, + ) diff --git a/product_contract/__manifest__.py b/product_contract/__manifest__.py index f2a3411c..c495c726 100644 --- a/product_contract/__manifest__.py +++ b/product_contract/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Recurring - Product Contract', - 'version': '12.0.1.0.0', + 'version': '12.0.2.0.0', 'category': 'Contract Management', 'license': 'AGPL-3', 'author': "LasLabs, " diff --git a/product_contract/migrations/12.0.2.0.0/pre-migration.py b/product_contract/migrations/12.0.2.0.0/pre-migration.py new file mode 100644 index 00000000..ca2542a4 --- /dev/null +++ b/product_contract/migrations/12.0.2.0.0/pre-migration.py @@ -0,0 +1,18 @@ +# Copyright 2019 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import logging + +from openupgradelib import openupgrade + +_logger = logging.getLogger(__name__) + + +def migrate(cr, version): + xmlids_to_rename = [ + ( + 'product_contract.account_analytic_account_recurring_form_form', + 'product_contract.contract_contract_customer_form_view', + ) + ] + openupgrade.rename_xmlids(cr, xmlids_to_rename) diff --git a/product_contract/models/sale_order.py b/product_contract/models/sale_order.py index bbc1345c..d84b0a21 100644 --- a/product_contract/models/sale_order.py +++ b/product_contract/models/sale_order.py @@ -107,7 +107,7 @@ class SaleOrder(models.Model): def action_show_contracts(self): self.ensure_one() action = self.env.ref( - "contract.action_account_analytic_sale_overdue_all" + "contract.contract_contract_customer_form_view" ).read()[0] contracts = ( self.env['contract.line'] diff --git a/product_contract/tests/test_sale_order.py b/product_contract/tests/test_sale_order.py index 4d859c67..e1637439 100644 --- a/product_contract/tests/test_sale_order.py +++ b/product_contract/tests/test_sale_order.py @@ -294,3 +294,11 @@ class TestSaleOrder(TransactionCase): self.assertEqual( self.contract_line.termination_notice_rule_type, 'weekly' ) + + def test_action_show_contracts(self): + self.sale.action_confirm() + action = self.sale.action_show_contracts() + self.assertEqual( + self.env['contract.contract'].search(action['domain']), + self.sale.order_line.mapped('contract_id'), + ) diff --git a/product_contract/views/contract.xml b/product_contract/views/contract.xml index 95208855..1762136a 100644 --- a/product_contract/views/contract.xml +++ b/product_contract/views/contract.xml @@ -5,7 +5,7 @@ --> - contract.contract