Skip to content

Commit

Permalink
[MIG] V11 migration
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Nicolas JEUDY committed Dec 5, 2017
1 parent d00f3a8 commit 0362443
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 218 deletions.
2 changes: 1 addition & 1 deletion partner_contact_in_several_companies/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======================
Expand Down
1 change: 0 additions & 1 deletion partner_contact_in_several_companies/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
9 changes: 3 additions & 6 deletions partner_contact_in_several_companies/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

7 changes: 3 additions & 4 deletions partner_contact_in_several_companies/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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,
)
4 changes: 1 addition & 3 deletions partner_contact_in_several_companies/views/res_partner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="fax"/>
<field name="state_id"/>
<field name="image"/>
<field name="lang"/>
Expand All @@ -77,7 +76,6 @@
<div t-if="record.email.raw_value"><field name="email"/></div>
<div t-if="record.phone.raw_value">Phone: <field name="phone"/></div>
<div t-if="record.mobile.raw_value">Mobile: <field name="mobile"/></div>
<div t-if="record.fax.raw_value">Fax: <field name="fax"/></div>
</div>
</div>
</t>
Expand Down Expand Up @@ -168,7 +166,7 @@
</tree>
</field>
</field>
<xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/ul/li[3]" position="after">
<xpath expr="//t[@t-name='kanban-box']//div[hasclass('oe_kanban_details')]/ul/li[3]" position="after">
<t t-if="record.other_contact_ids.raw_value.length &gt; 0">
<li>+<t t-esc="record.other_contact_ids.raw_value.length"/>
<t t-if="record.other_contact_ids.raw_value.length == 1">other position</t>
Expand Down
17 changes: 7 additions & 10 deletions partner_contact_personal_information_page/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======================
Expand All @@ -48,14 +48,10 @@ Known issues / Roadmap
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/
partner-contact/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 <https://github.com/OCA/
partner-contact/issues/new?body=module:%20
partner_contact_personal_information_page%0Aversion:%20
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/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
=======
Expand All @@ -68,6 +64,7 @@ Contributors
* Matjaž Mozetič <m.mozetic@matmoz.si>
* Rudolf Schnapka <schnapkar@golive-saar.de>
* Richard deMeester <richard@willowit.com.au>
* Nicolas JEUDY <https://github.com/njeudy>

Maintainer
----------
Expand All @@ -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.
To contribute to this module, please visit http://odoo-community.org.
5 changes: 3 additions & 2 deletions partner_contact_personal_information_page/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <elhadji.dem@savoirfairelinux.com>',
'Jairo Llopis <j.llopis@grupoesoc.es>',
'Matjaž Mozetič <m.mozetic@matmoz.si>',
'Rudolf Schnapka <schnapkar@golive-saar.de>',
'Richard deMeester <richard@willowit.com.au>',
'Nicolas JEUDY <https://github.com/njeudy>',
],
"license": "AGPL-3",
'application': False,
Expand Down

This file was deleted.

0 comments on commit 0362443

Please sign in to comment.