MIG base_company_extension and base_partner_ref from v10 to v12

This commit is contained in:
Alexis de Lattre
2019-01-29 12:09:47 +01:00
parent 94f2858c68
commit 981f2ad858
8 changed files with 43 additions and 47 deletions

View File

@@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import company from . import company

View File

@@ -1,11 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2014-2016 Akretion (http://www.akretion.com) # Copyright 2014-2019 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Base Company Extension', 'name': 'Base Company Extension',
'version': '10.0.1.0.0', 'version': '12.0.1.0.0',
'category': 'Partner', 'category': 'Partner',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Adds capital and title on company', 'summary': 'Adds capital and title on company',

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2014-2019 Akretion (http://www.akretion.com)
# © 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2014-2016 Akretion (http://www.akretion.com/) Copyright 2014-2019 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->

View File

@@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import partner from . import partner

View File

@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion (http://www.akretion.com)
# © 2017 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Base Partner Reference', 'name': 'Base Partner Reference',
'version': '10.0.1.0.0', 'version': '12.0.1.0.0',
'category': 'Partner', 'category': 'Partner',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': "Improve usage of partner's Internal Reference", 'summary': "Improve usage of partner's Internal Reference",

View File

@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _ from odoo import models, fields
class ResPartner(models.Model): class ResPartner(models.Model):
@@ -16,34 +16,36 @@ class ResPartner(models.Model):
'A partner already exists with this internal reference!' 'A partner already exists with this internal reference!'
)] )]
@api.multi def _get_name(self):
def name_get(self): partner = self
res = [] name = partner.name or ''
for partner in self:
name = partner.name or '' # START modif of native method
# START modif of native name_get() method if partner.ref:
if partner.ref: name = u"[%s] %s" % (partner.ref, name)
name = u"[%s] %s" % (partner.ref, name) # END modif of native method
# END modif of native name_get() method if partner.company_name or partner.parent_id:
if partner.company_name or partner.parent_id: if not name and partner.type in ['invoice', 'delivery', 'other']:
if not name and partner.type in ['invoice', 'delivery', 'other']: name = dict(self.fields_get(['type'])['type']['selection'])[partner.type]
name = dict(self.fields_get(['type'])['type']['selection'])[partner.type] if not partner.is_company:
if not partner.is_company: # START modif of native name_get() method
# START modif of native name_get() method company_name = partner.commercial_company_name or partner.parent_id.name
company_name = partner.commercial_company_name or partner.parent_id.name if partner.parent_id.ref:
if partner.parent_id.ref: company_name = u"[%s] %s" % (partner.parent_id.ref, company_name)
company_name = u"[%s] %s" % (partner.parent_id.ref, company_name) name = "%s, %s" % (company_name, name)
name = "%s, %s" % (company_name, name) # END modif of native name_get() method
# END modif of native name_get() method if self._context.get('show_address_only'):
if self._context.get('show_address_only'): name = partner._display_address(without_company=True)
name = partner._display_address(without_company=True) if self._context.get('show_address'):
if self._context.get('show_address'): name = name + "\n" + partner._display_address(without_company=True)
name = name + "\n" + partner._display_address(without_company=True) name = name.replace('\n\n', '\n')
name = name.replace('\n\n', '\n') name = name.replace('\n\n', '\n')
name = name.replace('\n\n', '\n') if self._context.get('address_inline'):
if self._context.get('show_email') and partner.email: name = name.replace('\n', ', ')
name = "%s <%s>" % (name, partner.email) if self._context.get('show_email') and partner.email:
if self._context.get('html_format'): name = "%s <%s>" % (name, partner.email)
name = name.replace('\n', '<br/>') if self._context.get('html_format'):
res.append((partner.id, name)) name = name.replace('\n', '<br/>')
return res if self._context.get('show_vat') and partner.vat:
name = "%s %s" % (name, partner.vat)
return name

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2017 Akretion (http://www.akretion.com/) Copyright 2017-2019 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->