Odoo Help

0

question of editing view of one2many field

By
willie ho
on 8/12/15, 9:40 PM 769 views

I am making a tree view for one2many field

I will create the records for user to edit at the beginning so I don't want to let them create or delete records but only edit them

what should I put in the xml?

6

Hello Willie ho,

To achieve this you need to add 2 attributes in your One2Many field's tree view. 

1. create = "false"

2. delete = "false"

In below example, I have stopped create and delete in sale order line. ( This is tree view declared for order line in Sale Order's form view )


<tree string="Sales Order Lines" editable="bottom" create="false" delete="false">
<field name="sequence" widget="handle"/>
<field name="state" invisible="1"/>
<field name="th_weight" invisible="1"/>
<field name="product_id" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" groups="base.group_user" on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, False, product_uos_qty, False, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
<field name="name"/>
<field name="product_uom_qty" context="{'partner_id':parent.partner_id, 'quantity':product_uom_qty, 'pricelist':parent.pricelist_id, 'uom':product_uom}" on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
<field name="product_uom" on_change="product_uom_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, False, parent.date_order, context)" groups="product.group_uom" options="{"no_open": True}"/>
<field name="product_uos_qty" groups="product.group_uos" invisible="1"/>
<field name="product_uos" string="UoS" groups="product.group_uos" invisible="1"/>
<field name="price_unit"/>
<field name="tax_id" widget="many2many_tags" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="price_subtotal"/>
</tree>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 8/12/15, 9:40 PM
Seen: 769 times
Last updated: 8/13/15, 1:56 AM