Migrate to 6.4

This commit is contained in:
José Antonio Díaz Miralles 2022-09-19 13:33:38 +02:00
parent 3eacabc4d1
commit 3ab9918d91
8 changed files with 34 additions and 66 deletions

View file

@ -137,6 +137,6 @@ setup(name=name,
stock_location_dock = trytond.modules.stock_location_dock stock_location_dock = trytond.modules.stock_location_dock
""", """,
test_suite='tests', test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require, tests_require=tests_require,
) )

View file

@ -9,7 +9,7 @@ class Location(metaclass=PoolMeta):
__name__ = 'stock.location' __name__ = 'stock.location'
docks = fields.One2Many('stock.location.dock', 'location', 'Docks', docks = fields.One2Many('stock.location.dock', 'location', 'Docks',
states={'invisible': Eval('type') != 'warehouse'}) states={'invisible': Eval('type') != 'warehouse'})
@classmethod @classmethod
def copy(cls, records, default=None): def copy(cls, records, default=None):
@ -31,25 +31,22 @@ class LocationDock(ModelView, ModelSQL, DeactivableMixin):
__name__ = 'stock.location.dock' __name__ = 'stock.location.dock'
location = fields.Many2One('stock.location', 'Location', location = fields.Many2One('stock.location', 'Location',
ondelete='CASCADE', required=True, select=True, ondelete='CASCADE', required=True, select=True,
domain=[('type', '=', 'warehouse')], domain=[('type', '=', 'warehouse')],
states={'readonly': ~Eval('active')}, states={'readonly': ~Eval('active')})
depends=['active'])
name = fields.Char('Name', required=True, name = fields.Char('Name', required=True,
states={'readonly': ~Eval('active')}, states={'readonly': ~Eval('active')})
depends=['active']) code = fields.Char('Code',
code = fields.Char('Code', states={'readonly': ~Eval('active')}, states={'readonly': ~Eval('active')})
depends=['active'])
class DockMixin(object): class DockMixin(object):
"""Adds dock field to Model""" """Adds dock field to Model"""
__slots__ = ()
dock = fields.Many2One('stock.location.dock', 'Dock', dock = fields.Many2One('stock.location.dock', 'Dock', ondelete='RESTRICT',
ondelete='RESTRICT', domain=[('location', '=', Eval('warehouse'))],
domain=[('location', '=', Eval('warehouse'))], states={'readonly': Eval('state') != 'draft'})
states={'readonly': Eval('state') != 'draft'},
depends=['state', 'warehouse'])
@fields.depends('warehouse') @fields.depends('warehouse')
def on_change_with_dock(self): def on_change_with_dock(self):

View file

@ -1,3 +1,2 @@
# 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.
from .test_stock import suite

View file

@ -29,29 +29,6 @@ Create customer::
>>> customer = Party(name='Customer') >>> customer = Party(name='Customer')
>>> customer.save() >>> customer.save()
Create category::
>>> ProductCategory = Model.get('product.category')
>>> category = ProductCategory(name='Category')
>>> category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> ProductTemplate = Model.get('product.template')
>>> Product = Model.get('product.product')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> template = ProductTemplate()
>>> template.name = 'Product'
>>> template.categories.append(category)
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.list_price = Decimal('20')
>>> template.save()
>>> product, = template.products
>>> product.cost_price = Decimal('8')
>>> product.save()
Get stock locations:: Get stock locations::
>>> Location = Model.get('stock.location') >>> Location = Model.get('stock.location')

14
tests/test_module.py Normal file
View file

@ -0,0 +1,14 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.tests.test_tryton import ModuleTestCase
class StockTestCase(ModuleTestCase):
"""Test module"""
module = 'stock_location_dock'
def setUp(self):
super(StockTestCase, self).setUp()
del ModuleTestCase

7
tests/test_scenario.py Normal file
View file

@ -0,0 +1,7 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.tests.test_tryton import load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)

View file

@ -1,26 +0,0 @@
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import doctest_teardown, doctest_checker
class StockTestCase(ModuleTestCase):
"""Test module"""
module = 'stock_location_dock'
def setUp(self):
super(StockTestCase, self).setUp()
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(StockTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_stock_shipment_out.rst',
tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite

View file

@ -1,5 +1,5 @@
[tryton] [tryton]
version=6.0.0 version=6.4.0
depends: depends:
ir ir
res res