-
-
Notifications
You must be signed in to change notification settings - Fork 863
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] partner_company_group: Add advises when company_group pricelist…
… is different than member pricelists
- Loading branch information
1 parent
46e929f
commit 3301e6d
Showing
6 changed files
with
238 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,16 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: Odoo Server 13.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2020-07-03 17:19+0000\n" | ||
"POT-Creation-Date: 2022-04-11 11:02+0000\n" | ||
"PO-Revision-Date: 2022-04-11 13:05+0200\n" | ||
"Last-Translator: Sergio Teruel <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 3.10\n" | ||
"X-Generator: Poedit 2.3\n" | ||
|
||
#. module: partner_company_group | ||
#: model_terms:ir.ui.view,arch_db:partner_company_group.view_account_invoice_filter | ||
|
@@ -36,10 +37,11 @@ msgid "Company group" | |
msgstr "Grupo compañía" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.actions.act_window,name:partner_company_group.action_open_group_members | ||
#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__company_group_member_ids | ||
#: model:ir.model.fields,field_description:partner_company_group.field_res_users__company_group_member_ids | ||
msgid "Company group members" | ||
msgstr "" | ||
msgstr "Miembros del grupo compañía" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.model,name:partner_company_group.model_res_partner | ||
|
@@ -52,28 +54,28 @@ msgstr "Contacto" | |
#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__display_name | ||
#: model:ir.model.fields,field_description:partner_company_group.field_sale_order__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.model.fields,field_description:partner_company_group.field_account_move__id | ||
#: model:ir.model.fields,field_description:partner_company_group.field_crm_lead__id | ||
#: model:ir.model.fields,field_description:partner_company_group.field_res_partner__id | ||
#: model:ir.model.fields,field_description:partner_company_group.field_sale_order__id | ||
msgid "ID" | ||
msgstr "" | ||
msgstr "ID" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.model,name:partner_company_group.model_account_move | ||
msgid "Journal Entry" | ||
msgstr "" | ||
msgstr "Asiento contable" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.model.fields,field_description:partner_company_group.field_account_move____last_update | ||
#: model:ir.model.fields,field_description:partner_company_group.field_crm_lead____last_update | ||
#: model:ir.model.fields,field_description:partner_company_group.field_res_partner____last_update | ||
#: model:ir.model.fields,field_description:partner_company_group.field_sale_order____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
msgstr "Última modificación en" | ||
|
||
#. module: partner_company_group | ||
#: model:ir.model,name:partner_company_group.model_crm_lead | ||
|
@@ -85,5 +87,30 @@ msgstr "Iniciativa / Oportunidad" | |
msgid "Sales Order" | ||
msgstr "Pedido de venta" | ||
|
||
#~ msgid "Journal Entries" | ||
#~ msgstr "Asientos contables" | ||
#. module: partner_company_group | ||
#: code:addons/partner_company_group/models/res_partner.py:0 | ||
#, python-format | ||
msgid "" | ||
"The company group %s has the pricelist %s, that is different than the " | ||
"pricelist set on this contact" | ||
msgstr "" | ||
"El grupo compañía %s tiene la tarifa %s, que es diferente a la tarifa de " | ||
"este contacto" | ||
|
||
#. module: partner_company_group | ||
#: code:addons/partner_company_group/models/res_partner.py:0 | ||
#, python-format | ||
msgid "" | ||
"This contact has members of a company group with different pricelists, the " | ||
"members are:\n" | ||
"%s" | ||
msgstr "" | ||
"Este contacto tiene miembros de un grupo compañía con diferentes tarifas, " | ||
"los miembros son:\n" | ||
"%s" | ||
|
||
#. module: partner_company_group | ||
#: code:addons/partner_company_group/models/res_partner.py:0 | ||
#, python-format | ||
msgid "Warning" | ||
msgstr "Advertencia" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ | |
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Ernesto Tejeda | ||
* Carlos Roca | ||
|
||
* Tharathip Chaweewongphan <[email protected]> |
121 changes: 113 additions & 8 deletions
121
partner_company_group/tests/test_partner_company_group.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,125 @@ | ||
# Copyright 2020 Ecosoft Co., Ltd (http://ecosoft.co.th/) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.tests.common import TransactionCase | ||
from odoo.tests.common import SavepointCase | ||
|
||
|
||
class TestPartnerCompanyGroup(TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
self.partner_model = self.env["res.partner"] | ||
self.company = self.partner_model.create( | ||
class TestPartnerCompanyGroup(SavepointCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.partner_model = cls.env["res.partner"] | ||
cls.company = cls.partner_model.create( | ||
{"name": "Test Company", "company_type": "company"} | ||
) | ||
self.contact = self.partner_model.create( | ||
{"name": "Test Contact", "type": "contact", "parent_id": self.company.id} | ||
cls.contact = cls.partner_model.create( | ||
{"name": "Test Contact", "type": "contact", "parent_id": cls.company.id} | ||
) | ||
currency = cls.env.ref("base.USD") | ||
cls.pricelist1 = cls.env["product.pricelist"].create( | ||
{"name": "Pricelist 01", "currency_id": currency.id} | ||
) | ||
cls.pricelist2 = cls.env["product.pricelist"].create( | ||
{"name": "Pricelist 02", "currency_id": currency.id} | ||
) | ||
cls.company_group1 = cls.env["res.partner"].create( | ||
{ | ||
"name": "Company Group 01", | ||
"is_company": True, | ||
"property_product_pricelist": cls.pricelist1.id, | ||
} | ||
) | ||
cls.company_group2 = cls.env["res.partner"].create( | ||
{ | ||
"name": "Company Group 02", | ||
"is_company": True, | ||
"property_product_pricelist": cls.pricelist2.id, | ||
} | ||
) | ||
cls.partner1 = cls.env["res.partner"].create( | ||
{ | ||
"name": "Partner 01", | ||
"is_company": True, | ||
"property_product_pricelist": cls.pricelist1.id, | ||
"company_group_id": cls.company_group1.id, | ||
} | ||
) | ||
cls.partner2 = cls.env["res.partner"].create( | ||
{ | ||
"name": "Partner 02", | ||
"is_company": True, | ||
"property_product_pricelist": cls.pricelist1.id, | ||
"company_group_id": cls.company_group1.id, | ||
} | ||
) | ||
|
||
def test_partner_company_group(self): | ||
self.company.write({"company_group_id": self.company.id}) | ||
self.assertEqual(self.company.company_group_id, self.contact.company_group_id) | ||
|
||
def test_01_change_pricelist_partner(self): | ||
self.partner1.property_product_pricelist = self.pricelist2 | ||
res = self.partner1._onchange_property_product_pricelist() | ||
self.assertEqual( | ||
{ | ||
"warning": { | ||
"title": "Warning", | ||
"message": "The company group Company Group 01 has the pricelist " | ||
"Pricelist 01 (USD), that is different than the " | ||
"pricelist set on this contact", | ||
} | ||
}, | ||
res, | ||
) | ||
self.partner1.property_product_pricelist = self.pricelist1 | ||
res = self.partner1._onchange_property_product_pricelist() | ||
self.assertEqual({}, res) | ||
|
||
def test_02_change_company_group_partner(self): | ||
self.partner1.company_group_id = self.company_group2 | ||
res = self.partner1._onchange_company_group_id() | ||
self.assertEqual( | ||
{ | ||
"warning": { | ||
"title": "Warning", | ||
"message": "The company group Company Group 02 has the pricelist " | ||
"Pricelist 02 (USD), that is different than the " | ||
"pricelist set on this contact", | ||
} | ||
}, | ||
res, | ||
) | ||
self.partner1.company_group_id = self.company_group1 | ||
res = self.partner1._onchange_company_group_id() | ||
self.assertEqual({}, res) | ||
|
||
def test_03_change_pricelist_company_group(self): | ||
self.company_group1.property_product_pricelist = self.pricelist2 | ||
res = self.company_group1._onchange_property_product_pricelist() | ||
self.assertEqual( | ||
{ | ||
"warning": { | ||
"title": "Warning", | ||
"message": "This contact has members of a company group with " | ||
"different pricelists, the members are:\n" | ||
"\t- Partner 01\n\t- Partner 02\n", | ||
} | ||
}, | ||
res, | ||
) | ||
self.partner1.property_product_pricelist = self.pricelist2 | ||
res = self.company_group1._onchange_property_product_pricelist() | ||
self.assertEqual( | ||
{ | ||
"warning": { | ||
"title": "Warning", | ||
"message": "This contact has members of a company group with " | ||
"different pricelists, the members are:\n" | ||
"\t- Partner 02\n", | ||
} | ||
}, | ||
res, | ||
) | ||
self.partner2.property_product_pricelist = self.pricelist2 | ||
res = self.company_group1._onchange_property_product_pricelist() | ||
self.assertEqual({}, res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters