简体   繁体   中英

adding more than one entries using same field in odoo

I have a field named items that i have defined as a Many2many field

item_ids = fields.Many2many('ics.itemdetails',string="Add items")

The model ics.itemdetails has the following fields

itm_nams = fields.Many2one('product.template',string="Name")
weight = fields.Char(string="Weight")

I want the user to select a product from product.template entries and fill the other field, for each product they add. Also a second user cannot select an entry from the previous entries. The problem is that a second user can select a previously entered entry. Am i doing it the right way? How do i prevent previous entries being shown for a second user?. I am using odoo 12.

you can use ir.rule for setting accesses of record.

<record id="normal_user_rule" model="ir.rule">
    <field name="name">User can see its own records</field>
    <field name="model_id" ref="model_name/>
    <field name="domain_force">[('user_id','=',user.id)]</field>
    <field name='perm_create' eval='True'/>
    <field name='perm_read' eval='True'/>
    <field name='perm_unlink' eval='True'/>
    <field name='perm_write' eval='True'/>
</record>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM