diff --git a/__init__.py b/__init__.py index 0ca2118..605ef2a 100644 --- a/__init__.py +++ b/__init__.py @@ -7,7 +7,7 @@ from .stock import * def register(): Pool.register( - Product, + Template, Lot, Location, Move, diff --git a/stock.py b/stock.py index 4fba8d6..0ac8e9c 100644 --- a/stock.py +++ b/stock.py @@ -7,12 +7,12 @@ from trytond.pool import Pool, PoolMeta from trytond.pyson import And, Bool, Equal, Eval, If, Not from trytond.transaction import Transaction -__all__ = ['Product', 'Lot', 'Location', 'Move'] +__all__ = ['Template', 'Lot', 'Location', 'Move'] __metaclass__ = PoolMeta -class Product: - __name__ = 'product.product' +class Template: + __name__ = 'product.template' life_time = fields.Integer('Life Time', help='The number of days before a lot may become dangerous and should ' @@ -80,7 +80,7 @@ class Lot: for fname in ('life_date', 'expiry_date', 'removal_date', 'alert_date'): product_field = fname.replace('date', 'time') - margin = getattr(self.product, product_field) + margin = getattr(self.product.template, product_field) result[fname] = (margin and date.today() + timedelta(days=margin)) return result diff --git a/stock.xml b/stock.xml index d4d7e34..22c9dd0 100644 --- a/stock.xml +++ b/stock.xml @@ -5,14 +5,14 @@ - product.product - + product.template + product_form - product.product - + product.template + product_list diff --git a/tests/test_stock_lot_expiry.py b/tests/test_stock_lot_expiry.py index d88499a..3e5bb5e 100644 --- a/tests/test_stock_lot_expiry.py +++ b/tests/test_stock_lot_expiry.py @@ -63,13 +63,13 @@ class TestCase(unittest.TestCase): 'cost_price': Decimal(0), 'cost_price_method': 'fixed', 'default_uom': unit.id, - }]) - product, = self.product.create([{ - 'template': template.id, 'life_time': 20, 'expiry_time': 10, 'alert_time': 5, }]) + product, = self.product.create([{ + 'template': template.id, + }]) lot, lot2, = self.lot.create([{ 'number': '001', 'product': product.id, @@ -116,13 +116,13 @@ class TestCase(unittest.TestCase): 'cost_price': Decimal(0), 'cost_price_method': 'fixed', 'default_uom': unit.id, - }]) - product, = self.product.create([{ - 'template': template.id, 'life_time': 20, 'expiry_time': 10, 'alert_time': 5, }]) + product, = self.product.create([{ + 'template': template.id, + }]) lot, lot2, = self.lot.create([{ 'number': '001', 'product': product.id, diff --git a/view/product_form.xml b/view/product_form.xml index 3a9c294..9f59ce1 100644 --- a/view/product_form.xml +++ b/view/product_form.xml @@ -2,8 +2,8 @@ - - + + + diff --git a/view/product_list.xml b/view/product_list.xml index e261b54..7f7a818 100644 --- a/view/product_list.xml +++ b/view/product_list.xml @@ -2,7 +2,7 @@ - +