2014-02-18 4 views
0

Как показать категорию на складе перемещать дерево. Это мое кодирование.показать товар категории на складе перемещение дерева в openerp7

My view file.

<record id="royalfood_stock_move_tree_view" model="ir.ui.view"> 
    <field name="name">stock.move.tree</field> 
    <field name="model">stock.move</field> 
    <field name="inherit_id" ref="stock.view_move_tree" /> 
    <field name="arch" type="xml"> 
       <xpath expr="//field[@name='product_id']" position="before"> 
      <field name="categ_id" groups="base.group_user"/> 
       </xpath> 
    </field> 
</record> 

Мой .py Файл

class custom_stock_move_tree(osv.osv_memory): 
_columns = {  
      'categ_id': fields.related('product_id', 'categ_id', type='many2one' ,relation='product.category', store=True),    
      } 
custom_stock_move_tree() 

Приветствуется любая помощь.

ответ

0

попробуйте эти файлы.

вашего .py файла

class custom_stock_move_tree(osv.Model): #their is different b/w osv.Model and osv.osv_memory before to use it read it's usage 

    _inherit = 'stock.move' # if you want to add data in existing module use inherit 
    _columns = 
    {  
     'categ_id': fields.related('product_id', 'categ_id', type='many2one' ,relation='product.category', store=True, string='Product Category'),    
    } 

Вашего view.xml файла

<record id="royalfood_stock_move_tree_view" model="ir.ui.view"> 
<field name="name">stock.move.tree</field> 
<field name="model">stock.move</field> 
<field name="inherit_id" ref="stock.view_move_tree" /> 
<field name="arch" type="xml"> 
    <xpath expr="//field[@name='product_id']" position="before"> 
     <field name="categ_id" groups="base.group_user"/> 
    </xpath> 
</field> 

После этого увидеть ваш Stock Move Дерева.

+0

Спасибо за ваш ответ. –

+0

Вы решили свою проблему ?? –

Смежные вопросы