From 05fd442b84eeebd739aac89617a6d1fb4e49b7e0 Mon Sep 17 00:00:00 2001 From: Nicolas Bessi Date: Fri, 24 Oct 2014 15:41:33 +0200 Subject: [PATCH] Adding skeleton of partner-address-street-3 --- partner-address-street3/__init__.py | 21 ++++++++++++ partner-address-street3/__openerp__.py | 38 ++++++++++++++++++++++ partner-address-street3/model/__init__.py | 21 ++++++++++++ partner-address-street3/model/partner.py | 39 +++++++++++++++++++++++ 4 files changed, 119 insertions(+) create mode 100644 partner-address-street3/__init__.py create mode 100644 partner-address-street3/__openerp__.py create mode 100644 partner-address-street3/model/__init__.py create mode 100644 partner-address-street3/model/partner.py diff --git a/partner-address-street3/__init__.py b/partner-address-street3/__init__.py new file mode 100644 index 000000000..6ac610f01 --- /dev/null +++ b/partner-address-street3/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 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 +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from . import model diff --git a/partner-address-street3/__openerp__.py b/partner-address-street3/__openerp__.py new file mode 100644 index 000000000..8d0eef9ac --- /dev/null +++ b/partner-address-street3/__openerp__.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 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 +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + 'name': 'Stree3 in address', + 'version': '0.1', + 'author': 'Camptocamp', + 'maintainer': 'Camptocamp', + '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': True, + 'auto_install': False, + 'license': 'AGPL-3', + 'application': False, +} diff --git a/partner-address-street3/model/__init__.py b/partner-address-street3/model/__init__.py new file mode 100644 index 000000000..b4349f625 --- /dev/null +++ b/partner-address-street3/model/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 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 +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from . import partner diff --git a/partner-address-street3/model/partner.py b/partner-address-street3/model/partner.py new file mode 100644 index 000000000..890fa5c7f --- /dev/null +++ b/partner-address-street3/model/partner.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Author: Nicolas Bessi +# Copyright 2014 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 +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from openerp.osv import orm, fields +from openerp.addons.base.res import partner + +partner.ADDRESS_FIELDS = partner.ADDRESS_FIELDS + ('street3',) + + +class res_partner(orm.Model): + """Add third field in address""" + + _inherit = "res.partner" + _columns = { + 'street3': fields.char('Street 3'), + } + + _defaults = { + 'address_format': ("%(street)s\n%(street2)s\n%(street3)s\n" + "%(city)s %(state_code)s %(zip)s\n" + "%(country_name)s"), + }