summaryrefslogtreecommitdiff
path: root/addons/maintenance
diff options
context:
space:
mode:
authorSiddarth Gajjar <sga@odoo.com>2020-01-28 10:45:46 +0000
committerThibault Delavallée <tde@odoo.com>2020-03-30 12:50:26 +0000
commita1b01751b558ac3f85478e3f1ea273f950083894 (patch)
tree8b87c4fbfffe76a3f028aaffe8d74a3c35a59a5d /addons/maintenance
parent92b176e89c4261bc7cc3b502eab8d308189b3e40 (diff)
[IMP] mail: prevent from re-using aliases
PURPOSE Make aliases usage more unique, prevent re-using bounce or catchall aliases and remove auto-uniqueness of aliases. SPECIFICATIONS Before this commit, user could create an email alias having same name as catchall/bounce email alias, which should not happen. Also, while creating or duplicating alias, if the same name was already available, a new unique name was generated by adding a sequence number to existing name. This behavior is not considered as a good one as it magically creates aliases different from what user expects. User could even not own the newly-created alias, leading to a broken mail gateway. In this commit we improve that behavior by ensuring that no duplicate alias name should be entered while creation / updation for both catcall/bounce and mail alias. Also, while duplicating an alias, name will now be blank by default to force user to enter the name. Finally when creating an alias an error is raised if the name is already taken. Task ID 2160070
Diffstat (limited to 'addons/maintenance')
-rw-r--r--addons/maintenance/data/maintenance_demo.xml5
-rw-r--r--addons/maintenance/tests/test_maintenance.py3
-rw-r--r--addons/maintenance/tests/test_maintenance_multicompany.py6
3 files changed, 4 insertions, 10 deletions
diff --git a/addons/maintenance/data/maintenance_demo.xml b/addons/maintenance/data/maintenance_demo.xml
index 69e91400fa6..5707b3e6782 100644
--- a/addons/maintenance/data/maintenance_demo.xml
+++ b/addons/maintenance/data/maintenance_demo.xml
@@ -14,26 +14,21 @@
<!-- Equipment categories -->
<record id="equipment_computer" model="maintenance.equipment.category">
<field name="name">Computers</field>
- <field name="alias_id" ref="mail_alias_equipment"/>
</record>
<record id="equipment_software" model="maintenance.equipment.category">
<field name="name">Software</field>
- <field name="alias_id" ref="mail_alias_equipment"/>
</record>
<record id="equipment_printer" model="maintenance.equipment.category">
<field name="name">Printers</field>
- <field name="alias_id" ref="mail_alias_equipment"/>
</record>
<record id="equipment_monitor" model="maintenance.equipment.category">
<field name="name">Monitors</field>
<field name="technician_user_id" ref="base.user_admin"/>
<field name="color">3</field>
- <field name="alias_id" ref="mail_alias_equipment"/>
</record>
<record id="equipment_phone" model="maintenance.equipment.category">
<field name="name">Phones</field>
<field name="technician_user_id" ref="base.user_admin"/>
- <field name="alias_id" ref="mail_alias_equipment"/>
</record>
<!-- Equipments -->
diff --git a/addons/maintenance/tests/test_maintenance.py b/addons/maintenance/tests/test_maintenance.py
index e4acceb1767..6cd04bd4192 100644
--- a/addons/maintenance/tests/test_maintenance.py
+++ b/addons/maintenance/tests/test_maintenance.py
@@ -37,8 +37,7 @@ class TestEquipment(TransactionCase):
))
self.equipment_monitor = self.env['maintenance.equipment.category'].create({
- 'name': 'Monitors',
- 'alias_id': self.env.ref('maintenance.mail_alias_equipment').id,
+ 'name': 'Monitors - Test',
})
def test_10_equipment_request_category(self):
diff --git a/addons/maintenance/tests/test_maintenance_multicompany.py b/addons/maintenance/tests/test_maintenance_multicompany.py
index 7c615921f4b..5ec2a6bce71 100644
--- a/addons/maintenance/tests/test_maintenance_multicompany.py
+++ b/addons/maintenance/tests/test_maintenance_multicompany.py
@@ -78,21 +78,21 @@ class TestEquipmentMulticompany(TransactionCase):
# create equipment category for equipment manager
category_1 = Category.with_user(equipment_manager).with_context(allowed_company_ids=cids).create({
- 'name': 'Monitors',
+ 'name': 'Monitors - Test',
'company_id': company_b.id,
'technician_user_id': equipment_manager.id,
})
# create equipment category for equipment manager
Category.with_user(equipment_manager).with_context(allowed_company_ids=cids).create({
- 'name': 'Computers',
+ 'name': 'Computers - Test',
'company_id': company_b.id,
'technician_user_id': equipment_manager.id,
})
# create equipment category for equipment user
Category.with_user(equipment_manager).create({
- 'name': 'Phones',
+ 'name': 'Phones - Test',
'company_id': company_a.id,
'technician_user_id': equipment_manager.id,
})