Browse Source

[12.0][FIX] contract & contract_sale - security fix

The lowest model access for contract.contract model is group_account_invoice group. However the addon adds two smart buttons to res.partner view without any security restrictions and without compute_sudo attribute on computed fields.
This causes the view to crash when a user without the proper permissions tries to access the res.partner form view.
The solution adds groups_id to the partner form views in which the buttons are added, so the only loads when the user has proper permissions.
Other way to solve it would be to add compute_sudo attribute to the relevant fields, but this causes an access error when the user clicks on the smart buttons.
13.0-mig-contract
Enrique 5 years ago
committed by Administrator
parent
commit
87f73361b9
  1. 1
      contract/views/res_partner_view.xml

1
contract/views/res_partner_view.xml

@ -6,6 +6,7 @@
<record id="view_partner_form" model="ir.ui.view"> <record id="view_partner_form" model="ir.ui.view">
<field name="inherit_id" ref="base.view_partner_form" /> <field name="inherit_id" ref="base.view_partner_form" />
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
<field type="xml" name="arch"> <field type="xml" name="arch">
<xpath expr="//div[@name='button_box']" position="inside"> <xpath expr="//div[@name='button_box']" position="inside">
<button name="act_show_contract" type="object" class="oe_stat_button" <button name="act_show_contract" type="object" class="oe_stat_button"

Loading…
Cancel
Save