Merge lp:~nbessi-c2c-deactivatedaccount/partner-contact-management/7.0-better_zip_addon into lp:~partner-contact-core-editors/partner-contact-management/7.0

Proposed by Nicolas Bessi - Camptocamp
Status: Merged
Merged at revision: 8
Proposed branch: lp:~nbessi-c2c-deactivatedaccount/partner-contact-management/7.0-better_zip_addon
Merge into: lp:~partner-contact-core-editors/partner-contact-management/7.0
Diff against target: 206 lines (+178/-0)
5 files modified
better_zip/__init__.py (+20/-0)
better_zip/__openerp__.py (+29/-0)
better_zip/better_zip.py (+57/-0)
better_zip/better_zip_view.xml (+59/-0)
better_zip/security/security.xml (+13/-0)
To merge this branch: bzr merge lp:~nbessi-c2c-deactivatedaccount/partner-contact-management/7.0-better_zip_addon
Reviewer Review Type Date Requested Status
Partner and Contact Core Editors Pending
Review via email: mp+143528@code.launchpad.net

This proposal supersedes a proposal from 2013-01-16.

Description of the change

Port of better_zip addon to version V7.0

Regards

Nicolas

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : Posted in a previous version of this proposal

are you sure you want to release this under GPL, not AGPL ?

review: Needs Information
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

Hello,

Did'n see this one. This is the historical license but your right it should be AGPL.

Regards

Nicolas

Revision history for this message
Niels Huylebroeck (red15) wrote : Posted in a previous version of this proposal

Looks good, not sure if the partner view inherit is the best way (but it will work), considering in v7.0 the location of city/street/zip can be altered by the country of the company.

review: Approve
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : Posted in a previous version of this proposal

Well if no body as any other remarks I'll commit with the AGPL licence.

Regards

