Special "commands" format to manipulate the set of records stored in/associated with the field
One2many and
Many2many use a special "commands" format to
manipulate the set of records stored in/associated with the field.(0, _, values)- adds a new record created from the provided
valuedict. (1, id, values)- updates an existing record of id
idwith the values invalues. Can not be used increate(). (2, id, _)- removes the record of id
idfrom the set, then deletes it (from the database). Can not be used increate(). (3, id, _)- removes the record of id
idfrom the set, but does not delete it. Can not be used onOne2many. Can not be used increate(). (4, id, _)- adds an existing record of id
idto the set. Can not be used onOne2many. (5, _, _)- removes all records from the set, equivalent to using the
command
3on every record explicitly. Can not be used onOne2many. Can not be used increate(). (6, _, ids)- replaces all existing records in the set by the
idslist, equivalent to using the command5followed by a command4for eachidinids.
Note : Values marked as
Example:
Row-level access rules are defined in the ir.rule model and can be added/edited either via Technical menu or by adding a corresponding xml file to the module. The file is usually stored under security/ folder in your module directory and should look like this in your case:
Don't forget to add the path to the created file to the manifest of your module (__openerp__.py / __manifest__.py):
_ in the list above are ignored and
can be anything, generally 0 or False.Example:
Row-level access rules are defined in the ir.rule model and can be added/edited either via Technical menu or by adding a corresponding xml file to the module. The file is usually stored under security/ folder in your module directory and should look like this in your case:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="ownapp_managers_user_rule" model="ir.rule">
<field name="name">Ownapp_Shops for corresponding managers only</field>
<field name="model_id" ref="model_stock_location"/>
<field name="domain_force">[('create_uid','=',user.id)]
</field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>
</data>
</odoo>
Don't forget to add the path to the created file to the manifest of your module (__openerp__.py / __manifest__.py):
'data': [..., security/ownapp_managers_access_rules.xml]
No comments:
Post a Comment