mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
[IMP] base_global_discount: add specific security group
This way, it will be easier to decide who can set discount or not. The current group scope is too broad. [UPD] Update base_global_discount.pot
This commit is contained in:
@@ -39,6 +39,7 @@ Configuration
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Settings > Users*, choose yours and set *Manage Global Discounts*.
|
||||
#. Go to *Settings > Parameters > Global Discounts*
|
||||
#. Choose the discount scope (sales or purchases).
|
||||
#. You can also restrict it to a certain company if needed.
|
||||
@@ -46,7 +47,8 @@ To use this module, you need to:
|
||||
Usage
|
||||
=====
|
||||
|
||||
You can assign global discounts to partners as well:
|
||||
You can assign global discounts to partners as well. You'll need the proper
|
||||
permission (*Manage Global Discounts*):
|
||||
|
||||
#. Go to a partner that is a company.
|
||||
#. Go to the *Sales & Purchases* tab.
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
"license": "AGPL-3",
|
||||
"depends": ["product"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"security/security.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"views/global_discount_views.xml",
|
||||
"views/res_partner_views.xml",
|
||||
],
|
||||
|
||||
@@ -91,12 +91,24 @@ msgstr ""
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:res.groups,name:base_global_discount.group_global_discount
|
||||
msgid "Manage Global Discounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids
|
||||
#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view
|
||||
msgid "Purchase Global Discounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__supplier_global_discount_ids_readonly
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_users__supplier_global_discount_ids_readonly
|
||||
msgid "Purchase Global Discounts (readonly)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__purchase
|
||||
msgid "Purchases"
|
||||
@@ -105,9 +117,16 @@ msgstr ""
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids
|
||||
#: model_terms:ir.ui.view,arch_db:base_global_discount.res_partner_form_view
|
||||
msgid "Sale Global Discounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_partner__customer_global_discount_ids_readonly
|
||||
#: model:ir.model.fields,field_description:base_global_discount.field_res_users__customer_global_discount_ids_readonly
|
||||
msgid "Sale Global Discounts (readonly)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_global_discount
|
||||
#: model:ir.model.fields.selection,name:base_global_discount.selection__global_discount__discount_scope__sale
|
||||
msgid "Sales"
|
||||
|
||||
@@ -22,3 +22,17 @@ class ResPartner(models.Model):
|
||||
string="Purchase Global Discounts",
|
||||
domain=[("discount_scope", "=", "purchase")],
|
||||
)
|
||||
# HACK: Looks like UI doesn't behave well with Many2many fields and
|
||||
# negative groups when the same field is shown. In this case, we want to
|
||||
# show the readonly version to any not in the global discount group.
|
||||
# TODO: Check in v14 if it's fixed
|
||||
customer_global_discount_ids_readonly = fields.Many2many(
|
||||
string="Sale Global Discounts (readonly)",
|
||||
related="customer_global_discount_ids",
|
||||
readonly=True,
|
||||
)
|
||||
supplier_global_discount_ids_readonly = fields.Many2many(
|
||||
string="Purchase Global Discounts (readonly)",
|
||||
related="supplier_global_discount_ids",
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to *Settings > Users*, choose yours and set *Manage Global Discounts*.
|
||||
#. Go to *Settings > Parameters > Global Discounts*
|
||||
#. Choose the discount scope (sales or purchases).
|
||||
#. You can also restrict it to a certain company if needed.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
You can assign global discounts to partners as well:
|
||||
You can assign global discounts to partners as well. You'll need the proper
|
||||
permission (*Manage Global Discounts*):
|
||||
|
||||
#. Go to a partner that is a company.
|
||||
#. Go to the *Sales & Purchases* tab.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_global_discount_user,Global Discount Users,model_global_discount,base.group_user,1,0,0,0
|
||||
access_global_discount_partner_manager,Global Discount Partner Manager,model_global_discount,base.group_partner_manager,1,1,1,1
|
||||
access_global_discount_manager,Global Discount Manager,model_global_discount,base_global_discount.group_global_discount,1,1,1,1
|
||||
|
||||
|
@@ -13,4 +13,8 @@
|
||||
<field name="perm_write" eval="1" />
|
||||
<field name="perm_unlink" eval="1" />
|
||||
</record>
|
||||
<record id="group_global_discount" model="res.groups">
|
||||
<field name="name">Manage Global Discounts</field>
|
||||
<field name="category_id" ref="base.module_category_hidden" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -42,5 +42,6 @@
|
||||
name="Global Discounts"
|
||||
sequence="1"
|
||||
parent="base.menu_ir_property"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
/>
|
||||
</odoo>
|
||||
|
||||
@@ -10,6 +10,14 @@
|
||||
<field
|
||||
name="customer_global_discount_ids"
|
||||
widget="many2many_tags"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
||||
/>
|
||||
<field
|
||||
name="customer_global_discount_ids_readonly"
|
||||
string="Sale Global Discounts"
|
||||
widget="many2many_tags"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
||||
/>
|
||||
</group>
|
||||
@@ -17,6 +25,15 @@
|
||||
<field
|
||||
name="supplier_global_discount_ids"
|
||||
widget="many2many_tags"
|
||||
groups="base_global_discount.group_global_discount"
|
||||
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
||||
/>
|
||||
<field
|
||||
name="supplier_global_discount_ids_readonly"
|
||||
string="Purchase Global Discounts"
|
||||
readonly="1"
|
||||
widget="many2many_tags"
|
||||
groups="!base_global_discount.group_global_discount"
|
||||
attrs="{'invisible': [('is_company', '=', False), ('parent_id', '!=', False)]}"
|
||||
/>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user