Merge lp:~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email into lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions
- firstname_lastname_fix_bug_email
- Merge into base_contact_by_functions
Proposed by
El Hadji Dem (http://www.savoirfairelinux.com)
Status: | Merged |
---|---|
Merged at revision: | 36 |
Proposed branch: | lp:~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email |
Merge into: | lp:~savoirfairelinux-openerp/partner-contact-management/base_contact_by_functions |
Diff against target: |
908 lines (+505/-259) 19 files modified
base_continent/__init__.py (+24/-0) base_continent/__openerp__.py (+42/-0) base_continent/base_continent.py (+34/-0) base_continent/base_continent_data.xml (+27/-0) base_continent/base_continent_view.xml (+73/-0) base_continent/country.py (+30/-0) base_continent/i18n/base_continent.po (+56/-0) base_continent/i18n/fr.po (+56/-0) base_continent/partner.py (+34/-0) base_continent/security/ir.model.access.csv (+3/-0) firstname_display_name_trigger/__init__.py (+0/-24) firstname_display_name_trigger/__openerp__.py (+0/-41) firstname_display_name_trigger/res_partner.py (+0/-65) firstname_display_name_trigger/tests/__init__.py (+0/-5) firstname_display_name_trigger/tests/test_display_name.py (+0/-31) partner_firstname/__openerp__.py (+26/-16) partner_firstname/partner.py (+58/-39) partner_firstname/partner_view.xml (+36/-33) partner_firstname/res_user.py (+6/-5) |
To merge this branch: | bzr merge lp:~savoirfairelinux-openerp/partner-contact-management/firstname_lastname_fix_bug_email |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sandy Carter (http://www.savoirfairelinux.com) | Pending | ||
Review via email: mp+202772@code.launchpad.net |
Commit message
Description of the change
[IMP] merge with https:/
- replace lastname by name, add full (=firstname + name).
- remove firstname_
- is_company field from contact view: this field also exists in partner view;it is redundant
- Redefine user class.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'base_continent' | |||
2 | === added file 'base_continent/__init__.py' | |||
3 | --- base_continent/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ base_continent/__init__.py 2014-01-22 23:37:10 +0000 | |||
5 | @@ -0,0 +1,24 @@ | |||
6 | 1 | # -*- encoding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # Author: Romain Deheele | ||
10 | 5 | # Copyright 2014 Camptocamp SA | ||
11 | 6 | # | ||
12 | 7 | # This program is free software: you can redistribute it and/or modify | ||
13 | 8 | # it under the terms of the GNU General Public License as published by | ||
14 | 9 | # the Free Software Foundation, either version 3 of the License, or | ||
15 | 10 | # (at your option) any later version. | ||
16 | 11 | # | ||
17 | 12 | # This program is distributed in the hope that it will be useful, | ||
18 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | 15 | # GNU General Public License for more details. | ||
21 | 16 | # | ||
22 | 17 | # You should have received a copy of the GNU General Public License | ||
23 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
24 | 19 | # | ||
25 | 20 | ############################################################################## | ||
26 | 21 | |||
27 | 22 | from . import base_continent | ||
28 | 23 | from . import country | ||
29 | 24 | from . import partner | ||
30 | 0 | 25 | ||
31 | === added file 'base_continent/__openerp__.py' | |||
32 | --- base_continent/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
33 | +++ base_continent/__openerp__.py 2014-01-22 23:37:10 +0000 | |||
34 | @@ -0,0 +1,42 @@ | |||
35 | 1 | # -*- coding: utf-8 -*- | ||
36 | 2 | ############################################################################## | ||
37 | 3 | # | ||
38 | 4 | # Author: Romain Deheele | ||
39 | 5 | # Copyright 2014 Camptocamp SA | ||
40 | 6 | # | ||
41 | 7 | # This program is free software: you can redistribute it and/or modify | ||
42 | 8 | # it under the terms of the GNU Affero General Public License as | ||
43 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
44 | 10 | # License, or (at your option) any later version. | ||
45 | 11 | # | ||
46 | 12 | # This program is distributed in the hope that it will be useful, | ||
47 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
48 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
49 | 15 | # GNU Affero General Public License for more details. | ||
50 | 16 | # | ||
51 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
52 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
53 | 19 | # | ||
54 | 20 | ############################################################################## | ||
55 | 21 | |||
56 | 22 | |||
57 | 23 | { | ||
58 | 24 | 'name': 'Continent management', | ||
59 | 25 | 'version': '1.0', | ||
60 | 26 | 'depends': ['base'], | ||
61 | 27 | 'author': 'Camptocamp', | ||
62 | 28 | 'license': 'AGPL-3', | ||
63 | 29 | 'description': """ | ||
64 | 30 | This module introduces continent management. | ||
65 | 31 | ============================================ | ||
66 | 32 | Links continents to countries, | ||
67 | 33 | adds continent field on partner form | ||
68 | 34 | """, | ||
69 | 35 | 'category': 'Generic Modules/Base', | ||
70 | 36 | 'data': [ | ||
71 | 37 | 'base_continent_view.xml', | ||
72 | 38 | 'base_continent_data.xml', | ||
73 | 39 | 'security/ir.model.access.csv'], | ||
74 | 40 | 'active': False, | ||
75 | 41 | 'installable': True, | ||
76 | 42 | } | ||
77 | 0 | 43 | ||
78 | === added file 'base_continent/base_continent.py' | |||
79 | --- base_continent/base_continent.py 1970-01-01 00:00:00 +0000 | |||
80 | +++ base_continent/base_continent.py 2014-01-22 23:37:10 +0000 | |||
81 | @@ -0,0 +1,34 @@ | |||
82 | 1 | # -*- coding: utf-8 -*- | ||
83 | 2 | ############################################################################## | ||
84 | 3 | # | ||
85 | 4 | # Author: Romain Deheele | ||
86 | 5 | # Copyright 2014 Camptocamp SA | ||
87 | 6 | # | ||
88 | 7 | # This program is free software: you can redistribute it and/or modify | ||
89 | 8 | # it under the terms of the GNU Affero General Public License as | ||
90 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
91 | 10 | # License, or (at your option) any later version. | ||
92 | 11 | # | ||
93 | 12 | # This program is distributed in the hope that it will be useful, | ||
94 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
95 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
96 | 15 | # GNU Affero General Public License for more details. | ||
97 | 16 | # | ||
98 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
99 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
100 | 19 | # | ||
101 | 20 | ############################################################################## | ||
102 | 21 | |||
103 | 22 | from openerp.osv.orm import Model | ||
104 | 23 | from openerp.osv import fields | ||
105 | 24 | |||
106 | 25 | |||
107 | 26 | class Continent(Model): | ||
108 | 27 | _name = 'res.continent' | ||
109 | 28 | _description = 'Continent' | ||
110 | 29 | _columns = { | ||
111 | 30 | 'name': fields.char('Continent Name', size=64, | ||
112 | 31 | help='The full name of the continent.', | ||
113 | 32 | required=True, translate=True), | ||
114 | 33 | } | ||
115 | 34 | _order = 'name' | ||
116 | 0 | 35 | ||
117 | === added file 'base_continent/base_continent_data.xml' | |||
118 | --- base_continent/base_continent_data.xml 1970-01-01 00:00:00 +0000 | |||
119 | +++ base_continent/base_continent_data.xml 2014-01-22 23:37:10 +0000 | |||
120 | @@ -0,0 +1,27 @@ | |||
121 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
122 | 2 | <openerp> | ||
123 | 3 | <data noupdate="1"> | ||
124 | 4 | |||
125 | 5 | <record id="af" model="res.continent"> | ||
126 | 6 | <field name="name">Africa</field> | ||
127 | 7 | </record> | ||
128 | 8 | <record id="an" model="res.continent"> | ||
129 | 9 | <field name="name">Antarctica</field> | ||
130 | 10 | </record> | ||
131 | 11 | <record id="as" model="res.continent"> | ||
132 | 12 | <field name="name">Asia</field> | ||
133 | 13 | </record> | ||
134 | 14 | <record id="eu" model="res.continent"> | ||
135 | 15 | <field name="name">Europe</field> | ||
136 | 16 | </record> | ||
137 | 17 | <record id="na" model="res.continent"> | ||
138 | 18 | <field name="name">North America</field> | ||
139 | 19 | </record> | ||
140 | 20 | <record id="oc" model="res.continent"> | ||
141 | 21 | <field name="name">Oceania</field> | ||
142 | 22 | </record> | ||
143 | 23 | <record id="sa" model="res.continent"> | ||
144 | 24 | <field name="name">South America</field> | ||
145 | 25 | </record> | ||
146 | 26 | </data> | ||
147 | 27 | </openerp> | ||
148 | 0 | 28 | ||
149 | === added file 'base_continent/base_continent_view.xml' | |||
150 | --- base_continent/base_continent_view.xml 1970-01-01 00:00:00 +0000 | |||
151 | +++ base_continent/base_continent_view.xml 2014-01-22 23:37:10 +0000 | |||
152 | @@ -0,0 +1,73 @@ | |||
153 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
154 | 2 | <openerp> | ||
155 | 3 | <data> | ||
156 | 4 | <!-- add continent to res country tree --> | ||
157 | 5 | <record model="ir.ui.view" id="view_country_tree_add_continent"> | ||
158 | 6 | <field name="name">res.country.tree.add_continent</field> | ||
159 | 7 | <field name="model">res.country</field> | ||
160 | 8 | <field name="inherit_id" ref="base.view_country_tree" /> | ||
161 | 9 | <field name="arch" type="xml"> | ||
162 | 10 | <field name="code" position="after"> | ||
163 | 11 | <field name="continent_id"/> | ||
164 | 12 | </field> | ||
165 | 13 | </field> | ||
166 | 14 | </record> | ||
167 | 15 | |||
168 | 16 | <!-- add continent to res country form --> | ||
169 | 17 | <record model="ir.ui.view" id="view_country_form_add_continent"> | ||
170 | 18 | <field name="name">res.country.form.add_continent</field> | ||
171 | 19 | <field name="model">res.country</field> | ||
172 | 20 | <field name="inherit_id" ref="base.view_country_form"/> | ||
173 | 21 | <field name="arch" type="xml"> | ||
174 | 22 | <field name="code" position="after"> | ||
175 | 23 | <field name="continent_id"/> | ||
176 | 24 | </field> | ||
177 | 25 | </field> | ||
178 | 26 | </record> | ||
179 | 27 | |||
180 | 28 | <record id="view_continent_tree" model="ir.ui.view"> | ||
181 | 29 | <field name="name">res.continent.tree</field> | ||
182 | 30 | <field name="model">res.continent</field> | ||
183 | 31 | <field name="arch" type="xml"> | ||
184 | 32 | <tree string="Continent"> | ||
185 | 33 | <field name="name"/> | ||
186 | 34 | </tree> | ||
187 | 35 | </field> | ||
188 | 36 | </record> | ||
189 | 37 | |||
190 | 38 | <record id="view_continent_form" model="ir.ui.view"> | ||
191 | 39 | <field name="name">res.continent.form</field> | ||
192 | 40 | <field name="model">res.continent</field> | ||
193 | 41 | <field name="arch" type="xml"> | ||
194 | 42 | <form string="Continent" version="7.0"> | ||
195 | 43 | <group> | ||
196 | 44 | <field name="name"/> | ||
197 | 45 | </group> | ||
198 | 46 | </form> | ||
199 | 47 | </field> | ||
200 | 48 | </record> | ||
201 | 49 | |||
202 | 50 | <record id="action_continent" model="ir.actions.act_window"> | ||
203 | 51 | <field name="name">Continents</field> | ||
204 | 52 | <field name="type">ir.actions.act_window</field> | ||
205 | 53 | <field name="res_model">res.continent</field> | ||
206 | 54 | <field name="view_type">form</field> | ||
207 | 55 | <field name="help">Display and manage the list of all continents that can be assigned to your partner records.</field> | ||
208 | 56 | </record> | ||
209 | 57 | |||
210 | 58 | <menuitem action="action_continent" id="menu_continent_partner" parent="base.menu_localisation" sequence="1" groups="base.group_no_one"/> | ||
211 | 59 | |||
212 | 60 | <!-- add continent to res partner form --> | ||
213 | 61 | <record model="ir.ui.view" id="res_partner_form_add_continent"> | ||
214 | 62 | <field name="name">res.partner.form.add_continent</field> | ||
215 | 63 | <field name="model">res.partner</field> | ||
216 | 64 | <field name="inherit_id" ref="base.view_partner_form"/> | ||
217 | 65 | <field name="arch" type="xml"> | ||
218 | 66 | <field name="country_id" position="after"> | ||
219 | 67 | <field name="continent_id" widget="selection"/> | ||
220 | 68 | </field> | ||
221 | 69 | </field> | ||
222 | 70 | </record> | ||
223 | 71 | |||
224 | 72 | </data> | ||
225 | 73 | </openerp> | ||
226 | 0 | 74 | ||
227 | === added file 'base_continent/country.py' | |||
228 | --- base_continent/country.py 1970-01-01 00:00:00 +0000 | |||
229 | +++ base_continent/country.py 2014-01-22 23:37:10 +0000 | |||
230 | @@ -0,0 +1,30 @@ | |||
231 | 1 | # -*- coding: utf-8 -*- | ||
232 | 2 | ############################################################################## | ||
233 | 3 | # | ||
234 | 4 | # Author: Romain Deheele | ||
235 | 5 | # Copyright 2014 Camptocamp SA | ||
236 | 6 | # | ||
237 | 7 | # This program is free software: you can redistribute it and/or modify | ||
238 | 8 | # it under the terms of the GNU Affero General Public License as | ||
239 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
240 | 10 | # License, or (at your option) any later version. | ||
241 | 11 | # | ||
242 | 12 | # This program is distributed in the hope that it will be useful, | ||
243 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
244 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
245 | 15 | # GNU Affero General Public License for more details. | ||
246 | 16 | # | ||
247 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
248 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
249 | 19 | # | ||
250 | 20 | ############################################################################## | ||
251 | 21 | |||
252 | 22 | from openerp.osv.orm import Model | ||
253 | 23 | from openerp.osv import fields | ||
254 | 24 | |||
255 | 25 | |||
256 | 26 | class Country(Model): | ||
257 | 27 | _inherit = 'res.country' | ||
258 | 28 | _columns = { | ||
259 | 29 | 'continent_id': fields.many2one('res.continent', 'Continent'), | ||
260 | 30 | } | ||
261 | 0 | 31 | ||
262 | === added directory 'base_continent/i18n' | |||
263 | === added file 'base_continent/i18n/base_continent.po' | |||
264 | --- base_continent/i18n/base_continent.po 1970-01-01 00:00:00 +0000 | |||
265 | +++ base_continent/i18n/base_continent.po 2014-01-22 23:37:10 +0000 | |||
266 | @@ -0,0 +1,56 @@ | |||
267 | 1 | # Translation of OpenERP Server. | ||
268 | 2 | # This file contains the translation of the following modules: | ||
269 | 3 | # * base_continent | ||
270 | 4 | # | ||
271 | 5 | msgid "" | ||
272 | 6 | msgstr "" | ||
273 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
274 | 8 | "Report-Msgid-Bugs-To: \n" | ||
275 | 9 | "POT-Creation-Date: 2014-01-14 15:19+0000\n" | ||
276 | 10 | "PO-Revision-Date: 2014-01-14 15:19+0000\n" | ||
277 | 11 | "Last-Translator: <>\n" | ||
278 | 12 | "Language-Team: \n" | ||
279 | 13 | "MIME-Version: 1.0\n" | ||
280 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
281 | 15 | "Content-Transfer-Encoding: \n" | ||
282 | 16 | "Plural-Forms: \n" | ||
283 | 17 | |||
284 | 18 | #. module: base_continent | ||
285 | 19 | #: model:ir.actions.act_window,help:base_continent.action_continent | ||
286 | 20 | msgid "Display and manage the list of all continents that can be assigned to your partner records." | ||
287 | 21 | msgstr "" | ||
288 | 22 | |||
289 | 23 | #. module: base_continent | ||
290 | 24 | #: model:ir.actions.act_window,name:base_continent.action_continent | ||
291 | 25 | #: model:ir.ui.menu,name:base_continent.menu_continent_partner | ||
292 | 26 | msgid "Continents" | ||
293 | 27 | msgstr "" | ||
294 | 28 | |||
295 | 29 | #. module: base_continent | ||
296 | 30 | #: model:ir.model,name:base_continent.model_res_country | ||
297 | 31 | msgid "Country" | ||
298 | 32 | msgstr "" | ||
299 | 33 | |||
300 | 34 | #. module: base_continent | ||
301 | 35 | #: help:res.continent,name:0 | ||
302 | 36 | msgid "The full name of the continent." | ||
303 | 37 | msgstr "" | ||
304 | 38 | |||
305 | 39 | #. module: base_continent | ||
306 | 40 | #: field:res.continent,name:0 | ||
307 | 41 | msgid "Continent Name" | ||
308 | 42 | msgstr "" | ||
309 | 43 | |||
310 | 44 | #. module: base_continent | ||
311 | 45 | #: model:ir.model,name:base_continent.model_res_partner | ||
312 | 46 | msgid "Partner" | ||
313 | 47 | msgstr "" | ||
314 | 48 | |||
315 | 49 | #. module: base_continent | ||
316 | 50 | #: model:ir.model,name:base_continent.model_res_continent | ||
317 | 51 | #: view:res.continent:0 | ||
318 | 52 | #: field:res.country,continent_id:0 | ||
319 | 53 | #: field:res.partner,continent_id:0 | ||
320 | 54 | msgid "Continent" | ||
321 | 55 | msgstr "" | ||
322 | 56 | |||
323 | 0 | 57 | ||
324 | === added file 'base_continent/i18n/fr.po' | |||
325 | --- base_continent/i18n/fr.po 1970-01-01 00:00:00 +0000 | |||
326 | +++ base_continent/i18n/fr.po 2014-01-22 23:37:10 +0000 | |||
327 | @@ -0,0 +1,56 @@ | |||
328 | 1 | # Translation of OpenERP Server. | ||
329 | 2 | # This file contains the translation of the following modules: | ||
330 | 3 | # * base_continent | ||
331 | 4 | # | ||
332 | 5 | msgid "" | ||
333 | 6 | msgstr "" | ||
334 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
335 | 8 | "Report-Msgid-Bugs-To: \n" | ||
336 | 9 | "POT-Creation-Date: 2014-01-14 15:19+0000\n" | ||
337 | 10 | "PO-Revision-Date: 2014-01-14 15:19+0000\n" | ||
338 | 11 | "Last-Translator: <>\n" | ||
339 | 12 | "Language-Team: \n" | ||
340 | 13 | "MIME-Version: 1.0\n" | ||
341 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
342 | 15 | "Content-Transfer-Encoding: \n" | ||
343 | 16 | "Plural-Forms: \n" | ||
344 | 17 | |||
345 | 18 | #. module: base_continent | ||
346 | 19 | #: model:ir.actions.act_window,help:base_continent.action_continent | ||
347 | 20 | msgid "Display and manage the list of all continents that can be assigned to your partner records." | ||
348 | 21 | msgstr "Affiche et gère la liste de tous les continents qui peuvent être associés à vos partenaires." | ||
349 | 22 | |||
350 | 23 | #. module: base_continent | ||
351 | 24 | #: model:ir.actions.act_window,name:base_continent.action_continent | ||
352 | 25 | #: model:ir.ui.menu,name:base_continent.menu_continent_partner | ||
353 | 26 | msgid "Continents" | ||
354 | 27 | msgstr "Continents" | ||
355 | 28 | |||
356 | 29 | #. module: base_continent | ||
357 | 30 | #: model:ir.model,name:base_continent.model_res_country | ||
358 | 31 | msgid "Country" | ||
359 | 32 | msgstr "Pays" | ||
360 | 33 | |||
361 | 34 | #. module: base_continent | ||
362 | 35 | #: help:res.continent,name:0 | ||
363 | 36 | msgid "The full name of the continent." | ||
364 | 37 | msgstr "Le nom complet du continent." | ||
365 | 38 | |||
366 | 39 | #. module: base_continent | ||
367 | 40 | #: field:res.continent,name:0 | ||
368 | 41 | msgid "Continent Name" | ||
369 | 42 | msgstr "Nom du continent" | ||
370 | 43 | |||
371 | 44 | #. module: base_continent | ||
372 | 45 | #: model:ir.model,name:base_continent.model_res_partner | ||
373 | 46 | msgid "Partner" | ||
374 | 47 | msgstr "Partenaire" | ||
375 | 48 | |||
376 | 49 | #. module: base_continent | ||
377 | 50 | #: model:ir.model,name:base_continent.model_res_continent | ||
378 | 51 | #: view:res.continent:0 | ||
379 | 52 | #: field:res.country,continent_id:0 | ||
380 | 53 | #: field:res.partner,continent_id:0 | ||
381 | 54 | msgid "Continent" | ||
382 | 55 | msgstr "Continent" | ||
383 | 56 | |||
384 | 0 | 57 | ||
385 | === added file 'base_continent/partner.py' | |||
386 | --- base_continent/partner.py 1970-01-01 00:00:00 +0000 | |||
387 | +++ base_continent/partner.py 2014-01-22 23:37:10 +0000 | |||
388 | @@ -0,0 +1,34 @@ | |||
389 | 1 | # -*- coding: utf-8 -*- | ||
390 | 2 | ############################################################################## | ||
391 | 3 | # | ||
392 | 4 | # Author: Romain Deheele | ||
393 | 5 | # Copyright 2014 Camptocamp SA | ||
394 | 6 | # | ||
395 | 7 | # This program is free software: you can redistribute it and/or modify | ||
396 | 8 | # it under the terms of the GNU Affero General Public License as | ||
397 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
398 | 10 | # License, or (at your option) any later version. | ||
399 | 11 | # | ||
400 | 12 | # This program is distributed in the hope that it will be useful, | ||
401 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
402 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
403 | 15 | # GNU Affero General Public License for more details. | ||
404 | 16 | # | ||
405 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
406 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
407 | 19 | # | ||
408 | 20 | ############################################################################## | ||
409 | 21 | |||
410 | 22 | from openerp.osv.orm import Model | ||
411 | 23 | from openerp.osv import fields | ||
412 | 24 | |||
413 | 25 | |||
414 | 26 | class Partner(Model): | ||
415 | 27 | _inherit = 'res.partner' | ||
416 | 28 | _columns = { | ||
417 | 29 | 'continent_id': fields.related('country_id', 'continent_id', | ||
418 | 30 | type='many2one', | ||
419 | 31 | relation='res.continent', | ||
420 | 32 | string='Continent', | ||
421 | 33 | readonly=True, store=True), | ||
422 | 34 | } | ||
423 | 0 | 35 | ||
424 | === added directory 'base_continent/security' | |||
425 | === added file 'base_continent/security/ir.model.access.csv' | |||
426 | --- base_continent/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
427 | +++ base_continent/security/ir.model.access.csv 2014-01-22 23:37:10 +0000 | |||
428 | @@ -0,0 +1,3 @@ | |||
429 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
430 | 2 | access_res_continent_group_all,res_continent group_user_all,model_res_continent,,1,0,0,0 | ||
431 | 3 | access_res_continent_group_user,res_continent group_user,model_res_continent,base.group_partner_manager,1,1,1,1 | ||
432 | 0 | 4 | ||
433 | === removed directory 'firstname_display_name_trigger' | |||
434 | === removed file 'firstname_display_name_trigger/__init__.py' | |||
435 | --- firstname_display_name_trigger/__init__.py 2013-05-23 12:13:51 +0000 | |||
436 | +++ firstname_display_name_trigger/__init__.py 1970-01-01 00:00:00 +0000 | |||
437 | @@ -1,24 +0,0 @@ | |||
438 | 1 | # -*- coding: utf-8 -*- | ||
439 | 2 | ############################################################################## | ||
440 | 3 | # | ||
441 | 4 | # Author: Yannick Vaucher | ||
442 | 5 | # Copyright 2013 Camptocamp SA | ||
443 | 6 | # | ||
444 | 7 | # This program is free software: you can redistribute it and/or modify | ||
445 | 8 | # it under the terms of the GNU Affero General Public License as | ||
446 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
447 | 10 | # License, or (at your option) any later version. | ||
448 | 11 | # | ||
449 | 12 | # This program is distributed in the hope that it will be useful, | ||
450 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
451 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
452 | 15 | # GNU Affero General Public License for more details. | ||
453 | 16 | # | ||
454 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
455 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
456 | 19 | # | ||
457 | 20 | ############################################################################## | ||
458 | 21 | |||
459 | 22 | import res_partner | ||
460 | 23 | |||
461 | 24 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
462 | 25 | 0 | ||
463 | === removed file 'firstname_display_name_trigger/__openerp__.py' | |||
464 | --- firstname_display_name_trigger/__openerp__.py 2013-06-18 08:44:56 +0000 | |||
465 | +++ firstname_display_name_trigger/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
466 | @@ -1,41 +0,0 @@ | |||
467 | 1 | # -*- coding: utf-8 -*- | ||
468 | 2 | ############################################################################## | ||
469 | 3 | # | ||
470 | 4 | # Author: Yannick Vaucher | ||
471 | 5 | # Copyright 2013 Camptocamp SA | ||
472 | 6 | # | ||
473 | 7 | # This program is free software: you can redistribute it and/or modify | ||
474 | 8 | # it under the terms of the GNU Affero General Public License as | ||
475 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
476 | 10 | # License, or (at your option) any later version. | ||
477 | 11 | # | ||
478 | 12 | # This program is distributed in the hope that it will be useful, | ||
479 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
480 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
481 | 15 | # GNU Affero General Public License for more details. | ||
482 | 16 | # | ||
483 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
484 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
485 | 19 | # | ||
486 | 20 | ############################################################################## | ||
487 | 21 | {'name': 'Link module if partner_lastname and account_report_company are installed', | ||
488 | 22 | 'version': '1.0', | ||
489 | 23 | 'author': 'Camptocamp', | ||
490 | 24 | 'maintainer': 'Camptocamp', | ||
491 | 25 | 'category': 'Hidden', | ||
492 | 26 | 'complexity': 'normal', # easy, normal, expert | ||
493 | 27 | 'depends': [ | ||
494 | 28 | 'account_report_company', | ||
495 | 29 | 'partner_firstname', | ||
496 | 30 | ], | ||
497 | 31 | 'description': """ | ||
498 | 32 | Adapt the computation of display name so that it gets visible in tree and kanban views. | ||
499 | 33 | """, | ||
500 | 34 | 'website': 'http://www.camptocamp.com', | ||
501 | 35 | 'data': [], | ||
502 | 36 | 'installable': True, | ||
503 | 37 | 'images': [], | ||
504 | 38 | 'auto_install': True, | ||
505 | 39 | 'license': 'AGPL-3', | ||
506 | 40 | 'application': False} | ||
507 | 41 | |||
508 | 42 | 0 | ||
509 | === removed file 'firstname_display_name_trigger/res_partner.py' | |||
510 | --- firstname_display_name_trigger/res_partner.py 2013-12-04 12:52:48 +0000 | |||
511 | +++ firstname_display_name_trigger/res_partner.py 1970-01-01 00:00:00 +0000 | |||
512 | @@ -1,65 +0,0 @@ | |||
513 | 1 | # -*- coding: utf-8 -*- | ||
514 | 2 | ############################################################################## | ||
515 | 3 | # | ||
516 | 4 | # Author: Yannick Vaucher | ||
517 | 5 | # Copyright 2013 Camptocamp SA | ||
518 | 6 | # | ||
519 | 7 | # This program is free software: you can redistribute it and/or modify | ||
520 | 8 | # it under the terms of the GNU Affero General Public License as | ||
521 | 9 | # published by the Free Software Foundation, either version 3 of the | ||
522 | 10 | # License, or (at your option) any later version. | ||
523 | 11 | # | ||
524 | 12 | # This program is distributed in the hope that it will be useful, | ||
525 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
526 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
527 | 15 | # GNU Affero General Public License for more details. | ||
528 | 16 | # | ||
529 | 17 | # You should have received a copy of the GNU Affero General Public License | ||
530 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
531 | 19 | # | ||
532 | 20 | ############################################################################## | ||
533 | 21 | from openerp.osv import orm, fields | ||
534 | 22 | |||
535 | 23 | |||
536 | 24 | class ResPartner(orm.Model): | ||
537 | 25 | _inherit = 'res.partner' | ||
538 | 26 | |||
539 | 27 | def _display_name_compute(self, cr, uid, ids, name, args, context=None): | ||
540 | 28 | return dict(self.name_get(cr, uid, ids, context=context)) | ||
541 | 29 | |||
542 | 30 | def name_get(self, cr, uid, ids, context=None): | ||
543 | 31 | """ By pass of name_get to use directly firstname and lastname | ||
544 | 32 | as we cannot ensure name as already been computed when calling this | ||
545 | 33 | method for display_name""" | ||
546 | 34 | if context is None: | ||
547 | 35 | context = {} | ||
548 | 36 | if isinstance(ids, (int, long)): | ||
549 | 37 | ids = [ids] | ||
550 | 38 | res = [] | ||
551 | 39 | for record in self.browse(cr, uid, ids, context=context): | ||
552 | 40 | names = (record.lastname, record.firstname) | ||
553 | 41 | name = u" ".join([s for s in names if s]) | ||
554 | 42 | if record.parent_id and not record.is_company: | ||
555 | 43 | name = "%s, %s" % (record.parent_id.name, name) | ||
556 | 44 | if context.get('show_address'): | ||
557 | 45 | name = name + "\n" + self._display_address(cr, uid, record, without_company=True, context=context) | ||
558 | 46 | name = name.replace('\n\n','\n') | ||
559 | 47 | name = name.replace('\n\n','\n') | ||
560 | 48 | if context.get('show_email') and record.email: | ||
561 | 49 | name = "%s <%s>" % (name, record.email) | ||
562 | 50 | res.append((record.id, name)) | ||
563 | 51 | return res | ||
564 | 52 | |||
565 | 53 | |||
566 | 54 | _display_name_store_triggers = { | ||
567 | 55 | 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]), | ||
568 | 56 | ['parent_id', 'is_company', 'name', 'firstname', 'lastname'], 10) | ||
569 | 57 | } | ||
570 | 58 | |||
571 | 59 | # indirection to avoid passing a copy of the overridable method when declaring the function field | ||
572 | 60 | _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs) | ||
573 | 61 | |||
574 | 62 | _columns = { | ||
575 | 63 | # extra field to allow ORDER BY to match visible names | ||
576 | 64 | 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers), | ||
577 | 65 | } | ||
578 | 66 | 0 | ||
579 | === removed directory 'firstname_display_name_trigger/tests' | |||
580 | === removed file 'firstname_display_name_trigger/tests/__init__.py' | |||
581 | --- firstname_display_name_trigger/tests/__init__.py 2013-05-24 11:39:16 +0000 | |||
582 | +++ firstname_display_name_trigger/tests/__init__.py 1970-01-01 00:00:00 +0000 | |||
583 | @@ -1,5 +0,0 @@ | |||
584 | 1 | import test_display_name | ||
585 | 2 | |||
586 | 3 | checks = [ | ||
587 | 4 | test_display_name | ||
588 | 5 | ] | ||
589 | 6 | 0 | ||
590 | === removed file 'firstname_display_name_trigger/tests/test_display_name.py' | |||
591 | --- firstname_display_name_trigger/tests/test_display_name.py 2013-05-24 11:39:16 +0000 | |||
592 | +++ firstname_display_name_trigger/tests/test_display_name.py 1970-01-01 00:00:00 +0000 | |||
593 | @@ -1,31 +0,0 @@ | |||
594 | 1 | import unittest2 | ||
595 | 2 | |||
596 | 3 | import openerp.tests.common as common | ||
597 | 4 | |||
598 | 5 | class test_display_name(common.TransactionCase): | ||
599 | 6 | |||
600 | 7 | def setUp(self): | ||
601 | 8 | super(test_display_name,self).setUp() | ||
602 | 9 | cr, uid = self.cr, self.uid | ||
603 | 10 | self.res_partner = self.registry('res.partner') | ||
604 | 11 | |||
605 | 12 | |||
606 | 13 | def test_00_create_res_partner(self): | ||
607 | 14 | """ Test if the display name has been correctly set """ | ||
608 | 15 | cr, uid = self.cr, self.uid | ||
609 | 16 | partner_id = self.res_partner.create(cr, uid, {'lastname': 'Lastname', 'firstname': 'Firstname', 'is_company': True}) | ||
610 | 17 | partner_records = self.res_partner.browse(cr, uid, [partner_id]) | ||
611 | 18 | p1 = partner_records[0] | ||
612 | 19 | self.assertEqual(p1.display_name, 'Lastname Firstname', 'Partner display_name incorect') | ||
613 | 20 | |||
614 | 21 | def test_01_res_partner_write_lastname(self): | ||
615 | 22 | """ Test if the display name has been correctly set """ | ||
616 | 23 | cr, uid = self.cr, self.uid | ||
617 | 24 | partner_id = self.res_partner.create(cr, uid, {'lastname': 'Lastname', 'firstname': 'Firstname', 'is_company': True}) | ||
618 | 25 | partner_records = self.res_partner.browse(cr, uid, [partner_id]) | ||
619 | 26 | p1 = partner_records[0] | ||
620 | 27 | self.res_partner.write(cr, uid, partner_id, {'lastname': 'Last'}) | ||
621 | 28 | self.assertEqual(p1.display_name, 'Last Firstname', 'Partner display_name incorect') | ||
622 | 29 | |||
623 | 30 | if __name__ == '__main__': | ||
624 | 31 | unittest2.main() | ||
625 | 32 | 0 | ||
626 | === modified file 'partner_firstname/__openerp__.py' | |||
627 | --- partner_firstname/__openerp__.py 2014-01-03 15:07:50 +0000 | |||
628 | +++ partner_firstname/__openerp__.py 2014-01-22 23:37:10 +0000 | |||
629 | @@ -18,23 +18,33 @@ | |||
630 | 18 | # | 18 | # |
631 | 19 | ############################################################################## | 19 | ############################################################################## |
632 | 20 | 20 | ||
635 | 21 | {'name': 'Partner first name, last name', | 21 | { |
636 | 22 | 'description': """Split first name and last name on res.partner. | 22 | 'name': 'Partner first name, last name', |
637 | 23 | 'description': """ | ||
638 | 24 | Split first name and last name on res.partner. | ||
639 | 25 | ============================================== | ||
640 | 23 | 26 | ||
641 | 24 | The field 'name' becomes a stored function field concatenating lastname, firstname | 27 | The field 'name' becomes a stored function field concatenating lastname, firstname |
642 | 28 | |||
643 | 29 | Contributeurs | ||
644 | 30 | ------------- | ||
645 | 31 | * El Hadji Dem (elhadji.dem@savoirfairelinux.com) | ||
646 | 32 | * Camptocamp | ||
647 | 25 | """, | 33 | """, |
662 | 26 | 'version': '1.0.1', | 34 | 'version': '1.0.1', |
663 | 27 | 'author': 'Camptocamp', | 35 | 'author': 'Camptocamp', |
664 | 28 | 'category': 'MISC', | 36 | 'category': 'MISC', |
665 | 29 | 'website': 'http://www.camptocamp.com', | 37 | 'website': 'http://www.camptocamp.com', |
666 | 30 | 'depends': ['base'], | 38 | 'depends': ['base'], |
667 | 31 | 'data': [ | 39 | 'data': [ |
668 | 32 | 'partner_view.xml', | 40 | 'partner_view.xml', |
669 | 33 | 'res_user_view.xml', | 41 | 'res_user_view.xml', |
670 | 34 | ], | 42 | ], |
671 | 35 | 'demo': [], | 43 | 'demo': [], |
672 | 36 | 'test': [], | 44 | 'test': [], |
673 | 37 | 'auto_install': False, | 45 | 'auto_install': False, |
674 | 38 | 'installable': True, | 46 | 'installable': True, |
675 | 39 | 'images': [] | 47 | 'images': [] |
676 | 40 | } | 48 | } |
677 | 49 | |||
678 | 50 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
679 | 41 | 51 | ||
680 | === modified file 'partner_firstname/partner.py' | |||
681 | --- partner_firstname/partner.py 2013-08-12 06:18:39 +0000 | |||
682 | +++ partner_firstname/partner.py 2014-01-22 23:37:10 +0000 | |||
683 | @@ -17,49 +17,68 @@ | |||
684 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
685 | 18 | # | 18 | # |
686 | 19 | ############################################################################## | 19 | ############################################################################## |
691 | 20 | from openerp.osv.orm import Model, fields | 20 | |
692 | 21 | 21 | from openerp.osv import orm, fields | |
693 | 22 | 22 | ||
694 | 23 | class ResPartner(Model): | 23 | |
695 | 24 | class res_partner(orm.Model): | ||
696 | 24 | """Adds lastname and firstname, name become a stored function field""" | 25 | """Adds lastname and firstname, name become a stored function field""" |
697 | 25 | 26 | ||
698 | 26 | _inherit = 'res.partner' | 27 | _inherit = 'res.partner' |
699 | 27 | 28 | ||
704 | 28 | def init(self, cursor): | 29 | def _display_name_compute(self, cr, uid, ids, name, args, context=None): |
705 | 29 | cursor.execute('SELECT id FROM res_partner WHERE lastname IS NOT NULL Limit 1') | 30 | return dict(self.name_get(cr, uid, ids, context=context)) |
702 | 30 | if not cursor.fetchone(): | ||
703 | 31 | cursor.execute('UPDATE res_partner set lastname = name WHERE name IS NOT NULL') | ||
706 | 32 | 31 | ||
715 | 33 | def _compute_name_custom(self, cursor, uid, ids, fname, arg, context=None): | 32 | def name_get(self, cr, uid, ids, context=None): |
716 | 34 | res = {} | 33 | """ By pass of name_get to use directly firstname and lastname |
717 | 35 | partners = self.read(cursor, uid, ids, | 34 | as we cannot ensure name as already been computed when calling this |
718 | 36 | ['firstname', 'lastname'], context=context) | 35 | method for display_name""" |
719 | 37 | for rec in partners: | 36 | if context is None: |
720 | 38 | names = (rec['lastname'], rec['firstname']) | 37 | context = {} |
721 | 39 | fullname = " ".join([s for s in names if s]) | 38 | if isinstance(ids, (int, long)): |
722 | 40 | res[rec['id']] = fullname | 39 | ids = [ids] |
723 | 40 | res = [] | ||
724 | 41 | for record in self.browse(cr, uid, ids, context=context): | ||
725 | 42 | names = (record.firstname, record.name) | ||
726 | 43 | name = u" ".join([s for s in names if s]) | ||
727 | 44 | if record.parent_id and not record.is_company: | ||
728 | 45 | name = "%s, %s" % (record.parent_id.name, name) | ||
729 | 46 | if context.get('show_address'): | ||
730 | 47 | name = name + "\n" + self._display_address(cr, uid, record, without_company=True, context=context) | ||
731 | 48 | name = name.replace('\n\n', '\n') | ||
732 | 49 | name = name.replace('\n\n', '\n') | ||
733 | 50 | if context.get('show_email') and record.email: | ||
734 | 51 | name = "%s <%s>" % (name, record.email) | ||
735 | 52 | res.append((record.id, name)) | ||
736 | 41 | return res | 53 | return res |
737 | 42 | 54 | ||
761 | 43 | def _write_name(self, cursor, uid, partner_id, field_name, field_value, arg, context=None): | 55 | def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): |
762 | 44 | return self.write(cursor, uid, partner_id, | 56 | if args is None: |
763 | 45 | {'lastname': field_value}, context=context) | 57 | args = [] |
764 | 46 | 58 | if context is None: | |
765 | 47 | def create(self, cursor, uid, vals, context=None): | 59 | context = {} |
766 | 48 | """To support data backward compatibility we have to keep this overwrite even if we | 60 | if name: |
767 | 49 | use fnct_inv: otherwise we can't create entry because lastname is mandatory and module | 61 | ids = self.search(cr, uid, [('full_name', operator, name)] + args, limit=limit, context=context) |
768 | 50 | will not install if there is demo data""" | 62 | else: |
769 | 51 | to_use = vals | 63 | ids = self.search(cr, uid, args, limit=limit, context=context or {}) |
770 | 52 | if vals.get('name'): | 64 | return self.name_get(cr, uid, ids, context=context) |
771 | 53 | corr_vals = vals.copy() | 65 | |
772 | 54 | corr_vals['lastname'] = corr_vals['name'] | 66 | def get_full_name(self, cr, uid, ids, field_name, arg, context=None): |
773 | 55 | del(corr_vals['name']) | 67 | return dict(self.name_get(cr, uid, ids, context=context)) |
774 | 56 | to_use = corr_vals | 68 | |
775 | 57 | return super(ResPartner, self).create(cursor, uid, to_use, context=context) | 69 | _display_name_store_triggers = { |
776 | 58 | 70 | 'res.partner': (lambda self, cr, uid, ids, context=None: self.search(cr, uid, [('id', 'child_of', ids)]), | |
777 | 59 | _columns = {'name': fields.function(_compute_name_custom, string="Name", | 71 | ['parent_id', 'is_company', 'name', 'firstname'], 10) |
778 | 60 | type="char", store=True, | 72 | } |
779 | 61 | select=True, readonly=True, | 73 | |
780 | 62 | fnct_inv=_write_name), | 74 | # indirection to avoid passing a copy of the overridable method when declaring the function field |
781 | 63 | 75 | _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs) | |
782 | 64 | 'firstname': fields.char("Firstname"), | 76 | |
783 | 65 | 'lastname': fields.char("Lastname", required=True)} | 77 | _columns = { |
784 | 78 | 'full_name': fields.function(_display_name, type='char', | ||
785 | 79 | string='Full name', | ||
786 | 80 | store=_display_name_store_triggers, | ||
787 | 81 | help="First name."), | ||
788 | 82 | 'firstname': fields.char("First name", help="First name.") | ||
789 | 83 | } | ||
790 | 84 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
791 | 66 | 85 | ||
792 | === modified file 'partner_firstname/partner_view.xml' | |||
793 | --- partner_firstname/partner_view.xml 2013-11-13 16:18:13 +0000 | |||
794 | +++ partner_firstname/partner_view.xml 2014-01-22 23:37:10 +0000 | |||
795 | @@ -1,51 +1,54 @@ | |||
796 | 1 | <openerp> | 1 | <openerp> |
797 | 2 | <data> | 2 | <data> |
798 | 3 | <record id="view_partner_simple_form_firstname" model="ir.ui.view"> | ||
799 | 4 | <field name="name">res.partner.simplified.form.firstname</field> | ||
800 | 5 | <field name="model">res.partner</field> | ||
801 | 6 | <field name="inherit_id" ref="base.view_partner_simple_form"/> | ||
802 | 7 | <field name="arch" type="xml"> | ||
803 | 8 | <field name="name" position="attributes"> | ||
804 | 9 | <attribute name="attrs">{'readonly': [('is_company', '=', False)], 'required': [('is_company', '=', True)]}</attribute> | ||
805 | 10 | </field> | ||
806 | 11 | <field name="category_id" position="before"> | ||
807 | 12 | <group attrs="{'invisible': [('is_company', '=', True)]}"> | ||
808 | 13 | <field name="lastname" attrs="{'required': [('is_company', '=', False)]}"/> | ||
809 | 14 | <field name="firstname" /> | ||
810 | 15 | </group> | ||
811 | 16 | </field> | ||
812 | 17 | </field> | ||
813 | 18 | </record> | ||
814 | 19 | 3 | ||
815 | 20 | <record id="view_partner_form_firstname" model="ir.ui.view"> | 4 | <record id="view_partner_form_firstname" model="ir.ui.view"> |
816 | 21 | <field name="name">res.partner.form.firstname</field> | 5 | <field name="name">res.partner.form.firstname</field> |
817 | 22 | <field name="model">res.partner</field> | 6 | <field name="model">res.partner</field> |
818 | 23 | <field name="inherit_id" ref="base.view_partner_form"/> | 7 | <field name="inherit_id" ref="base.view_partner_form"/> |
819 | 24 | <field name="arch" type="xml"> | 8 | <field name="arch" type="xml"> |
823 | 25 | <field name="name" position="attributes"> | 9 | <field name="name" position="replace"/> |
821 | 26 | <attribute name="attrs">{'readonly': [('is_company', '=', False)], 'required': [('is_company', '=', True)]}</attribute> | ||
822 | 27 | </field> | ||
824 | 28 | <field name="category_id" position="before"> | 10 | <field name="category_id" position="before"> |
825 | 29 | <group attrs="{'invisible': [('is_company', '=', True)]}"> | 11 | <group attrs="{'invisible': [('is_company', '=', True)]}"> |
828 | 30 | <field name="lastname" attrs="{'required': [('is_company', '=', False)]}"/> | 12 | <field name="firstname" attrs="{'required': [('is_company', '=', False)]}"/> |
829 | 31 | <field name="firstname"/> | 13 | </group> |
830 | 14 | <group> | ||
831 | 15 | <field name="name" position="attributes"> | ||
832 | 16 | <attribute name="attrs">{'readonly': [('is_company', '=', False)], 'required': [('is_company', '=', True)]}</attribute> | ||
833 | 17 | </field> | ||
834 | 32 | </group> | 18 | </group> |
835 | 33 | </field> | 19 | </field> |
840 | 34 | <!-- Add firstname and last name in inner contact form of child_ids --> | 20 | |
841 | 35 | <xpath expr="//form[@string='Contact']/sheet/div" position="after"> | 21 | <!-- Add first name and name in inner contact form of child_ids --> |
842 | 36 | <group attrs="{'invisible': [('is_company', '=', True)]}"> | 22 | <xpath expr="//form[@string='Contact']/sheet/div/h1/field[@name='name']" position="replace"/> |
843 | 37 | <field name="lastname" attrs="{'required': [('is_company', '=', False)]}"/> | 23 | <xpath expr="//form[@string='Contact']/sheet/div/label" position="after"> |
844 | 24 | <group> | ||
845 | 38 | <field name="firstname"/> | 25 | <field name="firstname"/> |
854 | 39 | </group> | 26 | <field name="name"/> |
855 | 40 | </xpath> | 27 | </group> |
856 | 41 | <xpath expr="//form[@string='Contact']/sheet/div/h1" position="after"> | 28 | </xpath> |
857 | 42 | <field name="is_company" on_change="onchange_type(is_company)" class="oe_inline"/> | 29 | |
858 | 43 | <label for="is_company" string="Is a Company?"/>) | 30 | <label for="name" position="attributes"> |
859 | 44 | </xpath> | 31 | <attribute name="invisible">1</attribute> |
860 | 45 | 32 | </label> | |
861 | 46 | 33 | <!-- Add first name and name in inner contact kanban view --> | |
862 | 34 | <xpath expr="//t[@t-name='kanban-box']//div[@class='oe_module_desc']//field[@name='name']" position="replace"> | ||
863 | 35 | <field name="firstname"/> | ||
864 | 36 | <field name="name"/> | ||
865 | 37 | </xpath> | ||
866 | 47 | </field> | 38 | </field> |
867 | 48 | </record> | 39 | </record> |
868 | 40 | <!-- Search view with full name--> | ||
869 | 41 | <record id="view_res_partner_filter_firstname" model="ir.ui.view"> | ||
870 | 42 | <field name="name">res.partner.select</field> | ||
871 | 43 | <field name="model">res.partner</field> | ||
872 | 44 | <field name="inherit_id" ref="base.view_res_partner_filter"/> | ||
873 | 45 | <field name="arch" type="xml"> | ||
874 | 46 | <field name="name" position="replace"> | ||
875 | 47 | <field name="name" | ||
876 | 48 | filter_domain="['|','|',('full_name','ilike',self),('parent_id','ilike',self),('ref','=',self)]"/> | ||
877 | 49 | </field> | ||
878 | 50 | </field> | ||
879 | 51 | </record> | ||
880 | 49 | 52 | ||
881 | 50 | </data> | 53 | </data> |
882 | 51 | </openerp> | 54 | </openerp> |
883 | 52 | 55 | ||
884 | === modified file 'partner_firstname/res_user.py' | |||
885 | --- partner_firstname/res_user.py 2013-02-20 14:00:17 +0000 | |||
886 | +++ partner_firstname/res_user.py 2014-01-22 23:37:10 +0000 | |||
887 | @@ -17,10 +17,11 @@ | |||
888 | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
889 | 18 | # | 18 | # |
890 | 19 | ############################################################################## | 19 | ############################################################################## |
895 | 20 | from openerp.osv import orm | 20 | |
896 | 21 | 21 | from openerp.osv import orm, fields | |
897 | 22 | 22 | ||
898 | 23 | class ResUsers(orm.Model): | 23 | |
899 | 24 | class res_user(orm.Model): | ||
900 | 24 | """Allows user creation from user form as | 25 | """Allows user creation from user form as |
901 | 25 | name is not in form""" | 26 | name is not in form""" |
902 | 26 | 27 | ||
903 | @@ -29,4 +30,4 @@ | |||
904 | 29 | def create(self, cursor, uid, vals, context=None): | 30 | def create(self, cursor, uid, vals, context=None): |
905 | 30 | if not vals.get('name'): | 31 | if not vals.get('name'): |
906 | 31 | vals['name'] = vals['login'] | 32 | vals['name'] = vals['login'] |
908 | 32 | return super(ResUsers, self).create(cursor, uid, vals, context=context) | 33 | return super(res_user, self).create(cursor, uid, vals, context=context) |