diff --git a/CHANGELOG b/CHANGELOG index 1e1ca34242..2aa26be05c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/product.py b/product.py index 33b97afcfb..2615116933 100644 --- a/product.py +++ b/product.py @@ -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):