Can OpenERP/Odoo7 handle filter many2one field per user access.
Fields:
client = many2one
account = many2one
branch = many2one
description
code
price
date
from the above simple fields, let say if you select one of the client from CLIENT field you should only see all ACCOUNT from that client and Branch each account please see below diagram:
CLIENT:
---Client1
------Account1
---------Branch1
---------Branch2
------Account2
---------Branch1
---------Branch2
------Account3
---------Branch1
---------Branch2
---Client2
------Account4
---------Branch1
---------Branch2
------Account5
---------Branch1
---------Branch2
------Account6
---------Branch1
---------Branch2
Please help me on how to achieve this, I dont know where I start.
If anyone can help it would be greatly appreciated.
class test_product(osv.Model):
_name = "test.product"
_columns = {
'client_id': fields.many2one('client', 'Client Name'),
'accounts_id': fields.many2one('accounts', 'Account Name'),
'branch_id': fields.many2one('branch','Branch Name'),
}class client(osv.Model):
_name = "client"
_columns = {
'client': fields.char('Client Name', size=32),
}class accounts(osv.Model):
_name = "accounts"
_columns = {
'accounts': fields.char('Account Name', size=32),
'client_id': fields.many2one('client', 'Client'),
}
class branch(osv.Model):
_name = "branch"
_columns = {
'branch': fields.char('Branch Name', size=32),
'accounts_id': fields.many2one('accounts', 'Account'),
}<record model="ir.actions.act_window" id="test_product_submenu_action">
<field name="name">Products</field>
<field name="res_model">test.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Click Create to add a new Codetest record.</p>
</field>
</record><record id="test_product_form_view" model="ir.ui.view">
<field name="name">test.product.form.vew</field>
<field name="model">test.product</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Product">
<field name="client_id"/>
<field name="accounts_id" domain="[('client_id', '=', client_id)]"/>
<field name="branch_id"/>
</form>
</field>
</record><menuitem id="test_product" name="Test Product" />
<menuitem id="test_product_menu" name="Test Product" parent="test_product"/>
<menuitem id="test_product_submenu" name="Product" parent="test_product_menu" action="test_product_submenu_action"/>
hope this will helps: https://learnopenerp.blogspot.com/2020/09/domain-filter-many2one-field-odoo13.html