diff --git a/partner_address_street3/README.rst b/partner_address_street3/README.rst new file mode 100644 index 000000000..529101270 --- /dev/null +++ b/partner_address_street3/README.rst @@ -0,0 +1,58 @@ +.. 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 + +=========================== +3rd line on partner address +=========================== + +This module extends the base res.partner model by supplying a 3rd line on +addresses (`street3`) + + +.. 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/9.0 + + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Contributors +------------ + +* Nicolas Bessi +* Alexandre Fayolle + +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. diff --git a/partner_address_street3/__openerp__.py b/partner_address_street3/__openerp__.py index d995a3bd0..8c5d74d5e 100644 --- a/partner_address_street3/__openerp__.py +++ b/partner_address_street3/__openerp__.py @@ -26,12 +26,11 @@ 'category': 'Sales', 'complexity': 'easy', 'depends': ['base'], - 'description': """Add a third field to the address""", 'website': 'http://www.camptocamp.com', 'data': ['view/partner_view.xml'], 'demo': [], 'test': [], - 'installable': False, + 'installable': True, 'auto_install': False, 'license': 'AGPL-3', 'application': False, diff --git a/partner_address_street3/model/partner.py b/partner_address_street3/model/partner.py index a4d0f2098..71e78ef54 100644 --- a/partner_address_street3/model/partner.py +++ b/partner_address_street3/model/partner.py @@ -2,7 +2,7 @@ ############################################################################## # # Author: Nicolas Bessi -# Copyright 2014 Camptocamp SA +# Copyright 2014-2015 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -18,31 +18,31 @@ # along with this program. If not, see . # ############################################################################## -from openerp.osv import orm, fields +from openerp import models, fields, api -class res_partner(orm.Model): +class ResPartner(models.Model): """Add third field in address""" _inherit = "res.partner" - _columns = { - 'street3': fields.char('Street 3'), - } + street3 = fields.Char('Street 3') - def _address_fields(self, cr, uid, context=None): - fields = super(res_partner, self - )._address_fields(cr, uid, context=context) + @api.model + def _address_fields(self): + fields = super(ResPartner, self)._address_fields() fields.append('street3') return fields -class res_country(orm.Model): - """Override default adresses formatting of coutries""" +class res_country(models.Model): + """Override default adresses formatting of countries""" _inherit = 'res.country' - _defaults = { - 'address_format': ("%(street)s\n%(street2)s\n%(street3)s\n" - "%(city)s %(state_code)s %(zip)s\n" - "%(country_name)s"), - } + address_format = fields.Text( + default=( + "%(street)s\n%(street2)s\n%(street3)s\n" + "%(city)s %(state_code)s %(zip)s\n" + "%(country_name)s" + ) + ) diff --git a/partner_address_street3/view/partner_view.xml b/partner_address_street3/view/partner_view.xml index d4bc15020..79071c851 100644 --- a/partner_address_street3/view/partner_view.xml +++ b/partner_address_street3/view/partner_view.xml @@ -7,18 +7,27 @@ - + - - + {'default_parent_id': active_id, + 'default_street': street, 'default_street2': street2, + 'default_street3': street3, 'default_city': city, 'default_state_id': + state_id, 'default_zip': zip, 'default_country_id': country_id, + 'default_supplier': supplier, 'default_customer': customer, + 'default_lang': lang,} + + - + - @@ -37,5 +46,16 @@ + + add street 3 in res.partner.form.address + res.partner + + + + + + + +