mirror of
https://gitlab.com/datalifeit/trytond-stock_location_dock
synced 2023-12-14 04:23:04 +01:00
Migrate to 6.4
This commit is contained in:
parent
3eacabc4d1
commit
3ab9918d91
2
setup.py
2
setup.py
|
@ -137,6 +137,6 @@ setup(name=name,
|
|||
stock_location_dock = trytond.modules.stock_location_dock
|
||||
""",
|
||||
test_suite='tests',
|
||||
test_loader='trytond.test_loader:Loader',
|
||||
|
||||
tests_require=tests_require,
|
||||
)
|
||||
|
|
25
stock.py
25
stock.py
|
@ -9,7 +9,7 @@ class Location(metaclass=PoolMeta):
|
|||
__name__ = 'stock.location'
|
||||
|
||||
docks = fields.One2Many('stock.location.dock', 'location', 'Docks',
|
||||
states={'invisible': Eval('type') != 'warehouse'})
|
||||
states={'invisible': Eval('type') != 'warehouse'})
|
||||
|
||||
@classmethod
|
||||
def copy(cls, records, default=None):
|
||||
|
@ -31,25 +31,22 @@ class LocationDock(ModelView, ModelSQL, DeactivableMixin):
|
|||
__name__ = 'stock.location.dock'
|
||||
|
||||
location = fields.Many2One('stock.location', 'Location',
|
||||
ondelete='CASCADE', required=True, select=True,
|
||||
domain=[('type', '=', 'warehouse')],
|
||||
states={'readonly': ~Eval('active')},
|
||||
depends=['active'])
|
||||
ondelete='CASCADE', required=True, select=True,
|
||||
domain=[('type', '=', 'warehouse')],
|
||||
states={'readonly': ~Eval('active')})
|
||||
name = fields.Char('Name', required=True,
|
||||
states={'readonly': ~Eval('active')},
|
||||
depends=['active'])
|
||||
code = fields.Char('Code', states={'readonly': ~Eval('active')},
|
||||
depends=['active'])
|
||||
states={'readonly': ~Eval('active')})
|
||||
code = fields.Char('Code',
|
||||
states={'readonly': ~Eval('active')})
|
||||
|
||||
|
||||
class DockMixin(object):
|
||||
"""Adds dock field to Model"""
|
||||
__slots__ = ()
|
||||
|
||||
dock = fields.Many2One('stock.location.dock', 'Dock',
|
||||
ondelete='RESTRICT',
|
||||
domain=[('location', '=', Eval('warehouse'))],
|
||||
states={'readonly': Eval('state') != 'draft'},
|
||||
depends=['state', 'warehouse'])
|
||||
dock = fields.Many2One('stock.location.dock', 'Dock', ondelete='RESTRICT',
|
||||
domain=[('location', '=', Eval('warehouse'))],
|
||||
states={'readonly': Eval('state') != 'draft'})
|
||||
|
||||
@fields.depends('warehouse')
|
||||
def on_change_with_dock(self):
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from .test_stock import suite
|
||||
|
|
|
@ -29,29 +29,6 @@ Create customer::
|
|||
>>> customer = Party(name='Customer')
|
||||
>>> 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::
|
||||
|
||||
>>> Location = Model.get('stock.location')
|
||||
|
|
14
tests/test_module.py
Normal file
14
tests/test_module.py
Normal 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
7
tests/test_scenario.py
Normal 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)
|
|
@ -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
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.0
|
||||
version=6.4.0
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
|
|
Loading…
Reference in a new issue