Reviewers: ,
Please review this at http://codereview.tryton.org/269001/
Affected files:
M CHANGELOG
M product.py
Index: CHANGELOG
===================================================================
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+* Category is no more required on product
+
Version 2.2.0 - 2011-10-24
* Bug fixes (see mercurial logs for details)
Index: product.py
===================================================================
--- a/product.py
+++ b/product.py
@@ -4,6 +4,7 @@
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.pool import Pool
+from trytond.backend import TableHandler
STATES = {
'readonly': ~Eval('active', True),
@@ -23,7 +24,7 @@
('consumable', 'Consumable'),
('service', 'Service')
], 'Type', required=True, states=STATES, depends=DEPENDS)
- category = fields.Many2One('product.category', 'Category',
required=True,
+ category = fields.Many2One('product.category', 'Category',
states=STATES, depends=DEPENDS)
list_price = fields.Property(fields.Numeric('List Price',
states=STATES,
digits=(16, 4), depends=DEPENDS))
@@ -44,6 +45,15 @@
products = fields.One2Many('product.product', 'template', 'Products',
states=STATES, depends=DEPENDS)
+ def init(self, module_name):
+ cursor = Transaction().cursor
+
+ super(Template, self).init(module_name)
+
+ table = TableHandler(cursor, self, module_name)
+ # Migration from 2.2: category is no more required
+ table.not_null_action('category', 'remove')
+
def default_active(self):
return True
--
[email protected] mailing list