Nicolas

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'better_zip'
2=== added file 'better_zip/__init__.py'
3--- better_zip/__init__.py 1970-01-01 00:00:00 +0000
4+++ better_zip/__init__.py 2013-01-16 15:24:31 +0000
5@@ -0,0 +1,20 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author Nicolas Bessi. Copyright Camptocamp SA
10+#
11+# This program is free software: you can redistribute it and/or modify
12+# it under the terms of the GNU General Public License as published by
13+# the Free Software Foundation, either version 3 of the License, or
14+# (at your option) any later version.
15+#
16+# This program is distributed in the hope that it will be useful,
17+# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+# GNU General Public License for more details.
20+#
21+# You should have received a copy of the GNU General Public License
22+# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+#
24+##############################################################################
25+from . import better_zip
26
27=== added file 'better_zip/__openerp__.py'
28--- better_zip/__openerp__.py 1970-01-01 00:00:00 +0000
29+++ better_zip/__openerp__.py 2013-01-16 15:24:31 +0000
30@@ -0,0 +1,29 @@
31+# -*- coding: utf-8 -*-
32+##############################################################################
33+#
34+# Author Nicolas Bessi. Copyright Camptocamp SA
35+#
36+# This program is free software: you can redistribute it and/or modify
37+# it under the terms of the GNU General Public License as published by
38+# the Free Software Foundation, either version 3 of the License, or
39+# (at your option) any later version.
40+#
41+# This program is distributed in the hope that it will be useful,
42+# but WITHOUT ANY WARRANTY; without even the implied warranty of
43+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44+# GNU General Public License for more details.
45+#
46+# You should have received a copy of the GNU General Public License
47+# along with this program. If not, see <http://www.gnu.org/licenses/>.
48+#
49+##############################################################################
50+{'name': 'Better zip management',
51+ 'version': '0.3',
52+ 'depends': ['base',],
53+ 'author': 'Camptocamp',
54+ 'description': """Introduce a better zip/npa management system. Enable partner completion""",
55+ 'website': 'http://www.camptocamp.com',
56+ 'data': ['security/security.xml', 'better_zip_view.xml'],
57+ 'installable': True,
58+ 'active': False,
59+ }
60
61=== added file 'better_zip/better_zip.py'
62--- better_zip/better_zip.py 1970-01-01 00:00:00 +0000
63+++ better_zip/better_zip.py 2013-01-16 15:24:31 +0000
64@@ -0,0 +1,57 @@
65+# -*- coding: utf-8 -*-
66+##############################################################################
67+#
68+# Author Nicolas Bessi. Copyright Camptocamp SA
69+#
70+# This program is free software: you can redistribute it and/or modify
71+# it under the terms of the GNU General Public License as published by
72+# the Free Software Foundation, either version 3 of the License, or
73+# (at your option) any later version.
74+#
75+# This program is distributed in the hope that it will be useful,
76+# but WITHOUT ANY WARRANTY; without even the implied warranty of
77+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78+# GNU General Public License for more details.
79+#
80+# You should have received a copy of the GNU General Public License
81+# along with this program. If not, see <http://www.gnu.org/licenses/>.
82+#
83+##############################################################################
84+from openerp.osv.orm import Model, fields
85+
86+
87+class BetterZip(Model):
88+ " Zip/NPA object"
89+
90+ _name = "res.better.zip"
91+ _description = __doc__
92+ _order = "priority"
93+
94+ _columns = {'priority': fields.integer('Priority'),
95+ 'name': fields.char('ZIP', required=True),
96+ 'city': fields.char('City', required=True),
97+ 'state_id': fields.many2one('res.country.state', 'State'),
98+ 'country_id': fields.many2one('res.country', 'Country'),
99+ }
100+
101+ _defaults = {'priority': 100}
102+
103+ def name_get(self, cursor, uid, ids, context=None):
104+ res = []
105+ for bzip in self.browse(cursor, uid, ids):
106+ res.append((bzip.id, u"%s %s" % (bzip.name, bzip.city)))
107+ return res
108+
109+
110+class Partner(Model):
111+ _inherit = "res.partner"
112+ _columns = {'zip_id': fields.many2one('res.better.zip', 'ZIP/PN')}
113+
114+ def onchange_zip_id(self, cursor, uid, ids, zip_id, context=None):
115+ if not zip_id:
116+ return {}
117+ if isinstance(zip_id, list):
118+ zip_id = zip_id[0]
119+ bzip = self.pool['res.better.zip'].browse(cursor, uid, zip_id, context=context)
120+ return {'value': {'zip': bzip.name, 'city': bzip.city,
121+ 'country_id': bzip.country_id.id, 'state_id': bzip.state_id.id}}
122
123=== added file 'better_zip/better_zip_view.xml'
124--- better_zip/better_zip_view.xml 1970-01-01 00:00:00 +0000
125+++ better_zip/better_zip_view.xml 2013-01-16 15:24:31 +0000
126@@ -0,0 +1,59 @@
127+<?xml version="1.0" encoding="UTF-8"?>
128+<openerp>
129+ <data>
130+ <record id="view_partner_form" model="ir.ui.view">
131+ <field name="name">res.partner.zip_id.2</field>
132+ <field name="model">res.partner</field>
133+ <field name="inherit_id" ref="base.view_partner_form"/>
134+ <field name="arch" type="xml">
135+ <field name="city" position="before">
136+ <field name="zip_id" on_change="onchange_zip_id(zip_id)" placeholder="ZIP completion"/>
137+ </field>
138+ </field>
139+ </record>
140+
141+ <record model="ir.ui.view" id="better_zip_form">
142+ <field name="name">res.better.zip.form</field>
143+ <field name="model">res.better.zip</field>
144+ <field name="arch" type="xml">
145+ <form string="ZIP" version="7.0">
146+ <group col="4">
147+ <field name="name"/>
148+ <field name="city"/>
149+ <field name="priority"/>
150+ <field name="state_id"/>
151+ <field name="country_id"/>
152+ </group>
153+ </form>
154+ </field>
155+ </record>
156+
157+ <record model="ir.ui.view" id="better_zip_tree">
158+ <field name="name">res.better.zip.tree</field>
159+ <field name="model">res.better.zip</field>
160+ <field name="arch" type="xml">
161+ <tree string="ZIP">
162+ <field name="name"/>
163+ <field name="city"/>
164+ <field name="country_id"/>
165+ <field name="priority"/>
166+ </tree>
167+ </field>
168+ </record>
169+
170+ <record id="action_zip_tree" model="ir.actions.act_window">
171+ <field name="name">ZIP Management</field>
172+ <field name="res_model">res.better.zip</field>
173+ <field name="view_type">form</field>
174+ <field name="view_mode">tree,form</field>
175+ <field ref="better_zip_tree" name="view_id"/>
176+ </record>
177+
178+ <menuitem
179+ name="ZIP Management"
180+ id="zip_base"
181+ parent="base.menu_base_config"
182+ action="action_zip_tree"
183+ />
184+ </data>
185+</openerp>
186
187=== added directory 'better_zip/i18n'
188=== added directory 'better_zip/security'
189=== added file 'better_zip/security/security.xml'
190--- better_zip/security/security.xml 1970-01-01 00:00:00 +0000
191+++ better_zip/security/security.xml 2013-01-16 15:24:31 +0000
192@@ -0,0 +1,13 @@
193+<openerp>
194+ <data>
195+ <record id="ir_model_access_betterzip0" model="ir.model.access">
196+ <field name="model_id" ref="better_zip.model_res_better_zip"/>
197+ <field eval="1" name="perm_read"/>
198+ <field eval="'better_zip'" name="name"/>
199+ <field eval="1" name="perm_unlink"/>
200+ <field eval="1" name="perm_write"/>
201+ <field eval="1" name="perm_create"/>
202+ <field name="group_id" ref="base.group_user"/>
203+ </record>
204+ </data>
205+</openerp>
206\ No newline at end of file

Subscribers

People subscribed via source and target branches

to status/vote changes: