Upgrade to Tryton 4.8

This commit is contained in:
Albert Cervera i Areny 2018-10-28 01:33:30 +02:00
parent c52b9c09cb
commit d9f7e117c9
5 changed files with 13 additions and 28 deletions

View File

@ -5,12 +5,12 @@ from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval from trytond.pyson import Eval
__all__ = ['SaleInvoiceGroup', 'Sale', 'SaleLine'] __all__ = ['SaleInvoiceGroup', 'Sale', 'SaleLine']
__metaclass__ = PoolMeta
class SaleInvoiceGroup(ModelSQL, ModelView): class SaleInvoiceGroup(ModelSQL, ModelView):
'Sale Invoice Group' 'Sale Invoice Group'
__name__ = 'sale.invoice.group' __name__ = 'sale.invoice.group'
__metaclass__ = PoolMeta
code = fields.Char('Code', required=True, readonly=True) code = fields.Char('Code', required=True, readonly=True)
name = fields.Char('Name') name = fields.Char('Name')
@ -46,6 +46,7 @@ class SaleInvoiceGroup(ModelSQL, ModelView):
class Sale: class Sale:
__name__ = 'sale.sale' __name__ = 'sale.sale'
__metaclass__ = PoolMeta
def get_completed_groups(self): def get_completed_groups(self):
'Returns a list of completed groups' 'Returns a list of completed groups'
@ -72,6 +73,7 @@ class Sale:
class SaleLine: class SaleLine:
__name__ = 'sale.line' __name__ = 'sale.line'
__metaclass__ = PoolMeta
invoice_group = fields.Many2One('sale.invoice.group', 'Invoice Grouping', invoice_group = fields.Many2One('sale.invoice.group', 'Invoice Grouping',
ondelete='RESTRICT', depends=['type'], states={ ondelete='RESTRICT', depends=['type'], states={

View File

@ -9,26 +9,18 @@ Imports::
>>> from decimal import Decimal >>> from decimal import Decimal
>>> from operator import attrgetter >>> from operator import attrgetter
>>> from proteus import config, Model, Wizard >>> from proteus import config, Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \ >>> from trytond.modules.company.tests.tools import create_company, \
... get_company ... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \ >>> 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 \ >>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences, create_payment_term ... set_fiscalyear_invoice_sequences, create_payment_term
>>> today = datetime.date.today() >>> today = datetime.date.today()
Create database:: Activate sale_invoice_complete_line_grouping::
>>> config = config.set_trytond() >>> config = activate_modules('sale_invoice_complete_line_grouping')
>>> 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')
Create company:: Create company::
@ -119,7 +111,6 @@ Create product::
>>> unit, = ProductUom.find([('name', '=', 'Unit')]) >>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template') >>> ProductTemplate = Model.get('product.template')
>>> Product = Model.get('product.product') >>> Product = Model.get('product.product')
>>> product = Product()
>>> template = ProductTemplate() >>> template = ProductTemplate()
>>> template.name = 'product' >>> template.name = 'product'
>>> template.default_uom = unit >>> template.default_uom = unit
@ -127,14 +118,11 @@ Create product::
>>> template.purchasable = True >>> template.purchasable = True
>>> template.salable = True >>> template.salable = True
>>> template.list_price = Decimal('10') >>> template.list_price = Decimal('10')
>>> template.cost_price = Decimal('5')
>>> template.cost_price_method = 'fixed' >>> template.cost_price_method = 'fixed'
>>> template.account_expense = expense >>> template.account_expense = expense
>>> template.account_revenue = revenue >>> template.account_revenue = revenue
>>> template.save() >>> template.save()
>>> product.template = template >>> product, = template.products
>>> product.save()
>>> product2 = Product()
>>> template2 = ProductTemplate() >>> template2 = ProductTemplate()
>>> template2.name = 'product2' >>> template2.name = 'product2'
>>> template2.default_uom = unit >>> template2.default_uom = unit
@ -142,14 +130,11 @@ Create product::
>>> template2.purchasable = True >>> template2.purchasable = True
>>> template2.salable = True >>> template2.salable = True
>>> template2.list_price = Decimal('10') >>> template2.list_price = Decimal('10')
>>> template2.cost_price = Decimal('5')
>>> template2.cost_price_method = 'fixed' >>> template2.cost_price_method = 'fixed'
>>> template2.account_expense = expense >>> template2.account_expense = expense
>>> template2.account_revenue = revenue >>> template2.account_revenue = revenue
>>> template2.save() >>> template2.save()
>>> product2.template = template2 >>> product2, = template2.products
>>> product2.save()
>>> product3 = Product()
>>> template3 = ProductTemplate() >>> template3 = ProductTemplate()
>>> template3.name = 'product3' >>> template3.name = 'product3'
>>> template3.default_uom = unit >>> template3.default_uom = unit
@ -157,13 +142,11 @@ Create product::
>>> template3.purchasable = True >>> template3.purchasable = True
>>> template3.salable = True >>> template3.salable = True
>>> template3.list_price = Decimal('10') >>> template3.list_price = Decimal('10')
>>> template3.cost_price = Decimal('5')
>>> template3.cost_price_method = 'fixed' >>> template3.cost_price_method = 'fixed'
>>> template3.account_expense = expense >>> template3.account_expense = expense
>>> template3.account_revenue = revenue >>> template3.account_revenue = revenue
>>> template3.save() >>> template3.save()
>>> product3.template = template3 >>> product3, = template3.products
>>> product3.save()
Create payment term:: Create payment term::

View File

@ -1,5 +1,5 @@
[tryton] [tryton]
version=4.1.0 version=4.8.0
depends: depends:
sale_invoice_complete sale_invoice_complete
xml: xml:

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full <!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. --> copyright notices and license terms. -->
<form string="Sale Invoice Group"> <form>
<label name="code"/> <label name="code"/>
<field name="code"/> <field name="code"/>
<label name="name"/> <label name="name"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full <!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. --> copyright notices and license terms. -->
<tree string="Sale Invoice Group"> <tree>
<field name="rec_name"/> <field name="rec_name"/>
</tree> </tree>