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,15 +16,14 @@ 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 = []
for partner in self:
name = partner.name or '' name = partner.name or ''
# START modif of native name_get() method
# START modif of native 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 name_get() method # END modif of native 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]
@@ -41,9 +40,12 @@ class ResPartner(models.Model):
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'):
name = name.replace('\n', ', ')
if self._context.get('show_email') and partner.email: if self._context.get('show_email') and partner.email:
name = "%s <%s>" % (name, partner.email) name = "%s <%s>" % (name, partner.email)
if self._context.get('html_format'): if self._context.get('html_format'):
name = name.replace('\n', '<br/>') name = name.replace('\n', '<br/>')
res.append((partner.id, name)) if self._context.get('show_vat') and partner.vat:
return res 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).
--> -->