Prevent changing product type if stock move exists

issue3558
review2311003
This commit is contained in:
Cédric Krier committed 2013-12-20 14:02:53 +01:00
1 parent 0ba33d88a2
commit c11b49fc3b
2 files changed
+7 -1

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Prevent changing product type if stock moves exist
* Use new methods to compute quantities in StockMixin._search_quantity()
* Split products_by_location into two methods on Move:
compute_quantities_query and compute_quantities
+6 -1
View File
@@ -44,12 +44,17 @@ class Template:
cls._error_messages.update({
'change_default_uom': ('You cannot change the default uom for '
'a product which is associated to stock moves.'),
'change_type': ('You cannot change the type for a product '
'which is associated to stock moves.'),
})
cls.cost_price.states['required'] = Or(
cls.cost_price.states.get('required', True),
Eval('type').in_(['goods', 'assets']))
cls.cost_price.depends.append('type')
cls._modify_no_move = [('default_uom', 'change_default_uom')]
cls._modify_no_move = [
('default_uom', 'change_default_uom'),
('type', 'change_type'),
]
@classmethod
def check_no_move(cls, templates, error):