Skip to content

Commit

Permalink
[FIX] config_parameter must be readed with sudo
Browse files Browse the repository at this point in the history
[FIX] disable position editing on contact

- This is just to see all positions
- If we want to add position go to one company and add contact linked to this partner

[ADD] setup.py [ci skip]

[MIG][11.0] Migration of partner_affiliate to v11 (#579)

* [MIG] Migration of partner_affiliate to v11

* Fixing use of @Class and do not inheriting address from parent company

* Improving legibility and details of fields

* Fixing travis errors

[ADD] setup.py

[IMP] base_location: Include onchange for state

Incredibly not included in Odoo core.

[IMP] base_location: name_search improvement (#585)

Fixing travis errors
  • Loading branch information
etobella authored and mara1 committed May 28, 2018
1 parent 1d7b0fc commit abd906e
Show file tree
Hide file tree
Showing 76 changed files with 2,814 additions and 5 deletions.
3 changes: 2 additions & 1 deletion base_location/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright 2016 Nicolas Bessi, Camptocamp SA
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Location management (aka Better ZIP)',
'version': '11.0.1.0.0',
'version': '11.0.1.0.1',
'depends': [
'base_address_city'
],
Expand Down
8 changes: 8 additions & 0 deletions base_location/models/better_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def name_get(self):
result.append((rec.id, ", ".join(name)))
return result

@api.model
def name_search(self, name='', args=None, operator='ilike', limit=100):
args = list(args or [])
args += ['|', ('city', operator, name),
'|', ('name', operator, name), ('code', operator, name)]
recs = self.search(args, limit=limit)
return recs.name_get()

@api.onchange('country_id')
def _onchange_country_id(self):
if self.state_id.country_id != self.country_id:
Expand Down
6 changes: 6 additions & 0 deletions base_location/models/company.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2016 Nicolas Bessi, Camptocamp SA
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, fields, api
Expand Down Expand Up @@ -62,3 +63,8 @@ def _onchange_zip_id(self):
self.state_id = self.city_id.state_id
else:
self.state_id = self.zip_id.state_id

@api.onchange('state_id')
def onchange_state_id(self):
if self.state_id.country_id:
self.country_id = self.state_id.country_id.id
6 changes: 6 additions & 0 deletions base_location/models/partner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2016 Nicolas Bessi, Camptocamp SA
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models, _
Expand Down Expand Up @@ -64,3 +65,8 @@ def _check_zip(self):
raise ValidationError(_(
"The city of partner %s differs from that in "
"location %s") % (rec.name, rec.zip_id.name))

@api.onchange('state_id')
def onchange_state_id(self):
if self.state_id.country_id:
self.country_id = self.state_id.country_id.id
60 changes: 60 additions & 0 deletions base_location/tests/test_base_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,66 @@ def test_display_name(self):
).name
)

def test_name_search___can_find_using_city_name_or_zip_or_code(self):
barcelona_data = {
'city_id': self.city_bcn.id,
'city': self.city_bcn.name,
'name': '444',
'code': 'BA',
'state_id': self.state_bcn.id,
'country_id': self.ref('base.es'),
}
madrid_data = {
'city_id': self.city_madrid.id,
'city': self.city_madrid.name,
'name': '555',
'code': 'MD',
'state_id': self.state_madrid.id,
'country_id': self.ref('base.es'),
}
lausanne_data = {
'city_id': self.city_lausanne.id,
'city': self.city_lausanne.name,
'name': '666',
'code': 'LA',
'state_id': self.state_vd.id,
'country_id': self.ref('base.ch'),
}

barcelona = self.env['res.better.zip'].create(barcelona_data)
madrid = self.env['res.better.zip'].create(madrid_data)
lausanne = self.env['res.better.zip'].create(lausanne_data)

found_recs = self.env['res.better.zip'].name_search(name='444')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], barcelona.id)
found_recs = self.env['res.better.zip'].name_search(name='Barcelona')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], barcelona.id)
found_recs = self.env['res.better.zip'].name_search(name='BA')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], barcelona.id)

found_recs = self.env['res.better.zip'].name_search(name='555')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], madrid.id)
found_recs = self.env['res.better.zip'].name_search(name='Madrid')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], madrid.id)
found_recs = self.env['res.better.zip'].name_search(name='MD')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], madrid.id)

