diff --git a/position.py b/position.py index 1205dbe..e6622dd 100644 --- a/position.py +++ b/position.py @@ -7,23 +7,25 @@ class ProductPosition(ModelSQL, ModelView): "Product Position" __name__ = "product.position" name = fields.Char('Name', required=True) - parent = fields.Many2One('product.position', 'Parent') + # parent = fields.Many2One('product.position', 'Parent') warehouse = fields.Many2One('stock.location', 'Warehouse', states={ 'required': True }, domain=[('type', '=', 'warehouse')] ) - childs = fields.One2Many('product.position', 'parent', string='Children') + # childs = fields.One2Many('product.position', 'parent', string='Children') @classmethod def __setup__(cls): super(ProductPosition, cls).__setup__() cls._order.insert(0, ('name', 'ASC')) - def get_rec_name(self, name): - if self.parent: - return self.parent.get_rec_name(name) + ' / ' + self.name - else: - return self.name + @classmethod + def __register__(cls, module_name): + table = cls.__table_handler__(module_name) + + # correction + if table.column_exist('parent'): + table.drop_column('parent') class ProductTemplatePosition(ModelSQL, ModelView): @@ -35,8 +37,6 @@ class ProductTemplatePosition(ModelSQL, ModelView): template = fields.Many2One('product.template', 'Template', required=True, ondelete='RESTRICT') warehouse =fields.Function(fields.Many2One('stock.location', 'Warehouse'), 'on_change_with_warehouse') - def get_rec_name(self, name): - return '[ ' + self.position.warehouse.name + ' ]' + self.position.rec_name @fields.depends('position') def on_change_with_warehouse(self, name=None): diff --git a/position.xml b/position.xml index dd10c9b..3917cbb 100644 --- a/position.xml +++ b/position.xml @@ -10,27 +10,21 @@ this repository contains the full copyright notices and license terms. --> 10 position_tree - - product.position - tree - 20 - childs - position_tree2 - product.position form + 20 position_form Positions product.position - + - + diff --git a/view/position_form.xml b/view/position_form.xml index 7427405..d63fd83 100644 --- a/view/position_form.xml +++ b/view/position_form.xml @@ -4,15 +4,6 @@ this repository contains the full copyright notices and license terms. -->