Merge lp:~savoirfairelinux-openerp/openerp-canada/openerp-canada_res_partner_attributes_add_NEQ into lp:openerp-canada
- openerp-canada_res_partner_attributes_add_NEQ
- Merge into 7.0
Proposed by
Marc Cassuto (SFL)
Status: | Superseded |
---|---|
Proposed branch: | lp:~savoirfairelinux-openerp/openerp-canada/openerp-canada_res_partner_attributes_add_NEQ |
Merge into: | lp:openerp-canada |
Diff against target: |
624 lines (+530/-0) 17 files modified
res_partner_attributes_add_BN/__init__.py (+25/-0) res_partner_attributes_add_BN/__openerp__.py (+39/-0) res_partner_attributes_add_BN/i18n/fr.po (+32/-0) res_partner_attributes_add_BN/i18n/res_partner_attributes_add_BN.pot (+32/-0) res_partner_attributes_add_BN/res_partner_attributes_add_BN.py (+35/-0) res_partner_attributes_add_BN/res_partner_attributes_add_BN_view.xml (+16/-0) res_partner_attributes_add_NEQ/__init__.py (+25/-0) res_partner_attributes_add_NEQ/__openerp__.py (+39/-0) res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.pot (+32/-0) res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ.py (+33/-0) res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ_view.xml (+15/-0) res_partner_attributes_add_SIN/__init__.py (+25/-0) res_partner_attributes_add_SIN/__openerp__.py (+39/-0) res_partner_attributes_add_SIN/i18n/fr.po (+32/-0) res_partner_attributes_add_SIN/i18n/res_partner_attributes_add_SIN.pot (+32/-0) res_partner_attributes_add_SIN/res_partner_attributes_add_SIN.py (+64/-0) res_partner_attributes_add_SIN/res_partner_attributes_add_SIN_view.xml (+15/-0) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/openerp-canada/openerp-canada_res_partner_attributes_add_NEQ |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Maxime Chambreuil (http://www.savoirfairelinux.com) | Needs Fixing | ||
Joao Alfredo Gama Batista | code review. no test | Approve | |
Review via email: mp+174487@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-07-19.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) : | # |
review:
Approve
(code review, no test)
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote : | # |
review:
Approve
(code review. no test)
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
@joao
I am sure you want to implement it :)
review:
Needs Fixing
- 20. By Joao Alfredo Gama Batista
-
[IMP] Added SIN number validation and changed the module name to use the english acronym
- 21. By Joao Alfredo Gama Batista
-
[IMP] Use the english acronym
- 22. By Joao Alfredo Gama Batista
-
[FIX] Remove old module names traces
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'res_partner_attributes_add_BN' |
2 | === added file 'res_partner_attributes_add_BN/__init__.py' |
3 | --- res_partner_attributes_add_BN/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ res_partner_attributes_add_BN/__init__.py 2013-07-19 18:44:28 +0000 |
5 | @@ -0,0 +1,25 @@ |
6 | +# -*- encoding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
11 | +# |
12 | +# This program is free software: you can redistribute it and/or modify |
13 | +# it under the terms of the GNU Affero General Public License as |
14 | +# published by the Free Software Foundation, either version 3 of the |
15 | +# License, or (at your option) any later version. |
16 | +# |
17 | +# This program is distributed in the hope that it will be useful, |
18 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | +# GNU Affero General Public License for more details. |
21 | +# |
22 | +# You should have received a copy of the GNU Affero General Public License |
23 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
24 | +# |
25 | +############################################################################## |
26 | + |
27 | +import res_partner_attributes_add_BN |
28 | + |
29 | + |
30 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
31 | |
32 | === added file 'res_partner_attributes_add_BN/__openerp__.py' |
33 | --- res_partner_attributes_add_BN/__openerp__.py 1970-01-01 00:00:00 +0000 |
34 | +++ res_partner_attributes_add_BN/__openerp__.py 2013-07-19 18:44:28 +0000 |
35 | @@ -0,0 +1,39 @@ |
36 | +# -*- encoding: utf-8 -*- |
37 | +############################################################################## |
38 | +# |
39 | +# OpenERP, Open Source Management Solution |
40 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
41 | +# |
42 | +# This program is free software: you can redistribute it and/or modify |
43 | +# it under the terms of the GNU Affero General Public License as |
44 | +# published by the Free Software Foundation, either version 3 of the |
45 | +# License, or (at your option) any later version. |
46 | +# |
47 | +# This program is distributed in the hope that it will be useful, |
48 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
49 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
50 | +# GNU Affero General Public License for more details. |
51 | +# |
52 | +# You should have received a copy of the GNU Affero General Public License |
53 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
54 | +# |
55 | +############################################################################## |
56 | + |
57 | +{ |
58 | + 'name' : 'Business identification Number in Canada (BN/NE)', |
59 | + 'version' : '1.0', |
60 | + "author" : "Savoir-faire Linux (mcassuto@savoirfairelinux.com)", |
61 | + "website" : "http://www.savoirfairelinux.com", |
62 | + 'license': 'AGPL-3', |
63 | + 'category' : 'Localisation/Canada', |
64 | + 'depends' : ['base'], |
65 | + 'description': """ |
66 | +Add the Business identification Number (BN/NE) to the partner form. |
67 | +""", |
68 | + 'auto_install': False, |
69 | + 'installable': True, |
70 | + 'data' : ['res_partner_attributes_add_BN_view.xml'] |
71 | +} |
72 | + |
73 | + |
74 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
75 | |
76 | === added directory 'res_partner_attributes_add_BN/i18n' |
77 | === added file 'res_partner_attributes_add_BN/i18n/fr.po' |
78 | --- res_partner_attributes_add_BN/i18n/fr.po 1970-01-01 00:00:00 +0000 |
79 | +++ res_partner_attributes_add_BN/i18n/fr.po 2013-07-19 18:44:28 +0000 |
80 | @@ -0,0 +1,32 @@ |
81 | +# Translation of OpenERP Server. |
82 | +# This file contains the translation of the following modules: |
83 | +# * res_partner_attributes_add_BN |
84 | +# |
85 | +msgid "" |
86 | +msgstr "" |
87 | +"Project-Id-Version: OpenERP Server 7.0\n" |
88 | +"Report-Msgid-Bugs-To: \n" |
89 | +"POT-Creation-Date: 2013-07-19 18:29+0000\n" |
90 | +"PO-Revision-Date: 2013-07-19 14:32-0400\n" |
91 | +"Last-Translator: <>\n" |
92 | +"Language-Team: \n" |
93 | +"MIME-Version: 1.0\n" |
94 | +"Content-Type: text/plain; charset=UTF-8\n" |
95 | +"Content-Transfer-Encoding: \n" |
96 | +"Plural-Forms: \n" |
97 | + |
98 | +#. module: res_partner_attributes_add_BN |
99 | +#: model:ir.model,name:res_partner_attributes_add_BN.model_res_partner |
100 | +msgid "Partner" |
101 | +msgstr "Partenaire" |
102 | + |
103 | +#. module: res_partner_attributes_add_BN |
104 | +#: field:res.partner,ne:0 |
105 | +msgid "BN" |
106 | +msgstr "NE" |
107 | + |
108 | +#. module: res_partner_attributes_add_BN |
109 | +#: help:res.partner,ne:0 |
110 | +msgid "Canada Business identification Number (9 digits)" |
111 | +msgstr "Numéro d'Entreprise du Canada (9 chiffres)" |
112 | + |
113 | |
114 | === added file 'res_partner_attributes_add_BN/i18n/res_partner_attributes_add_BN.pot' |
115 | --- res_partner_attributes_add_BN/i18n/res_partner_attributes_add_BN.pot 1970-01-01 00:00:00 +0000 |
116 | +++ res_partner_attributes_add_BN/i18n/res_partner_attributes_add_BN.pot 2013-07-19 18:44:28 +0000 |
117 | @@ -0,0 +1,32 @@ |
118 | +# Translation of OpenERP Server. |
119 | +# This file contains the translation of the following modules: |
120 | +# * res_partner_attributes_add_NE |
121 | +# |
122 | +msgid "" |
123 | +msgstr "" |
124 | +"Project-Id-Version: OpenERP Server 7.0\n" |
125 | +"Report-Msgid-Bugs-To: \n" |
126 | +"POT-Creation-Date: 2013-07-11 14:53+0000\n" |
127 | +"PO-Revision-Date: 2013-07-11 14:53+0000\n" |
128 | +"Last-Translator: <>\n" |
129 | +"Language-Team: \n" |
130 | +"MIME-Version: 1.0\n" |
131 | +"Content-Type: text/plain; charset=UTF-8\n" |
132 | +"Content-Transfer-Encoding: \n" |
133 | +"Plural-Forms: \n" |
134 | + |
135 | +#. module: res_partner_attributes_add_NE |
136 | +#: model:ir.model,name:res_partner_attributes_add_NE.model_res_partner |
137 | +msgid "Partner" |
138 | +msgstr "" |
139 | + |
140 | +#. module: res_partner_attributes_add_NE |
141 | +#: help:res.partner,ne:0 |
142 | +msgid "Canada Business identification Number (9 digits)" |
143 | +msgstr "" |
144 | + |
145 | +#. module: res_partner_attributes_add_NE |
146 | +#: field:res.partner,ne:0 |
147 | +msgid "NE" |
148 | +msgstr "" |
149 | + |
150 | |
151 | === added file 'res_partner_attributes_add_BN/res_partner_attributes_add_BN.py' |
152 | --- res_partner_attributes_add_BN/res_partner_attributes_add_BN.py 1970-01-01 00:00:00 +0000 |
153 | +++ res_partner_attributes_add_BN/res_partner_attributes_add_BN.py 2013-07-19 18:44:28 +0000 |
154 | @@ -0,0 +1,35 @@ |
155 | +# -*- encoding: utf-8 -*- |
156 | +############################################################################## |
157 | +# |
158 | +# OpenERP, Open Source Management Solution |
159 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
160 | +# |
161 | +# This program is free software: you can redistribute it and/or modify |
162 | +# it under the terms of the GNU Affero General Public License as |
163 | +# published by the Free Software Foundation, either version 3 of the |
164 | +# License, or (at your option) any later version. |
165 | +# |
166 | +# This program is distributed in the hope that it will be useful, |
167 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
168 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
169 | +# GNU Affero General Public License for more details. |
170 | +# |
171 | +# You should have received a copy of the GNU Affero General Public License |
172 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
173 | +# |
174 | +############################################################################## |
175 | + |
176 | +from openerp.osv import fields, orm |
177 | +from openerp.tools.translate import _ |
178 | + |
179 | + |
180 | +class res_partner(orm.Model): |
181 | + _name = 'res.partner' |
182 | + _inherit = 'res.partner' |
183 | + _columns = { |
184 | + 'ne': fields.float('BN', digits=(9, 0), |
185 | + help="Canada Business identification Number (9 digits)"), |
186 | + } |
187 | + |
188 | + |
189 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
190 | |
191 | === added file 'res_partner_attributes_add_BN/res_partner_attributes_add_BN_view.xml' |
192 | --- res_partner_attributes_add_BN/res_partner_attributes_add_BN_view.xml 1970-01-01 00:00:00 +0000 |
193 | +++ res_partner_attributes_add_BN/res_partner_attributes_add_BN_view.xml 2013-07-19 18:44:28 +0000 |
194 | @@ -0,0 +1,16 @@ |
195 | +<?xml version="1.0" encoding="utf-8"?> |
196 | +<openerp> |
197 | + <data> |
198 | + <record model="ir.ui.view" id="res_partner_attributes_add_NE_form_view"> |
199 | + <field name="name">res_partner_attributes_add_NE</field> |
200 | + <field name="model">res.partner</field> |
201 | + <field name="inherit_id" ref="base.view_partner_form"/> |
202 | + <field name="arch" type="xml"> |
203 | + <field name="email" position="after"> |
204 | + <field name="ne" attrs="{'invisible': [('is_company','=', False)]}"/> |
205 | + </field> |
206 | + </field> |
207 | + </record> |
208 | + |
209 | + </data> |
210 | +</openerp> |
211 | |
212 | === added directory 'res_partner_attributes_add_NEQ' |
213 | === added file 'res_partner_attributes_add_NEQ/__init__.py' |
214 | --- res_partner_attributes_add_NEQ/__init__.py 1970-01-01 00:00:00 +0000 |
215 | +++ res_partner_attributes_add_NEQ/__init__.py 2013-07-19 18:44:28 +0000 |
216 | @@ -0,0 +1,25 @@ |
217 | +# -*- encoding: utf-8 -*- |
218 | +############################################################################## |
219 | +# |
220 | +# OpenERP, Open Source Management Solution |
221 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
222 | +# |
223 | +# This program is free software: you can redistribute it and/or modify |
224 | +# it under the terms of the GNU Affero General Public License as |
225 | +# published by the Free Software Foundation, either version 3 of the |
226 | +# License, or (at your option) any later version. |
227 | +# |
228 | +# This program is distributed in the hope that it will be useful, |
229 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
230 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
231 | +# GNU Affero General Public License for more details. |
232 | +# |
233 | +# You should have received a copy of the GNU Affero General Public License |
234 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
235 | +# |
236 | +############################################################################## |
237 | + |
238 | +import res_partner_attributes_add_NEQ |
239 | + |
240 | + |
241 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
242 | |
243 | === added file 'res_partner_attributes_add_NEQ/__openerp__.py' |
244 | --- res_partner_attributes_add_NEQ/__openerp__.py 1970-01-01 00:00:00 +0000 |
245 | +++ res_partner_attributes_add_NEQ/__openerp__.py 2013-07-19 18:44:28 +0000 |
246 | @@ -0,0 +1,39 @@ |
247 | +# -*- encoding: utf-8 -*- |
248 | +############################################################################## |
249 | +# |
250 | +# OpenERP, Open Source Management Solution |
251 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
252 | +# |
253 | +# This program is free software: you can redistribute it and/or modify |
254 | +# it under the terms of the GNU Affero General Public License as |
255 | +# published by the Free Software Foundation, either version 3 of the |
256 | +# License, or (at your option) any later version. |
257 | +# |
258 | +# This program is distributed in the hope that it will be useful, |
259 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
260 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
261 | +# GNU Affero General Public License for more details. |
262 | +# |
263 | +# You should have received a copy of the GNU Affero General Public License |
264 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
265 | +# |
266 | +############################################################################## |
267 | + |
268 | +{ |
269 | + 'name' : 'Quebec Enterprise Number (NEQ)', |
270 | + 'version' : '1.1', |
271 | + "author" : "Savoir-faire Linux (mcassuto@savoirfairelinux.com)", |
272 | + "website" : "http://www.savoirfairelinux.com", |
273 | + 'license': 'AGPL-3', |
274 | + 'category' : 'Localisation/Canada', |
275 | + 'depends' : ['base'], |
276 | + 'description': """ |
277 | +Add the Quebec Enterprise Number (NEQ) to the partner form. |
278 | +""", |
279 | + 'auto_install': False, |
280 | + 'installable': True, |
281 | + 'data' : ['res_partner_attributes_add_NEQ_view.xml'] |
282 | +} |
283 | + |
284 | + |
285 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
286 | |
287 | === added directory 'res_partner_attributes_add_NEQ/i18n' |
288 | === added file 'res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.mo' |
289 | Binary files res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.mo 1970-01-01 00:00:00 +0000 and res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.mo 2013-07-19 18:44:28 +0000 differ |
290 | === added file 'res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.pot' |
291 | --- res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.pot 1970-01-01 00:00:00 +0000 |
292 | +++ res_partner_attributes_add_NEQ/i18n/res_partner_attributes_add_NEQ.pot 2013-07-19 18:44:28 +0000 |
293 | @@ -0,0 +1,32 @@ |
294 | +# Translation of OpenERP Server. |
295 | +# This file contains the translation of the following modules: |
296 | +# * res_partner_attributes_add_NEQ |
297 | +# |
298 | +msgid "" |
299 | +msgstr "" |
300 | +"Project-Id-Version: OpenERP Server 7.0\n" |
301 | +"Report-Msgid-Bugs-To: \n" |
302 | +"POT-Creation-Date: 2013-07-11 14:53+0000\n" |
303 | +"PO-Revision-Date: 2013-07-11 10:58-0500\n" |
304 | +"Last-Translator: Marc Cassuto <marc.cassuto@savoirfairelinux.com>\n" |
305 | +"Language-Team: \n" |
306 | +"MIME-Version: 1.0\n" |
307 | +"Content-Type: text/plain; charset=UTF-8\n" |
308 | +"Content-Transfer-Encoding: 8bit\n" |
309 | +"Plural-Forms: \n" |
310 | + |
311 | +#. module: res_partner_attributes_add_NEQ |
312 | +#: model:ir.model,name:res_partner_attributes_add_NEQ.model_res_partner |
313 | +msgid "Partner" |
314 | +msgstr "Partenaire" |
315 | + |
316 | +#. module: res_partner_attributes_add_NEQ |
317 | +#: help:res.partner,neq:0 |
318 | +msgid "Quebec Enterprise Number (10 digits)" |
319 | +msgstr "Numéro d'Entreprise du Quebec (10 chiffres)" |
320 | + |
321 | +#. module: res_partner_attributes_add_NEQ |
322 | +#: field:res.partner,neq:0 |
323 | +msgid "NEQ" |
324 | +msgstr "NEQ" |
325 | + |
326 | |
327 | === added file 'res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ.py' |
328 | --- res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ.py 1970-01-01 00:00:00 +0000 |
329 | +++ res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ.py 2013-07-19 18:44:28 +0000 |
330 | @@ -0,0 +1,33 @@ |
331 | +# -*- encoding: utf-8 -*- |
332 | +############################################################################## |
333 | +# |
334 | +# OpenERP, Open Source Management Solution |
335 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
336 | +# |
337 | +# This program is free software: you can redistribute it and/or modify |
338 | +# it under the terms of the GNU Affero General Public License as |
339 | +# published by the Free Software Foundation, either version 3 of the |
340 | +# License, or (at your option) any later version. |
341 | +# |
342 | +# This program is distributed in the hope that it will be useful, |
343 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
344 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
345 | +# GNU Affero General Public License for more details. |
346 | +# |
347 | +# You should have received a copy of the GNU Affero General Public License |
348 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
349 | +# |
350 | +############################################################################## |
351 | + |
352 | +from openerp.osv import fields, orm |
353 | +from openerp.tools.translate import _ |
354 | + |
355 | +class res_partner(orm.Model): |
356 | + _name = 'res.partner' |
357 | + _inherit = 'res.partner' |
358 | + _columns = { |
359 | + 'neq': fields.float('NEQ', digits=(10,0), help="Quebec Enterprise Number (10 digits)"), |
360 | + } |
361 | + |
362 | + |
363 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
364 | |
365 | === added file 'res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ_view.xml' |
366 | --- res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ_view.xml 1970-01-01 00:00:00 +0000 |
367 | +++ res_partner_attributes_add_NEQ/res_partner_attributes_add_NEQ_view.xml 2013-07-19 18:44:28 +0000 |
368 | @@ -0,0 +1,15 @@ |
369 | +<?xml version="1.0" encoding="utf-8"?> |
370 | +<openerp> |
371 | + <data> |
372 | + <record model="ir.ui.view" id="res_partner_attributes_add_NEQ_form_view"> |
373 | + <field name="name">res_partner_attributes_add_NEQ</field> |
374 | + <field name="model">res.partner</field> |
375 | + <field name="inherit_id" ref="base.view_partner_form"/> |
376 | + <field name="arch" type="xml"> |
377 | + <field name="website" position="after"> |
378 | + <field name="neq" attrs="{'invisible': [('is_company','=', False)]}"/> |
379 | + </field> |
380 | + </field> |
381 | + </record> |
382 | + </data> |
383 | +</openerp> |
384 | |
385 | === added directory 'res_partner_attributes_add_SIN' |
386 | === added file 'res_partner_attributes_add_SIN/__init__.py' |
387 | --- res_partner_attributes_add_SIN/__init__.py 1970-01-01 00:00:00 +0000 |
388 | +++ res_partner_attributes_add_SIN/__init__.py 2013-07-19 18:44:28 +0000 |
389 | @@ -0,0 +1,25 @@ |
390 | +# -*- encoding: utf-8 -*- |
391 | +############################################################################## |
392 | +# |
393 | +# OpenERP, Open Source Management Solution |
394 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
395 | +# |
396 | +# This program is free software: you can redistribute it and/or modify |
397 | +# it under the terms of the GNU Affero General Public License as |
398 | +# published by the Free Software Foundation, either version 3 of the |
399 | +# License, or (at your option) any later version. |
400 | +# |
401 | +# This program is distributed in the hope that it will be useful, |
402 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
403 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
404 | +# GNU Affero General Public License for more details. |
405 | +# |
406 | +# You should have received a copy of the GNU Affero General Public License |
407 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
408 | +# |
409 | +############################################################################## |
410 | + |
411 | +import res_partner_attributes_add_SIN |
412 | + |
413 | + |
414 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
415 | |
416 | === added file 'res_partner_attributes_add_SIN/__openerp__.py' |
417 | --- res_partner_attributes_add_SIN/__openerp__.py 1970-01-01 00:00:00 +0000 |
418 | +++ res_partner_attributes_add_SIN/__openerp__.py 2013-07-19 18:44:28 +0000 |
419 | @@ -0,0 +1,39 @@ |
420 | +# -*- coding: utf-8 -*- |
421 | +############################################################################## |
422 | +# |
423 | +# OpenERP, Open Source Management Solution |
424 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
425 | +# |
426 | +# This program is free software: you can redistribute it and/or modify |
427 | +# it under the terms of the GNU Affero General Public License as |
428 | +# published by the Free Software Foundation, either version 3 of the |
429 | +# License, or (at your option) any later version. |
430 | +# |
431 | +# This program is distributed in the hope that it will be useful, |
432 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
433 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
434 | +# GNU Affero General Public License for more details. |
435 | +# |
436 | +# You should have received a copy of the GNU Affero General Public License |
437 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
438 | +# |
439 | +############################################################################## |
440 | + |
441 | +{ |
442 | + 'name' : 'Canada Social Insurance Number (SIN/NAS)', |
443 | + 'version' : '1.0', |
444 | + "author" : "Savoir-faire Linux (mcassuto@savoirfairelinux.com)", |
445 | + "website" : "http://www.savoirfairelinux.com", |
446 | + 'license': 'AGPL-3', |
447 | + 'category' : 'Localisation/Canada', |
448 | + 'depends' : ['base'], |
449 | + 'description': """ |
450 | +Add the Social Insurance Number (SIN/NAS) to the partner form. |
451 | +""", |
452 | + 'auto_install': False, |
453 | + 'installable': True, |
454 | + 'data' : ['res_partner_attributes_add_SIN_view.xml'] |
455 | +} |
456 | + |
457 | + |
458 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
459 | |
460 | === added directory 'res_partner_attributes_add_SIN/i18n' |
461 | === added file 'res_partner_attributes_add_SIN/i18n/fr.mo' |
462 | Binary files res_partner_attributes_add_SIN/i18n/fr.mo 1970-01-01 00:00:00 +0000 and res_partner_attributes_add_SIN/i18n/fr.mo 2013-07-19 18:44:28 +0000 differ |
463 | === added file 'res_partner_attributes_add_SIN/i18n/fr.po' |
464 | --- res_partner_attributes_add_SIN/i18n/fr.po 1970-01-01 00:00:00 +0000 |
465 | +++ res_partner_attributes_add_SIN/i18n/fr.po 2013-07-19 18:44:28 +0000 |
466 | @@ -0,0 +1,32 @@ |
467 | +# Translation of OpenERP Server. |
468 | +# This file contains the translation of the following modules: |
469 | +# * res_partner_attributes_add_NAS |
470 | +# |
471 | +msgid "" |
472 | +msgstr "" |
473 | +"Project-Id-Version: OpenERP Server 7.0\n" |
474 | +"Report-Msgid-Bugs-To: \n" |
475 | +"POT-Creation-Date: 2013-07-19 16:41+0000\n" |
476 | +"PO-Revision-Date: 2013-07-19 13:14-0400\n" |
477 | +"Last-Translator: <>\n" |
478 | +"Language-Team: \n" |
479 | +"MIME-Version: 1.0\n" |
480 | +"Content-Type: text/plain; charset=UTF-8\n" |
481 | +"Content-Transfer-Encoding: \n" |
482 | +"Plural-Forms: \n" |
483 | + |
484 | +#. module: res_partner_attributes_add_NAS |
485 | +#: model:ir.model,name:res_partner_attributes_add_NAS.model_res_partner |
486 | +msgid "Partner" |
487 | +msgstr "Partenaire" |
488 | + |
489 | +#. module: res_partner_attributes_add_NAS |
490 | +#: help:res.partner,nas:0 |
491 | +msgid "Social Insurance Number (9 digits)" |
492 | +msgstr "Numéro d'Assurance Sociale (9 chiffres)" |
493 | + |
494 | +#. module: res_partner_attributes_add_NAS |
495 | +#: field:res.partner,nas:0 |
496 | +msgid "SIN" |
497 | +msgstr "NAS" |
498 | + |
499 | |
500 | === added file 'res_partner_attributes_add_SIN/i18n/res_partner_attributes_add_SIN.pot' |
501 | --- res_partner_attributes_add_SIN/i18n/res_partner_attributes_add_SIN.pot 1970-01-01 00:00:00 +0000 |
502 | +++ res_partner_attributes_add_SIN/i18n/res_partner_attributes_add_SIN.pot 2013-07-19 18:44:28 +0000 |
503 | @@ -0,0 +1,32 @@ |
504 | +# Translation of OpenERP Server. |
505 | +# This file contains the translation of the following modules: |
506 | +# * res_partner_attributes_add_NAS |
507 | +# |
508 | +msgid "" |
509 | +msgstr "" |
510 | +"Project-Id-Version: OpenERP Server 7.0\n" |
511 | +"Report-Msgid-Bugs-To: \n" |
512 | +"POT-Creation-Date: 2013-07-11 14:53+0000\n" |
513 | +"PO-Revision-Date: 2013-07-11 14:53+0000\n" |
514 | +"Last-Translator: <>\n" |
515 | +"Language-Team: \n" |
516 | +"MIME-Version: 1.0\n" |
517 | +"Content-Type: text/plain; charset=UTF-8\n" |
518 | +"Content-Transfer-Encoding: \n" |
519 | +"Plural-Forms: \n" |
520 | + |
521 | +#. module: res_partner_attributes_add_NAS |
522 | +#: field:res.partner,nas:0 |
523 | +msgid "NAS" |
524 | +msgstr "" |
525 | + |
526 | +#. module: res_partner_attributes_add_NAS |
527 | +#: help:res.partner,nas:0 |
528 | +msgid "Social Insurance Number (9 digits)" |
529 | +msgstr "" |
530 | + |
531 | +#. module: res_partner_attributes_add_NAS |
532 | +#: model:ir.model,name:res_partner_attributes_add_NAS.model_res_partner |
533 | +msgid "Partner" |
534 | +msgstr "" |
535 | + |
536 | |
537 | === added file 'res_partner_attributes_add_SIN/res_partner_attributes_add_SIN.py' |
538 | --- res_partner_attributes_add_SIN/res_partner_attributes_add_SIN.py 1970-01-01 00:00:00 +0000 |
539 | +++ res_partner_attributes_add_SIN/res_partner_attributes_add_SIN.py 2013-07-19 18:44:28 +0000 |
540 | @@ -0,0 +1,64 @@ |
541 | +# -*- coding: utf-8 -*- |
542 | +############################################################################## |
543 | +# |
544 | +# OpenERP, Open Source Management Solution |
545 | +# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>). |
546 | +# |
547 | +# This program is free software: you can redistribute it and/or modify |
548 | +# it under the terms of the GNU Affero General Public License as |
549 | +# published by the Free Software Foundation, either version 3 of the |
550 | +# License, or (at your option) any later version. |
551 | +# |
552 | +# This program is distributed in the hope that it will be useful, |
553 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
554 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
555 | +# GNU Affero General Public License for more details. |
556 | +# |
557 | +# You should have received a copy of the GNU Affero General Public License |
558 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
559 | +# |
560 | +############################################################################## |
561 | + |
562 | +from openerp.osv import fields, orm |
563 | +from openerp.tools.translate import _ |
564 | + |
565 | + |
566 | +class res_partner(orm.Model): |
567 | + _name = 'res.partner' |
568 | + _inherit = 'res.partner' |
569 | + |
570 | + def onchange_nas(self, cr, uid, ids, nas): |
571 | + ret = {'value': 0} |
572 | + |
573 | + def digits_of(n): |
574 | + return [int(d) for d in str(n)] |
575 | + |
576 | + def luhn_checksum(nas): |
577 | + digits = digits_of(nas) |
578 | + odd_digits = digits[-1::-2] |
579 | + even_digits = digits[-2::-2] |
580 | + checksum = 0 |
581 | + checksum += sum(odd_digits) |
582 | + for d in even_digits: |
583 | + checksum += sum(digits_of(d * 2)) |
584 | + return checksum % 10 |
585 | + |
586 | + def is_luhn_valid(nas): |
587 | + return luhn_checksum(nas) == 0 |
588 | + |
589 | + if is_luhn_valid(nas): |
590 | + ret['value'] = nas |
591 | + else: |
592 | + ret['value'] = 0 |
593 | + ret['warning'] = { |
594 | + 'title': 'Error', |
595 | + 'message': _('The number provided is not a valid SIN number !') |
596 | + } |
597 | + return ret |
598 | + |
599 | + _columns = { |
600 | + 'nas': fields.float('SIN', digits=(9, 0), |
601 | + help="Social Insurance Number (9 digits)"), |
602 | + } |
603 | + |
604 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
605 | |
606 | === added file 'res_partner_attributes_add_SIN/res_partner_attributes_add_SIN_view.xml' |
607 | --- res_partner_attributes_add_SIN/res_partner_attributes_add_SIN_view.xml 1970-01-01 00:00:00 +0000 |
608 | +++ res_partner_attributes_add_SIN/res_partner_attributes_add_SIN_view.xml 2013-07-19 18:44:28 +0000 |
609 | @@ -0,0 +1,15 @@ |
610 | +<?xml version="1.0" encoding="utf-8"?> |
611 | +<openerp> |
612 | + <data> |
613 | + <record model="ir.ui.view" id="res_partner_attributes_add_NAS_form_view"> |
614 | + <field name="name">res_partner_attributes_add_NAS</field> |
615 | + <field name="model">res.partner</field> |
616 | + <field name="inherit_id" ref="base.view_partner_form"/> |
617 | + <field name="arch" type="xml"> |
618 | + <field name="website" position="after"> |
619 | + <field name="nas" on_change="onchange_nas(nas)" attrs="{'invisible': [('is_company','=', True)]}"/> |
620 | + </field> |
621 | + </field> |
622 | + </record> |
623 | + </data> |
624 | +</openerp> |
A suggestion for future improvement:
http:// en.wikipedia. org/wiki/ Social_ Insurance_ Number# Validation