diff --git a/l10n_tr_partner_external_map/__init__.py b/l10n_tr_partner_external_map/__init__.py new file mode 100644 index 000000000..9a7e03ede --- /dev/null +++ b/l10n_tr_partner_external_map/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/l10n_tr_partner_external_map/__manifest__.py b/l10n_tr_partner_external_map/__manifest__.py new file mode 100644 index 000000000..683cce37c --- /dev/null +++ b/l10n_tr_partner_external_map/__manifest__.py @@ -0,0 +1,15 @@ +{ + 'name': 'Partner External Map For Turkey', + 'version': '16.0.2', + 'summary': "Add Partner external Map to Neighbour", + 'description': """This Module is used to add custom field in res.partner Object""", + 'category': 'Partner', + 'website':'http://www.codequarters.com', + 'author': 'Onur UGUR,Codequarters', + 'depends': ['l10n_tr_address','partner_external_map'], + 'data': [ + 'views/res_partner_view.xml', + ], + 'installable': True, + 'auto_install': False +} diff --git a/l10n_tr_partner_external_map/models/__init__.py b/l10n_tr_partner_external_map/models/__init__.py new file mode 100644 index 000000000..4c5888619 --- /dev/null +++ b/l10n_tr_partner_external_map/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner \ No newline at end of file diff --git a/l10n_tr_partner_external_map/models/res_partner.py b/l10n_tr_partner_external_map/models/res_partner.py new file mode 100644 index 000000000..26bca49f2 --- /dev/null +++ b/l10n_tr_partner_external_map/models/res_partner.py @@ -0,0 +1,33 @@ +''' +Created on Jan 24, 2019 + +@author: cq +''' +from odoo import models, _ +import logging +from odoo.exceptions import UserError + +logger = logging.getLogger(__name__) + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + def _address_as_string(self): + self.ensure_one() + addr = [] + if self.street: + addr.append(self.street) + if self.street2: + addr.append(self.street2) + if self.neighbour_id: + addr.append(self.neighbour_id.name) + if self.city: + addr.append(self.city) + if self.state_id: + addr.append(self.state_id.name) + if self.country_id: + addr.append(self.country_id.name) + if not addr: + raise UserError(_("Address missing on partner '%s'.") % self.name) + return ' '.join(addr) diff --git a/l10n_tr_partner_external_map/views/res_partner_view.xml b/l10n_tr_partner_external_map/views/res_partner_view.xml new file mode 100644 index 000000000..f41c38ddf --- /dev/null +++ b/l10n_tr_partner_external_map/views/res_partner_view.xml @@ -0,0 +1,24 @@ + + + + + + + + map.button.res.partner.form + res.partner + + + + {'invisible': [('neighbour_id', '=', False)]} + + + {'invisible': [('neighbour_id', '=', False)]} + + + + +