Add field access on referential document

issue10269
review332861003
This commit is contained in:
Maxime Richez
2021-10-11 15:35:46 +02:00
parent 73c078daba
commit 2c45f5e695
5 changed files with 37 additions and 3 deletions
+2
View File
@@ -1,3 +1,5 @@
* Add group to edit accounting of products
Version 6.0.0 - 2021-05-03
* Bug fixes (see mercurial logs for details)
* Add deductible rate for supplier taxes
+9
View File
@@ -3,6 +3,15 @@
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="res.group" id="group_account_product_admin">
<field name="name">Account Product Administration</field>
<field name="parent" ref="product.group_product_admin"/>
</record>
<record model="res.user-res.group" id="user_admin_group_account_product_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_account_product_admin"/>
</record>
<record model="ir.ui.view" id="create_chart_properties_view_form">
<field name="model">account.create_chart.properties</field>
<field name="inherit"
+12
View File
@@ -399,6 +399,18 @@ class Template(CompanyMultiValueMixin, metaclass=PoolMeta):
def supplier_taxes_deductible_rate_used(self):
return self.get_taxes('supplier_taxes_deductible_rate_used')
@classmethod
def copy(cls, templates, default=None):
context = Transaction().context
default = default.copy() if default else {}
if context.get('_check_access'):
default.setdefault(
'account_category',
cls.default_get(
['account_category'],
with_rec_name=False).get('account_category'))
return super().copy(templates, default=default)
class Product(metaclass=PoolMeta):
__name__ = 'product.product'
+13 -2
View File
@@ -28,9 +28,9 @@ this repository contains the full copyright notices and license terms. -->
<field name="global_p" eval="False"/>
<field name="perm_read" eval="False"/>
</record>
<record model="ir.rule.group-res.group" id="rule_group_category_accounting-account_admin">
<record model="ir.rule.group-res.group" id="rule_group_category_account-account_product_admin">
<field name="rule_group" ref="rule_group_category_accounting"/>
<field name="group" ref="account.group_account_admin"/>
<field name="group" ref="group_account_product_admin"/>
</record>
<record model="ir.rule" id="rule_category_accounting_accounting">
<field name="domain" eval="[('accounting', '=', True)]" pyson="1"/>
@@ -49,5 +49,16 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">template_tree</field>
</record>
<record model="ir.model.field.access" id="access_template_account_category">
<field name="field" search="[('model.model', '=', 'product.template'), ('name', '=', 'account_category')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
</record>
<record model="ir.model.field.access" id="access_template_account_category_account_product_admin">
<field name="field" search="[('model.model', '=', 'product.template'), ('name', '=', 'account_category')]"/>
<field name="group" ref="group_account_product_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
</record>
</data>
</tryton>
+1 -1
View File
@@ -8,8 +8,8 @@ depends:
extras_depend:
analytic_account
xml:
account.xml
product.xml
configuration.xml
account.xml
message.xml
analytic_account.xml