Skip to content
Permalink
Browse files

[IMP] mail,*: remove useless field `is_master_data`

This field is a non-sense. By using the same logic, it should be added
to any low level model.
Replace the check by a simple verification of presence of an XMLID.

A more generic opt-in solution should be integrated into ORM.

Partially revert commits 0db0e66 and
bbd64c2.

See #29257 odoo/enterprise#3550

closes #31778

Signed-off-by: Christophe Simonis <chs@odoo.com>
  • Loading branch information...
KangOl committed Mar 12, 2019
1 parent 6207391 commit 2602642a78dff6c15d615fadf4c55a6b6ca315df
@@ -5,7 +5,6 @@
<field name="name">Contract to Renew</field>
<field name="icon">fa-car</field>
<field name="res_model_id" ref="fleet.model_fleet_vehicle_log_contract"/>
<field name="is_master_data">True</field>
</record>

<record id="mt_fleet_driver_updated" model="mail.message.subtype">
@@ -6,7 +6,6 @@
<field name="name">Expense Approval</field>
<field name="icon">fa-dollar</field>
<field name="res_model_id" ref="hr_expense.model_hr_expense_sheet"/>
<field name="is_master_data">True</field>
</record>

<!-- default alias for expenses -->
@@ -6,27 +6,23 @@
<field name="name">Time Off Approval</field>
<field name="icon">fa-sun-o</field>
<field name="res_model_id" ref="hr_holidays.model_hr_leave"/>
<field name="is_master_data">True</field>
</record>
<record id="mail_act_leave_second_approval" model="mail.activity.type">
<field name="name">Time Off Second Approve</field>
<field name="icon">fa-sun-o</field>
<field name="res_model_id" ref="hr_holidays.model_hr_leave"/>
<field name="is_master_data">True</field>
</record>

<!-- Leave specific activities -->
<record id="mail_act_leave_allocation_approval" model="mail.activity.type">
<field name="name">Allocation Approval</field>
<field name="icon">fa-sun-o</field>
<field name="res_model_id" ref="hr_holidays.model_hr_leave_allocation"/>
<field name="is_master_data">True</field>
</record>
<record id="mail_act_leave_allocation_second_approval" model="mail.activity.type">
<field name="name">Allocation Second Approve</field>
<field name="icon">fa-sun-o</field>
<field name="res_model_id" ref="hr_holidays.model_hr_leave_allocation"/>
<field name="is_master_data">True</field>
</record>

<!-- Holidays-related subtypes for messaging / Chatter -->
@@ -58,4 +54,4 @@
<field name="description">Allocation Request</field>
</record>
</data>
</odoo>
</odoo>
@@ -11,20 +11,17 @@
<field name="icon">fa-phone</field>
<field name="delay_count">2</field>
<field name="sequence">6</field>
<field name="is_master_data">True</field>
</record>
<record id="mail_activity_data_meeting" model="mail.activity.type">
<field name="name">Meeting</field>
<field name="icon">fa-users</field>
<field name="sequence">9</field>
<field name="is_master_data">True</field>
</record>
<record id="mail_activity_data_todo" model="mail.activity.type">
<field name="name">To Do</field>
<field name="icon">fa-tasks</field>
<field name="delay_count">5</field>
<field name="sequence">12</field>
<field name="is_master_data">True</field>
</record>
<record id="mail_activity_data_upload_document" model="mail.activity.type">
<field name="name">Upload Document</field>
@@ -39,7 +36,6 @@
<field name="delay_count">0</field>
<field name="sequence">99</field>
<field name="decoration_type">warning</field>
<field name="is_master_data">True</field>
</record>
</data>
</odoo>
@@ -78,7 +78,6 @@ def default_get(self, fields):
initial_res_model_id = fields.Many2one('ir.model', 'Initial model', compute="_compute_initial_res_model_id", store=False,
help='Technical field to keep trace of the model at the beginning of the edition for UX related behaviour')
res_model_change = fields.Boolean(string="Model has change", help="Technical field for UX related behaviour", default=False, store=False)
is_master_data = fields.Boolean(string="Master data", help="This field is used to prevent master data from the deletion.")

@api.onchange('res_model_id')
def _onchange_res_model_id(self):
@@ -91,9 +90,8 @@ def _compute_initial_res_model_id(self):

@api.multi
def unlink(self):
for activity_type in self:
if activity_type.is_master_data:
raise exceptions.ValidationError("You can not delete activity type that are used as master data.")
if any(self.get_external_id().values()):
raise exceptions.ValidationError("You can not delete activity type that are used as master data.")
return super(MailActivityType, self).unlink()


@@ -32,7 +32,6 @@
</div>
<field name="delay_from"/>
</div>
<field name="is_master_data" groups="base.group_no_one"/>
</group>
<group name="activity_planning">
<field name="force_next"/>
@@ -6,7 +6,6 @@
<field name="name">Maintenance Request</field>
<field name="icon">fa-wrench</field>
<field name="res_model_id" ref="maintenance.model_maintenance_request"/>
<field name="is_master_data">True</field>
</record>

<!-- email alias for maintenance requests -->
@@ -10,7 +10,6 @@
<field name="res_model_id" ref="stock.model_stock_production_lot"/>
<field name="icon">fa-tasks</field>
<field name="delay_count">0</field>
<field name="is_master_data">True</field>
</record>
</odoo>

@@ -6,7 +6,6 @@
<field name="name">Order Upsell</field>
<field name="icon">fa-line-chart</field>
<field name="res_model_id" ref="sale.model_sale_order"/>
<field name="is_master_data">True</field>
</record>

<!-- Sale-related subtypes for messaging / Chatter -->

0 comments on commit 2602642

Please sign in to comment.
You can’t perform that action at this time.