found_recs = self.env['res.better.zip'].name_search(name='666')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], lausanne.id)
found_recs = self.env['res.better.zip'].name_search(name='Lausanne')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], lausanne.id)
found_recs = self.env['res.better.zip'].name_search(name='LA')
self.assertEqual(len(found_recs), 1)
self.assertEqual(found_recs[0][0], lausanne.id)

def setUp(self):
super(TestBaseLocation, self).setUp()
self.state_vd = self.env['res.country.state'].create({
Expand Down
60 changes: 60 additions & 0 deletions partner_affiliate/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================
Partner Affiliates
==================

This module allows to use parent_id in company partner to refer to a parent
company, plus will show a tab in parent company of affiliated companies.

Usage
=====

New tab 'Affiliates' are available on the contact form if partner is company.
In tab 'Contact & Addresses' only are shown those contacts that are not
companies.

.. 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/11.0

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.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.

Contributors
------------

* Yannick Vaucher <yannick.vaucher@camptocamp.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* Raul Martin <raul.martin@braintec-group.com>
* Dave Lasley <dave@laslabs.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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 https://odoo-community.org.
6 changes: 6 additions & 0 deletions partner_affiliate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2012 Camptocamp SA - Yannick Vaucher
# Copyright 2018 brain-tec AG - Raul Martin
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
23 changes: 23 additions & 0 deletions partner_affiliate/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright 2012 Camptocamp SA - Yannick Vaucher
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2018 brain-tec AG - Raul Martin
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Partner Affiliates',
'version': '11.0.1.0.0',
'author': "Camptocamp, "
"Tecnativa, "
"brain-tec AG, "
"Odoo Community Association (OCA)",
'website': 'http://www.camptocamp.com',
'category': 'CRM',
'license': 'AGPL-3',
'installable': True,
'depends': [
'base',
],
'data': [
'views/res_partner_view.xml',
],
}
46 changes: 46 additions & 0 deletions partner_affiliate/i18n/am.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_affiliate
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-21 01:48+0000\n"
"PO-Revision-Date: 2017-11-21 01:48+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Amharic (https://www.transifex.com/oca/teams/23907/am/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: am\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: partner_affiliate
#: model:ir.model.fields,field_description:partner_affiliate.field_res_partner_affiliate_ids
#: model:ir.model.fields,field_description:partner_affiliate.field_res_users_affiliate_ids
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Affiliates"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Fax:"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Mobile:"
msgstr ""

#. module: partner_affiliate
#: model:ir.model,name:partner_affiliate.model_res_partner
msgid "Partner"
msgstr "ተባባሪ"

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Phone:"
msgstr ""
46 changes: 46 additions & 0 deletions partner_affiliate/i18n/ar.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_affiliate
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-21 01:48+0000\n"
"PO-Revision-Date: 2017-11-21 01:48+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Arabic (https://www.transifex.com/oca/teams/23907/ar/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"

#. module: partner_affiliate
#: model:ir.model.fields,field_description:partner_affiliate.field_res_partner_affiliate_ids
#: model:ir.model.fields,field_description:partner_affiliate.field_res_users_affiliate_ids
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Affiliates"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Fax:"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Mobile:"
msgstr ""

#. module: partner_affiliate
#: model:ir.model,name:partner_affiliate.model_res_partner
msgid "Partner"
msgstr "الشريك"

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Phone:"
msgstr ""
46 changes: 46 additions & 0 deletions partner_affiliate/i18n/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_affiliate
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-21 01:48+0000\n"
"PO-Revision-Date: 2017-11-21 01:48+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
"Language-Team: Bulgarian (https://www.transifex.com/oca/teams/23907/bg/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: bg\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: partner_affiliate
#: model:ir.model.fields,field_description:partner_affiliate.field_res_partner_affiliate_ids
#: model:ir.model.fields,field_description:partner_affiliate.field_res_users_affiliate_ids
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Affiliates"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Fax:"
msgstr ""

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Mobile:"
msgstr ""

#. module: partner_affiliate
#: model:ir.model,name:partner_affiliate.model_res_partner
msgid "Partner"
msgstr "Партньор"

#. module: partner_affiliate
#: model:ir.ui.view,arch_db:partner_affiliate.view_partner_form_add_affiliate
msgid "Phone:"
msgstr ""
Loading

0 comments on commit abd906e

Please sign in to comment.