[IMP] crm: remove the groups attributes on the recurring revenue fields

Purpose
=======
This commit remove the "groups" attribute  on the recurring revenue
fields. Instead we hide them directly in the views. This group was used
only to turn on / off the feature, not for security reason. So it's 
fine to move the group in the views.

It will help for the lead merge so we will not be forced to use SUDO
during the merge.

Task-2447721
PR odoo/odoo#75742
This commit is contained in:
std-odoo
2021-10-19 15:58:57 +00:00
parent 4ca397e265
commit 6e7b50708f
2 changed files with 17 additions and 17 deletions
+4 -6
View File
@@ -146,14 +146,12 @@ class Lead(models.Model):
# Revenues
expected_revenue = fields.Monetary('Expected Revenue', currency_field='company_currency', tracking=True)
prorated_revenue = fields.Monetary('Prorated Revenue', currency_field='company_currency', store=True, compute="_compute_prorated_revenue")
recurring_revenue = fields.Monetary('Recurring Revenues', currency_field='company_currency', groups="crm.group_use_recurring_revenues", tracking=True)
recurring_plan = fields.Many2one('crm.recurring.plan', string="Recurring Plan", groups="crm.group_use_recurring_revenues")
recurring_revenue = fields.Monetary('Recurring Revenues', currency_field='company_currency', tracking=True)
recurring_plan = fields.Many2one('crm.recurring.plan', string="Recurring Plan")
recurring_revenue_monthly = fields.Monetary('Expected MRR', currency_field='company_currency', store=True,
compute="_compute_recurring_revenue_monthly",
groups="crm.group_use_recurring_revenues")
compute="_compute_recurring_revenue_monthly")
recurring_revenue_monthly_prorated = fields.Monetary('Prorated MRR', currency_field='company_currency', store=True,
compute="_compute_recurring_revenue_monthly_prorated",
groups="crm.group_use_recurring_revenues")
compute="_compute_recurring_revenue_monthly_prorated")
company_currency = fields.Many2one("res.currency", string='Currency', related='company_id.currency_id', readonly=True)
# Dates
date_closed = fields.Datetime('Closed Date', readonly=True, copy=False)
+13 -11
View File
@@ -462,7 +462,7 @@
<field name="expected_revenue" class="oe_inline mr-5" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="priority" class="oe_inline" nolabel="1" widget="priority"/>
</div>
<div class="o_row">
<div class="o_row" groups="crm.group_use_recurring_revenues">
<field name="recurring_revenue" class="oe_inline pr-4" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_plan" class="oe_inline" placeholder="E.g. Monthly"
attrs="{'required': [('recurring_revenue', '!=', 0)]}" options="{'no_create': True, 'no_open': True}"/>
@@ -559,11 +559,11 @@
<div class="o_kanban_record_subtitle">
<t t-if="record.expected_revenue.raw_value">
<field name="expected_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<span t-if="record.recurring_revenue and record.recurring_revenue.raw_value"> + </span>
<span t-if="record.recurring_revenue and record.recurring_revenue.raw_value" groups="crm.group_use_recurring_revenues"> + </span>
</t>
<t t-if="record.recurring_revenue and record.recurring_revenue.raw_value">
<field name="recurring_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_plan"/>
<field name="recurring_revenue" widget="monetary" options="{'currency_field': 'company_currency'}" groups="crm.group_use_recurring_revenues"/>
<field name="recurring_plan" groups="crm.group_use_recurring_revenues"/>
</t>
</div>
<div>
@@ -634,11 +634,11 @@
<div class="o_kanban_record_subtitle">
<t t-if="record.prorated_revenue.raw_value">
<field name="prorated_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<span t-if="record.recurring_revenue and record.recurring_revenue.raw_value"> + </span>
<span t-if="record.recurring_revenue and record.recurring_revenue.raw_value" groups="crm.group_use_recurring_revenues"> + </span>
</t>
<t t-if="record.recurring_revenue and record.recurring_revenue.raw_value">
<field name="recurring_revenue" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_plan"/>
<field name="recurring_revenue" widget="monetary" options="{'currency_field': 'company_currency'}" groups="crm.group_use_recurring_revenues"/>
<field name="recurring_plan" groups="crm.group_use_recurring_revenues"/>
</t>
</div>
</xpath>
@@ -772,9 +772,11 @@
<field name="source_id" optional="hide"/>
<field name="company_currency" invisible="1"/>
<field name="expected_revenue" sum="Expected Revenues" optional="show" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_revenue_monthly" sum="Expected MRR" optional="show" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_revenue" sum="Recurring Revenue" optional="hide" widget="monetary" options="{'currency_field': 'company_currency'}"/>
<field name="recurring_plan" optional="hide"/>
<field name="recurring_revenue_monthly" sum="Expected MRR" optional="show" widget="monetary"
options="{'currency_field': 'company_currency'}" groups="crm.group_use_recurring_revenues"/>
<field name="recurring_revenue" sum="Recurring Revenue" optional="hide" widget="monetary"
options="{'currency_field': 'company_currency'}" groups="crm.group_use_recurring_revenues"/>
<field name="recurring_plan" optional="hide" groups="crm.group_use_recurring_revenues"/>
<field name="stage_id" optional="show" decoration-bf="1"/>
<field name="active" invisible="1"/>
<field name="probability" string="Probability (%)" optional="hide"/>
@@ -896,7 +898,7 @@
<field name="create_date" interval="month" type="row"/>
<field name="stage_id" type="col"/>
<field name="expected_revenue" type="measure"/>
<field name="recurring_revenue_monthly" type="measure"/>
<field name="recurring_revenue_monthly" type="measure" groups="crm.group_use_recurring_revenues"/>
<field name="color" invisible="1"/>
</pivot>
</field>