Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
[V8] Show 'Invoiced' magic button for specific group in partner form view
Hi all,
I want to change the behaviour of the 'Invoiced' "magic button" in partner form view.
I noticed that the crresponding field is defined as follow:
_columns = {
'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float', groups='account.group_account_invoice'),
}
What does this 'kwarg' argument "groups" mean ?
I couldn't find any documentation about it, so I supposed it makes the field accessible only for users who belong to the 'account.group_account_invoice'.
Now I've created a custom group. How can I add it to the list of authorized groups ?
I tried to redefine the field using V8 API and following syntax
total_invoiced = field.Float(groups='account.group_account_invoice,custom.my_custom_group')
But it doesn't seem to work.
Same using the old API syntax.
Ok I dit it.
What I didn't know is that I had to do two things. First I had to override the field. I did it with the legacy syntax because it didn't seem to work with the new one:
_columns = {
'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float', groups='account.group_account_invoice'),
}
But I didn't know that I also had to allow the group to see the corresponding view.
To do that, two ways: GUI or code.
First, find the xml_id of the view you want to show.
You can do it in the Config > Groups > Your group and Views tabs.
In my case, it was account.partner_view_buttons.
Then, add a view line in the views tab of your target group.
To do it with xml file:
<record id="sale.group_sale_invoice" model="res.groups">
<field name="name">Watch Invoices</field>
<field name="category_id" ref="base.module_category_sales_management"/>
<!-- The following line does the trick --> <field name="view_access" eval="[(4, ref('account.partner_view_buttons'),0)]" />
</record>
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 6/24/16, 10:26 AM |
Seen: 443 times |
Last updated: 6/24/16, 3:21 PM |