Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG]16.0 mig l10n tr partner external map #58

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l10n_tr_partner_external_map/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions l10n_tr_partner_external_map/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions l10n_tr_partner_external_map/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
33 changes: 33 additions & 0 deletions l10n_tr_partner_external_map/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -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)
24 changes: 24 additions & 0 deletions l10n_tr_partner_external_map/views/res_partner_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2015-2016 Akretion (Alexis de Lattre <[email protected]>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>

<!-- Inherit partner view to add 'Map' and 'Route Map' buttons -->
<record id="view_partner_form_Tr" model="ir.ui.view">
<field name="name">map.button.res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_external_map.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='open_map']" position="attributes">
<attribute name="attrs">{'invisible': [('neighbour_id', '=', False)]}</attribute>
</xpath>
<xpath expr="//button[@name='open_route_map']" position="attributes">
<attribute name="attrs">{'invisible': [('neighbour_id', '=', False)]}</attribute>
</xpath>
</field>
</record>

</odoo>
Loading