minor fix
This commit is contained in:
parent
7b19ba6bea
commit
b08e0d8889
18
position.py
18
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):
|
||||
|
|
12
position.xml
12
position.xml
|
@ -10,27 +10,21 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="priority">10</field>
|
||||
<field name="name">position_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="position_view_tree2">
|
||||
<field name="model">product.position</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="field_childs">childs</field>
|
||||
<field name="name">position_tree2</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="position_view_form">
|
||||
<field name="model">product.position</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority">20</field>
|
||||
<field name="name">position_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_position_tree">
|
||||
<field name="name">Positions</field>
|
||||
<field name="res_model">product.position</field>
|
||||
<field name="domain" eval="[('parent', '=', None)]" pyson="1"/>
|
||||
<field name="domain" eval="[]" pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_position_tree_view1">
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view" ref="position_view_tree2"/>
|
||||
<field name="view" ref="position_view_tree"/>
|
||||
<field name="act_window" ref="act_position_tree"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_position_tree_view2">
|
||||
|
|
|
@ -4,15 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="parent"/>
|
||||
<field name="parent" widget="selection"/>
|
||||
<label name="warehouse"/>
|
||||
<field name="warehouse"/>
|
||||
<label name="rec_name"/>
|
||||
<field name="rec_name" colspan="3"/>
|
||||
<notebook colspan="4">
|
||||
<page string="Children" col="1" id="childs">
|
||||
<field name="childs"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="rec_name"/>
|
||||
<field name="warehouse"/>
|
||||
</tree>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
Loading…
Reference in New Issue