[FIX] event_sale, mass_mailing_event: add groups on app-specific fields
Currently if you configure an user without sales and mass mailing
rights you run into issues with links modules as
* sales data is computed on form view and requires sales access
rights;
* invite and contact buttons lead to tracebacks as their action
require mailing access rights;
In this commit we fix those issues by correctly setting groups
on fields.
Task ID 2184037
PR #53119
X-original-commit: af1a5d294b235e33a48b87c89886b24ea145450d
This commit is contained in:
@@ -9,8 +9,11 @@ class Event(models.Model):
|
||||
|
||||
sale_order_lines_ids = fields.One2many(
|
||||
'sale.order.line', 'event_id',
|
||||
groups='sales_team.group_sale_salesman',
|
||||
string='All sale order lines pointing to this event')
|
||||
sale_price_subtotal = fields.Monetary(string='Sales (Tax Excluded)', compute='_compute_sale_price_subtotal')
|
||||
sale_price_subtotal = fields.Monetary(
|
||||
string='Sales (Tax Excluded)', compute='_compute_sale_price_subtotal',
|
||||
groups='sales_team.group_sale_salesman')
|
||||
currency_id = fields.Many2one(
|
||||
'res.currency', string='Currency',
|
||||
related='company_id.currency_id', readonly=True)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<button name="action_view_linked_orders"
|
||||
type="object" class="oe_stat_button" icon="fa-dollar"
|
||||
groups="sales_team.group_sale_salesman"
|
||||
help="Total sales for this event"
|
||||
attrs="{'invisible': ['|', ('sale_price_subtotal', '=', 0), ('sale_price_subtotal', '=', False)]}">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
|
||||
@@ -9,10 +9,16 @@
|
||||
<xpath expr="//field[@name='stage_id']" position="before">
|
||||
<field name="event_registrations_open" invisible="1"/>
|
||||
<button name="action_invite_contacts" type="object" string="Invite"
|
||||
class="btn btn-primary" attrs="{'invisible': [('event_registrations_open', '=', False)]}"/>
|
||||
class="btn btn-primary"
|
||||
groups="mass_mailing.group_mass_mailing_user"
|
||||
attrs="{'invisible': [('event_registrations_open', '=', False)]}"/>
|
||||
<button name="action_invite_contacts" type="object" string="Invite"
|
||||
class="btn btn-secondary" attrs="{'invisible': [('event_registrations_open', '=', True)]}"/>
|
||||
<button name="action_mass_mailing_attendees" string="Contact Attendees" type="object" attrs="{'invisible': [('seats_expected', '=', 0)]}"/>
|
||||
class="btn btn-secondary"
|
||||
groups="mass_mailing.group_mass_mailing_user"
|
||||
attrs="{'invisible': [('event_registrations_open', '=', True)]}"/>
|
||||
<button name="action_mass_mailing_attendees" type="object" string="Contact Attendees"
|
||||
groups="mass_mailing.group_mass_mailing_user"
|
||||
attrs="{'invisible': [('seats_expected', '=', 0)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user