From d9f7e117c9308976f923f0254981454e321ada24 Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Sun, 28 Oct 2018 01:33:30 +0200 Subject: [PATCH] Upgrade to Tryton 4.8 --- sale.py | 4 ++- ...io_sale_invoice_complete_line_grouping.rst | 31 +++++-------------- tryton.cfg | 2 +- view/sale_invoice_group_form.xml | 2 +- view/sale_invoice_group_tree.xml | 2 +- 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/sale.py b/sale.py index 7ccbc00..5f80b62 100644 --- a/sale.py +++ b/sale.py @@ -5,12 +5,12 @@ from trytond.pool import Pool, PoolMeta from trytond.pyson import Eval __all__ = ['SaleInvoiceGroup', 'Sale', 'SaleLine'] -__metaclass__ = PoolMeta class SaleInvoiceGroup(ModelSQL, ModelView): 'Sale Invoice Group' __name__ = 'sale.invoice.group' + __metaclass__ = PoolMeta code = fields.Char('Code', required=True, readonly=True) name = fields.Char('Name') @@ -46,6 +46,7 @@ class SaleInvoiceGroup(ModelSQL, ModelView): class Sale: __name__ = 'sale.sale' + __metaclass__ = PoolMeta def get_completed_groups(self): 'Returns a list of completed groups' @@ -72,6 +73,7 @@ class Sale: class SaleLine: __name__ = 'sale.line' + __metaclass__ = PoolMeta invoice_group = fields.Many2One('sale.invoice.group', 'Invoice Grouping', ondelete='RESTRICT', depends=['type'], states={ diff --git a/tests/scenario_sale_invoice_complete_line_grouping.rst b/tests/scenario_sale_invoice_complete_line_grouping.rst index 4f6e511..9e7ce6a 100644 --- a/tests/scenario_sale_invoice_complete_line_grouping.rst +++ b/tests/scenario_sale_invoice_complete_line_grouping.rst @@ -9,26 +9,18 @@ Imports:: >>> from decimal import Decimal >>> from operator import attrgetter >>> from proteus import config, Model, Wizard + >>> from trytond.tests.tools import activate_modules >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company >>> from trytond.modules.account.tests.tools import create_fiscalyear, \ - ... create_chart, get_accounts, create_tax, set_tax_code + ... create_chart, get_accounts, create_tax >>> from trytond.modules.account_invoice.tests.tools import \ ... set_fiscalyear_invoice_sequences, create_payment_term >>> today = datetime.date.today() -Create database:: +Activate sale_invoice_complete_line_grouping:: - >>> config = config.set_trytond() - >>> config.pool.test = True - -Install sale:: - - >>> Module = Model.get('ir.module') - >>> sale_module, = Module.find([ - ... ('name', '=', 'sale_invoice_complete_line_grouping')]) - >>> Module.install([sale_module.id], config.context) - >>> Wizard('ir.module.install_upgrade').execute('upgrade') + >>> config = activate_modules('sale_invoice_complete_line_grouping') Create company:: @@ -119,7 +111,6 @@ Create product:: >>> unit, = ProductUom.find([('name', '=', 'Unit')]) >>> ProductTemplate = Model.get('product.template') >>> Product = Model.get('product.product') - >>> product = Product() >>> template = ProductTemplate() >>> template.name = 'product' >>> template.default_uom = unit @@ -127,14 +118,11 @@ Create product:: >>> template.purchasable = True >>> template.salable = True >>> template.list_price = Decimal('10') - >>> template.cost_price = Decimal('5') >>> template.cost_price_method = 'fixed' >>> template.account_expense = expense >>> template.account_revenue = revenue >>> template.save() - >>> product.template = template - >>> product.save() - >>> product2 = Product() + >>> product, = template.products >>> template2 = ProductTemplate() >>> template2.name = 'product2' >>> template2.default_uom = unit @@ -142,14 +130,11 @@ Create product:: >>> template2.purchasable = True >>> template2.salable = True >>> template2.list_price = Decimal('10') - >>> template2.cost_price = Decimal('5') >>> template2.cost_price_method = 'fixed' >>> template2.account_expense = expense >>> template2.account_revenue = revenue >>> template2.save() - >>> product2.template = template2 - >>> product2.save() - >>> product3 = Product() + >>> product2, = template2.products >>> template3 = ProductTemplate() >>> template3.name = 'product3' >>> template3.default_uom = unit @@ -157,13 +142,11 @@ Create product:: >>> template3.purchasable = True >>> template3.salable = True >>> template3.list_price = Decimal('10') - >>> template3.cost_price = Decimal('5') >>> template3.cost_price_method = 'fixed' >>> template3.account_expense = expense >>> template3.account_revenue = revenue >>> template3.save() - >>> product3.template = template3 - >>> product3.save() + >>> product3, = template3.products Create payment term:: diff --git a/tryton.cfg b/tryton.cfg index 04e4a9d..9d97159 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,5 +1,5 @@ [tryton] -version=4.1.0 +version=4.8.0 depends: sale_invoice_complete xml: diff --git a/view/sale_invoice_group_form.xml b/view/sale_invoice_group_form.xml index 5725ba8..95ca65c 100644 --- a/view/sale_invoice_group_form.xml +++ b/view/sale_invoice_group_form.xml @@ -1,7 +1,7 @@ -
+