From 036244396262a9f717eeb789ba3dda40f8094d00 Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Sat, 2 Dec 2017 11:50:28 +0100 Subject: [PATCH] [MIG] V11 migration - fax field removed from res.partner - 2to3 on all py files - add contributor and update README - use hasclass in place of @class in xpath expr - improve tests [FIX] typo and clean README --- .../README.rst | 2 +- .../__init__.py | 1 - .../__manifest__.py | 9 +- .../partner_contact_in_several_companies.pot | 165 ------------------ .../models/res_partner.py | 7 +- ...st_partner_contact_in_several_companies.py | 37 +++- .../views/res_partner.xml | 4 +- .../README.rst | 17 +- .../__manifest__.py | 5 +- ...tner_contact_personal_information_page.pot | 22 --- 10 files changed, 51 insertions(+), 218 deletions(-) delete mode 100644 partner_contact_in_several_companies/i18n/partner_contact_in_several_companies.pot delete mode 100644 partner_contact_personal_information_page/i18n/partner_contact_personal_information_page.pot diff --git a/partner_contact_in_several_companies/README.rst b/partner_contact_in_several_companies/README.rst index dc32131a8f6..c5b59ebff53 100644 --- a/partner_contact_in_several_companies/README.rst +++ b/partner_contact_in_several_companies/README.rst @@ -32,7 +32,7 @@ For further information, please visit: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/10.0 + :target: https://runbot.odoo-community.org/runbot/134/11.0 Known issues / Roadmap ====================== diff --git a/partner_contact_in_several_companies/__init__.py b/partner_contact_in_several_companies/__init__.py index a77a6fcbc5d..83e553ac462 100644 --- a/partner_contact_in_several_companies/__init__.py +++ b/partner_contact_in_several_companies/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_contact_in_several_companies/__manifest__.py b/partner_contact_in_several_companies/__manifest__.py index 6ac293a5e08..b26836bfd3d 100644 --- a/partner_contact_in_several_companies/__manifest__.py +++ b/partner_contact_in_several_companies/__manifest__.py @@ -4,14 +4,11 @@ { "name": "Contacts in several partners", "summary": "Allow to have one contact in several partners", - "version": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Customer Relationship Management", - "website": "https://odoo-community.org/", - "author": "Odoo Community Association (OCA),Odoo SA", + "website": "https://github.com/OCA/partner-contact", + "author": "Nicolas JEUDY,Odoo Community Association (OCA),Odoo SA", "license": "AGPL-3", - 'application': False, - 'installable': True, - 'auto_install': False, "depends": [ "base", "partner_contact_personal_information_page", diff --git a/partner_contact_in_several_companies/i18n/partner_contact_in_several_companies.pot b/partner_contact_in_several_companies/i18n/partner_contact_in_several_companies.pot deleted file mode 100644 index 4d75f72b7e5..00000000000 --- a/partner_contact_in_several_companies/i18n/partner_contact_in_several_companies.pot +++ /dev/null @@ -1,165 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_contact_in_several_companies -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0-20150514\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-05-20 09:26+0000\n" -"PO-Revision-Date: 2015-05-20 09:26+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Address" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_filter_contact -msgid "All partner positions" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_filter_contact -msgid "All positions" -msgstr "" - -#. module: partner_contact_in_several_companies -#: code:addons/partner_contact_in_several_companies/models.py:32 -#, python-format -msgid "Attached to existing Contact" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "City" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Company" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Contact" -msgstr "" - -#. module: partner_contact_in_several_companies -#: field:res.partner,contact_type:0 -msgid "Contact Type" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Contacts" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Country" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Fax:" -msgstr "" - -#. module: partner_contact_in_several_companies -#: field:res.partner,contact_id:0 -msgid "Main Contact" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Mobile:" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Other Positions" -msgstr "" - -#. module: partner_contact_in_several_companies -#: field:res.partner,other_contact_ids:0 -msgid "Others Positions" -msgstr "" - -#. module: partner_contact_in_several_companies -#: model:ir.model,name:partner_contact_in_several_companies.model_res_partner -msgid "Partner" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_filter_contact -msgid "Person" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Phone:" -msgstr "" - -#. module: partner_contact_in_several_companies -#: code:addons/partner_contact_in_several_companies/models.py:31 -#, python-format -msgid "Standalone Contact" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "State" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Street..." -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "Tags..." -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_personal_information -msgid "To see personal information about this contact, please\n" -" go to to the his person form:" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "ZIP" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "at" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "e.g. Sales Director" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_kanban_contact -msgid "other position" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_res_partner_kanban_contact -msgid "other positions" -msgstr "" - -#. module: partner_contact_in_several_companies -#: view:res.partner:partner_contact_in_several_companies.view_partner_form_inherit -msgid "{'invisible': [('contact_type','=','attached')]}" -msgstr "" - diff --git a/partner_contact_in_several_companies/models/res_partner.py b/partner_contact_in_several_companies/models/res_partner.py index 8770cf0e8f4..ff9414429ad 100644 --- a/partner_contact_in_several_companies/models/res_partner.py +++ b/partner_contact_in_several_companies/models/res_partner.py @@ -94,15 +94,14 @@ def unlink(self): return super(ResPartner, modified_self).unlink() @api.multi - def _commercial_partner_compute(self, name, args): + def _compute_commercial_partner(self): """ Returns the partner that is considered the commercial entity of this partner. The commercial entity holds the master data for all commercial fields (see :py:meth:`~_commercial_fields`) """ - result = super(ResPartner, self)._commercial_partner_compute(name, - args) + result = super(ResPartner, self)._compute_commercial_partner() for partner in self: if partner.contact_type == 'attached' and not partner.parent_id: - result[partner.id] = partner.contact_id.id + partner.commercial_partner_id = partner.contact_id return result def _contact_fields(self): diff --git a/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py b/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py index d1220870b7c..5686550cce9 100644 --- a/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py +++ b/partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py @@ -139,8 +139,8 @@ def test_04_contact_creation(self): new_contact = self.partner.create( {'contact_id': self.bob_contact.id} ) - self.assertEqual(new_contact.name, u'Bob Egnops') - self.assertEqual(new_contact.contact_type, u'attached') + self.assertEqual(new_contact.name, 'Bob Egnops') + self.assertEqual(new_contact.contact_type, 'attached') # Create a contact with both contact_id and name; # contact's name should override provided value in that case @@ -149,14 +149,14 @@ def test_04_contact_creation(self): ) self.assertEqual( new_contact.name, - u'Bob Egnops' + 'Bob Egnops' ) # Reset contact to standalone new_contact.write({'contact_id': False}) self.assertEqual( new_contact.contact_type, - u'standalone', + 'standalone', ) # Reset contact to attached, and ensure only it is unlinked (i.e. @@ -217,3 +217,32 @@ def test_06_ir_action(self): details['context'], msg='Custom actions incorrectly updated with new context' ) + + def test_07_onchange(self): + """Check onchange method + """ + + new_contact = self.partner.create({'name': 'Bob before onchange'}) + new_contact.write({'contact_id': self.bob_contact.id}) + new_contact._onchange_contact_id() + self.assertEqual( + new_contact.name, + 'Bob Egnops', + ) + + new_contact.write({'contact_type': 'standalone'}) + new_contact._onchange_contact_type() + self.assertEqual( + new_contact.contact_id, + self.partner, + ) + + def test_08_commercial_partner_compute(self): + new_contact = self.partner.create({'name': 'Bob before onchange'}) + new_contact.write({'contact_id': self.bob_contact.id, + 'parent_id': False}) + new_contact._compute_commercial_partner() + self.assertEqual( + new_contact.commercial_partner_id, + self.bob_contact, + ) diff --git a/partner_contact_in_several_companies/views/res_partner.xml b/partner_contact_in_several_companies/views/res_partner.xml index 8485ec045d4..aeca21eb7ee 100644 --- a/partner_contact_in_several_companies/views/res_partner.xml +++ b/partner_contact_in_several_companies/views/res_partner.xml @@ -55,7 +55,6 @@ - @@ -77,7 +76,6 @@
Phone:
Mobile:
-
Fax:
@@ -168,7 +166,7 @@
- +
  • + other position diff --git a/partner_contact_personal_information_page/README.rst b/partner_contact_personal_information_page/README.rst index ab725f7ef07..123aaab559a 100644 --- a/partner_contact_personal_information_page/README.rst +++ b/partner_contact_personal_information_page/README.rst @@ -38,7 +38,7 @@ For further information, please visit: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/134/9.0 + :target: https://runbot.odoo-community.org/runbot/134/11.0 Known issues / Roadmap ====================== @@ -48,14 +48,10 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback `here `_. - +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -68,6 +64,7 @@ Contributors * Matjaž Mozetič * Rudolf Schnapka * Richard deMeester +* Nicolas JEUDY Maintainer ---------- @@ -82,4 +79,4 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file +To contribute to this module, please visit http://odoo-community.org. diff --git a/partner_contact_personal_information_page/__manifest__.py b/partner_contact_personal_information_page/__manifest__.py index 28113dd7b61..89cc81ca59d 100644 --- a/partner_contact_personal_information_page/__manifest__.py +++ b/partner_contact_personal_information_page/__manifest__.py @@ -4,16 +4,17 @@ { "name": "Personal information page for contacts", "summary": "Add a page to contacts form to put personal information", - "version": "10.0.1.0.0", + "version": "11.0.1.0.0", "category": "Customer Relationship Management", "website": "https://odoo-community.org/", - "author": "Odoo Community Association (OCA)", + "author": "Nicolas JEUDY,Odoo Community Association (OCA)", "contributors": [ 'EL Hadji DEM ', 'Jairo Llopis ', 'Matjaž Mozetič ', 'Rudolf Schnapka ', 'Richard deMeester ', + 'Nicolas JEUDY ', ], "license": "AGPL-3", 'application': False, diff --git a/partner_contact_personal_information_page/i18n/partner_contact_personal_information_page.pot b/partner_contact_personal_information_page/i18n/partner_contact_personal_information_page.pot deleted file mode 100644 index 3e211f2170d..00000000000 --- a/partner_contact_personal_information_page/i18n/partner_contact_personal_information_page.pot +++ /dev/null @@ -1,22 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * partner_contact_personal_information_page -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 9.0-20151126\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-11-26 09:18+0000\n" -"PO-Revision-Date: 2015-05-19 09:18+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: partner_contact_personal_information_page -#: view:res.partner:base.personal_contact_information -msgid "Personal Information" -msgstr "" -