Browse Source
[MIG] partner_firstname: Fix config settings
[MIG] partner_firstname: Fix config settings
Display the recompute button only after saving the settings if the order hase changed. Once the recompute is done, the buttons desapears. Bedore this change it was not possible to recompute the partner names order since the button was only displayed after changing the order value but before saving the changes. When clicked, an error message was displayed since the action will force the reload of the page before saving the values...14.0
Laurent Mignon (ACSONE)
5 years ago
committed by
Luis Torres
8 changed files with 72 additions and 57 deletions
-
11partner_firstname/README.rst
-
27partner_firstname/i18n/partner_firstname.pot
-
37partner_firstname/models/base_config_settings.py
-
7partner_firstname/static/description/index.html
-
1partner_firstname/tests/__init__.py
-
35partner_firstname/tests/test_config_settings.py
-
7partner_firstname/tests/test_order.py
-
4partner_firstname/tests/test_user_form.py
@ -0,0 +1,35 @@ |
|||||
|
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from odoo.tests.common import SavepointCase |
||||
|
|
||||
|
|
||||
|
class TestConfigSettings(SavepointCase): |
||||
|
@classmethod |
||||
|
def setUpClass(cls): |
||||
|
super().setUpClass() |
||||
|
cls.config = cls.env["res.config.settings"].create({}) |
||||
|
|
||||
|
def _change_partner_names_order(self): |
||||
|
orders = [o[0] for o in self.config._partner_names_order_selection()] |
||||
|
current = new = self.config.partner_names_order |
||||
|
for o in orders: |
||||
|
if o != current: |
||||
|
new = o |
||||
|
break |
||||
|
self.config.partner_names_order = new |
||||
|
|
||||
|
def test_partner_names_order_changed(self): |
||||
|
# The partner_names_order_changed is set to true at save time when |
||||
|
# the value of partner_names_order is updated |
||||
|
self.assertFalse(self.config.partner_names_order_changed) |
||||
|
self._change_partner_names_order() |
||||
|
self.assertTrue(self.config.partner_names_order_changed) |
||||
|
|
||||
|
def test_partner_names_order_changed_reset(self): |
||||
|
# The partner_names_order_changed is reset to false when |
||||
|
# the action action_recalculate_partners_name is executed |
||||
|
self._change_partner_names_order() |
||||
|
self.assertTrue(self.config.partner_names_order_changed) |
||||
|
self.config.action_recalculate_partners_name() |
||||
|
self.assertFalse(self.config.partner_names_order_changed) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue