Merge lp:~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules into lp:~partner-contact-core-editors/partner-contact-management/7.0

Status: Needs review
Proposed branch: lp:~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules
Merge into: lp:~partner-contact-core-editors/partner-contact-management/7.0
Diff against target: 2416 lines (+2295/-0)
23 files modified
base_contact_by_functions/__init__.py (+27/-0)
base_contact_by_functions/__openerp__.py (+56/-0)
base_contact_by_functions/functions.py (+41/-0)
base_contact_by_functions/functions_view.xml (+38/-0)
base_contact_by_functions/i18n/base_contact_by_functions.pot (+353/-0)
base_contact_by_functions/i18n/fr.po (+353/-0)
base_contact_by_functions/res_institutions.py (+49/-0)
base_contact_by_functions/res_institutions_view.xml (+55/-0)
base_contact_by_functions/res_partner.py (+102/-0)
base_contact_by_functions/res_partner_view.xml (+526/-0)
base_contact_by_functions/security/ir.model.access.csv (+5/-0)
base_contact_by_functions/tests/__init__.py (+31/-0)
base_contact_by_functions/tests/test_functions.py (+98/-0)
base_contact_by_functions/tests/test_institutions.py (+99/-0)
base_contact_by_functions/tests/test_partner_category.py (+105/-0)
base_contact_by_functions_partner_firstname/__init__.py (+25/-0)
base_contact_by_functions_partner_firstname/__openerp__.py (+53/-0)
base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot (+27/-0)
base_contact_by_functions_partner_firstname/i18n/fr.po (+27/-0)
base_contact_by_functions_partner_firstname/res_partner.py (+76/-0)
base_contact_by_functions_partner_firstname/res_partner_view.xml (+71/-0)
base_contact_by_functions_partner_firstname/tests/__init__.py (+27/-0)
base_contact_by_functions_partner_firstname/tests/test_partner.py (+51/-0)
To merge this branch: bzr merge lp:~savoirfairelinux-openerp/partner-contact-management/partner-contact-management-base_contact_add_modules
Reviewer Review Type Date Requested Status
Lorenzo Battistini - Agile BG (community) Resubmit on 2014-07-23
Stefan Rijnhart (Opener) 2014-04-30 Needs Information on 2014-07-17
Sandy Carter (http://www.savoirfairelinux.com) Abstain on 2014-04-30
Review via email: mp+217775@code.launchpad.net

This proposal supersedes a proposal from 2014-01-30.

Description of the change

- [ADD] added base_contact_by_functions module: It allow to manage contacts by function"
- [ADD] Added base_contact_by_functions_partner_firstname module: It allows to add firstname before name.Name is considered like the lastname and we have firstname and lastname on partner view and contact view."
The base_contact_by_functions_partner_firstname module depends on partner_firstname and base_contact_by_functions module.

To post a comment you must log in.
review: Approve

I have a hard time trying to find out what this module actually does. The manifest description is very terse. The name of the module reminds me of base_contact, which allowed multiple connections between the same person and a company. Is this module similar? The description should at least explain what 'institutions' are (a concept that this module introduces).

Terminology is off at times, it seems. l.130: 'acronym': is this abbreviation, or maybe stick to the standard 'code' field name and label?

Organism: I'm guessing you mean organization. But in any case, changing the 'company' terminology should be split off as a separate module.

The translations seem to contain obsolete terms, e.g. l.241 and other occurrences of 'passport'.

review: Needs Information

This is for cases where one partner (Mike Fletcher President of Agrolait) can be part of another company (Mike Fletcher VP of AsusTEK) in a different function.

The module helps track these functions.

This project is now hosted on https://github.com/OCA/partner-contact. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Resubmit

Unmerged revisions

46. By Sandy Carter (http://www.savoirfairelinux.com) on 2014-04-23

Fix KeyError which sometimes arises when installing modules.

Assert that contact_id exists in vals

45. By Sandy Carter (http://www.savoirfairelinux.com) on 2014-03-12

Fix error when creating partner with contact info

44. By Sandy Carter (http://www.savoirfairelinux.com) on 2014-03-03

adapt module for community firstname module

43. By El Hadji Dem (http://www.savoirfairelinux.com) on 2014-02-14

[IMP] is_company field is True by default and replace Organism by Parent Organism in form view

42. By El Hadji Dem (http://www.savoirfairelinux.com) on 2014-01-30

[ADD] added base_contact_by_functions_partner_firstname module: It allows to add firstname before name.Name is considered like the lastname and we have firstname and lastname on partner view and contact view.

41. By El Hadji Dem (http://www.savoirfairelinux.com) on 2014-01-30

[ADD] added base_contact_by_functions module: It allow to manage contacts by function

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'base_contact_by_functions'
2=== added file 'base_contact_by_functions/__init__.py'
3--- base_contact_by_functions/__init__.py 1970-01-01 00:00:00 +0000
4+++ base_contact_by_functions/__init__.py 2014-04-30 15:00:54 +0000
5@@ -0,0 +1,27 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# This module copyright (C) 2013 Savoir-faire Linux
11+# (<http://www.savoirfairelinux.com>).
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+
28+from . import res_partner
29+from . import functions
30+from . import res_institutions
31+
32+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
33
34=== added file 'base_contact_by_functions/__openerp__.py'
35--- base_contact_by_functions/__openerp__.py 1970-01-01 00:00:00 +0000
36+++ base_contact_by_functions/__openerp__.py 2014-04-30 15:00:54 +0000
37@@ -0,0 +1,56 @@
38+# -*- encoding: utf-8 -*-
39+##############################################################################
40+#
41+# OpenERP, Open Source Management Solution
42+# This module copyright (C) 2013 Savoir-faire Linux
43+# (<http://www.savoirfairelinux.com>).
44+#
45+# This program is free software: you can redistribute it and/or modify
46+# it under the terms of the GNU Affero General Public License as
47+# published by the Free Software Foundation, either version 3 of the
48+# License, or (at your option) any later version.
49+#
50+# This program is distributed in the hope that it will be useful,
51+# but WITHOUT ANY WARRANTY; without even the implied warranty of
52+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53+# GNU Affero General Public License for more details.
54+#
55+# You should have received a copy of the GNU Affero General Public License
56+# along with this program. If not, see <http://www.gnu.org/licenses/>.
57+#
58+##############################################################################
59+
60+{
61+ 'name': 'Contacts by Functions',
62+ 'version': '0.1',
63+ 'author': 'Savoir-faire Linux',
64+ 'maintainer': 'Savoir-faire Linux',
65+ 'website': 'http://www.savoirfairelinux.com',
66+ 'category': 'Customer Relationship Management',
67+ 'description': """
68+Contacts by Functions
69+=====================
70+
71+This module allows you to manage contacts by functions
72+
73+Contributors
74+------------
75+* EL Hadji Dem (elhadji.dem@savoirfairelinux.com)
76+""",
77+ 'depends': [
78+ 'base_contact',
79+ ],
80+ 'external_dependencies': {},
81+ 'data': [
82+ 'functions_view.xml',
83+ 'res_institutions_view.xml',
84+ 'res_partner_view.xml',
85+ 'security/ir.model.access.csv',
86+ ],
87+ 'demo': [],
88+ 'test': [],
89+ 'installable': True,
90+ 'active': False,
91+}
92+
93+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
94
95=== added file 'base_contact_by_functions/functions.py'
96--- base_contact_by_functions/functions.py 1970-01-01 00:00:00 +0000
97+++ base_contact_by_functions/functions.py 2014-04-30 15:00:54 +0000
98@@ -0,0 +1,41 @@
99+# -*- encoding: utf-8 -*-
100+##############################################################################
101+#
102+# OpenERP, Open Source Management Solution
103+# This module copyright (C) 2013 Savoir-faire Linux
104+# (<http://www.savoirfairelinux.com>).
105+#
106+# This program is free software: you can redistribute it and/or modify
107+# it under the terms of the GNU Affero General Public License as
108+# published by the Free Software Foundation, either version 3 of the
109+# License, or (at your option) any later version.
110+#
111+# This program is distributed in the hope that it will be useful,
112+# but WITHOUT ANY WARRANTY; without even the implied warranty of
113+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114+# GNU Affero General Public License for more details.
115+#
116+# You should have received a copy of the GNU Affero General Public License
117+# along with this program. If not, see <http://www.gnu.org/licenses/>.
118+#
119+##############################################################################
120+
121+from openerp.osv import fields, orm
122+
123+
124+class functions(orm.Model):
125+ _description = 'Functions'
126+ _name = 'functions'
127+ _columns = {
128+ 'name': fields.char('Name', size=256, required=True, select=True,
129+ help='Name of function.'),
130+ 'acronym': fields.char('Acronym', size=50, help='Acronym of function.'),
131+ 'partner_ids': fields.many2many('res.partner',
132+ 'function_partner_rel',
133+ 'function_id',
134+ 'partner_id',
135+ 'Functions'),
136+ 'institution_id': fields.many2one("res.institution", 'institution'),
137+ }
138+
139+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
140
141=== added file 'base_contact_by_functions/functions_view.xml'
142--- base_contact_by_functions/functions_view.xml 1970-01-01 00:00:00 +0000
143+++ base_contact_by_functions/functions_view.xml 2014-04-30 15:00:54 +0000
144@@ -0,0 +1,38 @@
145+<?xml version="1.0" ?>
146+<openerp>
147+ <data>
148+ <!-- Tree Views functions-->
149+ <record model="ir.ui.view" id="functions_tree_view">
150+ <field name="name">Functions Tree View</field>
151+ <field name="model">functions</field>
152+ <field name="type">tree</field>
153+ <field name="arch" type="xml">
154+ <tree string="FunctionsTree" version="7.0">
155+ <field name="name"/>
156+ <field name="acronym"/>
157+ </tree>
158+ </field>
159+ </record>
160+ <!-- Form Views functions-->
161+ <record model="ir.ui.view" id="functions_form_view">
162+ <field name="name">Functions Form View</field>
163+ <field name="model">functions</field>
164+ <field name="type">form</field>
165+ <field name="arch" type="xml">
166+ <form string="FunctionsForm" version="7.0" >
167+ <group col="4">
168+ <field name="name"/>
169+ <field name="acronym"/>
170+ </group>
171+ </form>
172+ </field>
173+ </record>
174+ <!-- Actions -->
175+ <record model="ir.actions.act_window" id="action_functions_tree_list">
176+ <field name="name">Functions</field>
177+ <field name="view_id" ref="functions_tree_view"/>
178+ <field name="res_model">functions</field>
179+ <field name="view_mode">tree,form</field>
180+ </record>
181+ </data>
182+</openerp>
183
184=== added directory 'base_contact_by_functions/i18n'
185=== added file 'base_contact_by_functions/i18n/base_contact_by_functions.pot'
186--- base_contact_by_functions/i18n/base_contact_by_functions.pot 1970-01-01 00:00:00 +0000
187+++ base_contact_by_functions/i18n/base_contact_by_functions.pot 2014-04-30 15:00:54 +0000
188@@ -0,0 +1,353 @@
189+# Translation of OpenERP Server.
190+# This file contains the translation of the following modules:
191+# * base_contact_by_functions
192+#
193+msgid ""
194+msgstr ""
195+"Project-Id-Version: OpenERP Server 7.0\n"
196+"Report-Msgid-Bugs-To: \n"
197+"POT-Creation-Date: 2014-01-28 22:15+0000\n"
198+"PO-Revision-Date: 2014-01-28 17:15-0500\n"
199+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
200+"Language-Team: \n"
201+"MIME-Version: 1.0\n"
202+"Content-Type: text/plain; charset=UTF-8\n"
203+"Content-Transfer-Encoding: 8bit\n"
204+"Plural-Forms: \n"
205+"X-Generator: Poedit 1.5.4\n"
206+
207+#. module: base_contact_by_functions
208+#: field:res.category.functions,category_id:0
209+msgid "Category"
210+msgstr ""
211+
212+#. module: base_contact_by_functions
213+#: view:res.partner:0
214+msgid "City"
215+msgstr ""
216+
217+#. module: base_contact_by_functions
218+#: field:functions,partner_ids:0
219+#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
220+#: model:ir.model,name:base_contact_by_functions.model_functions
221+#: field:res.category.functions,functions_id:0 view:res.institution:0
222+#: field:res.institution,institutionfunction_ids:0
223+#: field:res.institution.functions,functions_id:0 view:res.partner:0
224+#: field:res.partner,functions_ids:0 view:res.partner.category:0
225+#: field:res.partner.category,categoryfunction_ids:0
226+msgid "Functions"
227+msgstr ""
228+
229+#. module: base_contact_by_functions
230+#: view:res.partner:0
231+msgid "History (Functions)"
232+msgstr ""
233+
234+#. module: base_contact_by_functions
235+#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
236+msgid "Institutions functions"
237+msgstr ""
238+
239+#. module: base_contact_by_functions
240+#: help:res.partner,delivered_country:0
241+msgid "Country for which a passport is delivered"
242+msgstr ""
243+
244+#. module: base_contact_by_functions
245+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
246+msgid "Contacts"
247+msgstr ""
248+
249+#. module: base_contact_by_functions
250+#: view:res.partner:0
251+msgid "Street..."
252+msgstr ""
253+
254+#. module: base_contact_by_functions
255+#: view:res.institution:0
256+msgid "Add functions for this institution"
257+msgstr ""
258+
259+#. module: base_contact_by_functions
260+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
261+msgid "FunctionsTree"
262+msgstr ""
263+
264+#. module: base_contact_by_functions
265+#: sql_constraint:res.institution:0
266+msgid "Name already exists"
267+msgstr ""
268+
269+#. module: base_contact_by_functions
270+#: view:res.partner:0
271+msgid "State"
272+msgstr ""
273+
274+#. module: base_contact_by_functions
275+#: help:res.category.functions,sequence:0
276+#: help:res.institution.functions,sequence:0
277+msgid "Used to order"
278+msgstr ""
279+
280+#. module: base_contact_by_functions
281+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
282+msgid "FunctionsForm"
283+msgstr ""
284+
285+#. module: base_contact_by_functions
286+#: view:res.partner:0
287+msgid "e.g. Sales Director"
288+msgstr ""
289+
290+#. module: base_contact_by_functions
291+#: help:functions,acronym:0
292+msgid "Acronym of function."
293+msgstr ""
294+
295+#. module: base_contact_by_functions
296+#: view:res.partner:0
297+msgid "Tags..."
298+msgstr ""
299+
300+#. module: base_contact_by_functions
301+#: field:res.partner,start_date:0
302+msgid "Start date"
303+msgstr ""
304+
305+#. module: base_contact_by_functions
306+#: view:res.institution:0
307+msgid "InstitutionsForm"
308+msgstr ""
309+
310+#. module: base_contact_by_functions
311+#: view:res.partner:0
312+msgid "Fax:"
313+msgstr ""
314+
315+#. module: base_contact_by_functions
316+#: field:res.partner,expiration_date:0
317+msgid "Expiration date"
318+msgstr ""
319+
320+#. module: base_contact_by_functions
321+#: view:res.partner:0
322+msgid "Function"
323+msgstr ""
324+
325+#. module: base_contact_by_functions
326+#: view:res.partner:0
327+msgid "Parent Organism"
328+msgstr ""
329+
330+#. module: base_contact_by_functions
331+#: view:res.partner:0
332+msgid "Zip"
333+msgstr ""
334+
335+#. module: base_contact_by_functions
336+#: field:res.partner,delivered_country:0
337+msgid "Country Passport"
338+msgstr ""
339+
340+#. module: base_contact_by_functions
341+#: field:res.partner,other_contact_history_ids:0
342+msgid "unknown"
343+msgstr ""
344+
345+#. module: base_contact_by_functions
346+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
347+msgid "Company"
348+msgstr ""
349+
350+#. module: base_contact_by_functions
351+#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
352+msgid "Categories functions"
353+msgstr ""
354+
355+#. module: base_contact_by_functions
356+#: help:res.institution,name:0
357+msgid "Name of institution."
358+msgstr ""
359+
360+#. module: base_contact_by_functions
361+#: help:res.partner,naming:0
362+msgid "Naming."
363+msgstr ""
364+
365+#. module: base_contact_by_functions
366+#: view:res.partner:0
367+msgid "Tag"
368+msgstr ""
369+
370+#. module: base_contact_by_functions
371+#: view:res.partner:0
372+msgid "Passport information"
373+msgstr ""
374+
375+#. module: base_contact_by_functions
376+#: view:res.partner:0
377+msgid "Address"
378+msgstr ""
379+
380+#. module: base_contact_by_functions
381+#: view:res.partner:0
382+msgid "Parent organism"
383+msgstr ""
384+
385+#. module: base_contact_by_functions
386+#: view:res.partner:0
387+msgid "have the same form for contact and other postions"
388+msgstr ""
389+
390+#. module: base_contact_by_functions
391+#: view:res.partner:0
392+msgid "Select functions for this organism"
393+msgstr ""
394+
395+#. module: base_contact_by_functions
396+#: view:res.partner:0
397+msgid "Phone:"
398+msgstr ""
399+
400+#. module: base_contact_by_functions
401+#: field:functions,name:0 field:res.institution,name:0
402+msgid "Name"
403+msgstr ""
404+
405+#. module: base_contact_by_functions
406+#: view:res.partner:0
407+msgid "ZIP"
408+msgstr ""
409+
410+#. module: base_contact_by_functions
411+#: view:res.partner:0
412+msgid "Use organism address"
413+msgstr ""
414+
415+#. module: base_contact_by_functions
416+#: view:res.partner:0
417+msgid "Country"
418+msgstr ""
419+
420+#. module: base_contact_by_functions
421+#: field:functions,institution_id:0
422+msgid "institution"
423+msgstr ""
424+
425+#. module: base_contact_by_functions
426+#: view:res.partner:0
427+msgid "Is an Organism"
428+msgstr ""
429+
430+#. module: base_contact_by_functions
431+#: field:res.partner,function_id:0
432+msgid "Position Occupied"
433+msgstr ""
434+
435+#. module: base_contact_by_functions
436+#: view:res.partner:0
437+msgid "Contact"
438+msgstr ""
439+
440+#. module: base_contact_by_functions
441+#: help:res.institution,sequence:0
442+msgid "Used to order the institutions"
443+msgstr ""
444+
445+#. module: base_contact_by_functions
446+#: view:res.partner:0
447+msgid "Mobile:"
448+msgstr ""
449+
450+#. module: base_contact_by_functions
451+#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
452+msgid "Partner Categories"
453+msgstr ""
454+
455+#. module: base_contact_by_functions
456+#: view:res.partner:0
457+msgid "Organism"
458+msgstr ""
459+
460+#. module: base_contact_by_functions
461+#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
462+#: model:ir.model,name:base_contact_by_functions.model_res_institution
463+#: field:res.institution.functions,institution_id:0
464+msgid "Institutions"
465+msgstr ""
466+
467+#. module: base_contact_by_functions
468+#: view:res.partner:0
469+msgid "History"
470+msgstr ""
471+
472+#. module: base_contact_by_functions
473+#: field:res.partner,end_date:0
474+msgid "End date"
475+msgstr ""
476+
477+#. module: base_contact_by_functions
478+#: view:res.partner.category:0
479+msgid "Add function"
480+msgstr ""
481+
482+#. module: base_contact_by_functions
483+#: view:res.partner:0
484+msgid "Bank Details"
485+msgstr ""
486+
487+#. module: base_contact_by_functions
488+#: view:res.institution:0
489+msgid "InstitutionsTree"
490+msgstr ""
491+
492+#. module: base_contact_by_functions
493+#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
494+#: field:res.institution.functions,sequence:0
495+msgid "Sequence"
496+msgstr ""
497+
498+#. module: base_contact_by_functions
499+#: view:res.partner:0
500+msgid "Bank Accounts"
501+msgstr ""
502+
503+#. module: base_contact_by_functions
504+#: view:res.partner:0
505+msgid "No, Street, Apartment/Office"
506+msgstr ""
507+
508+#. module: base_contact_by_functions
509+#: view:res.partner:0
510+msgid "Use address organism"
511+msgstr ""
512+
513+#. module: base_contact_by_functions
514+#: field:functions,acronym:0
515+msgid "Acronym"
516+msgstr ""
517+
518+#. module: base_contact_by_functions
519+#: help:functions,name:0
520+msgid "Name of function."
521+msgstr ""
522+
523+#. module: base_contact_by_functions
524+#: help:res.partner,passport_number:0
525+msgid "Passport number."
526+msgstr ""
527+
528+#. module: base_contact_by_functions
529+#: field:res.partner,passport_number:0
530+msgid "Passport Number"
531+msgstr ""
532+
533+#. module: base_contact_by_functions
534+#: model:ir.model,name:base_contact_by_functions.model_res_partner
535+msgid "Partner"
536+msgstr ""
537+
538+#. module: base_contact_by_functions
539+#: field:res.partner,naming:0
540+msgid "Naming"
541+msgstr ""
542
543=== added file 'base_contact_by_functions/i18n/fr.po'
544--- base_contact_by_functions/i18n/fr.po 1970-01-01 00:00:00 +0000
545+++ base_contact_by_functions/i18n/fr.po 2014-04-30 15:00:54 +0000
546@@ -0,0 +1,353 @@
547+# Translation of OpenERP Server.
548+# This file contains the translation of the following modules:
549+# * base_contact_by_functions
550+#
551+msgid ""
552+msgstr ""
553+"Project-Id-Version: OpenERP Server 7.0\n"
554+"Report-Msgid-Bugs-To: \n"
555+"POT-Creation-Date: 2014-01-29 15:16+0000\n"
556+"PO-Revision-Date: 2014-01-29 10:19-0500\n"
557+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
558+"Language-Team: \n"
559+"MIME-Version: 1.0\n"
560+"Content-Type: text/plain; charset=UTF-8\n"
561+"Content-Transfer-Encoding: 8bit\n"
562+"Plural-Forms: \n"
563+"X-Generator: Poedit 1.5.4\n"
564+
565+#. module: base_contact_by_functions
566+#: field:res.category.functions,category_id:0
567+msgid "Category"
568+msgstr "Catégorie"
569+
570+#. module: base_contact_by_functions
571+#: view:res.partner:0
572+msgid "City"
573+msgstr "Ville"
574+
575+#. module: base_contact_by_functions
576+#: field:functions,partner_ids:0
577+#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
578+#: model:ir.model,name:base_contact_by_functions.model_functions
579+#: field:res.category.functions,functions_id:0 view:res.institution:0
580+#: field:res.institution,institutionfunction_ids:0
581+#: field:res.institution.functions,functions_id:0 view:res.partner:0
582+#: field:res.partner,functions_ids:0 view:res.partner.category:0
583+#: field:res.partner.category,categoryfunction_ids:0
584+msgid "Functions"
585+msgstr "Fonctions"
586+
587+#. module: base_contact_by_functions
588+#: view:res.partner:0
589+msgid "History (Functions)"
590+msgstr "Historique (Fonctions)"
591+
592+#. module: base_contact_by_functions
593+#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
594+msgid "Institutions functions"
595+msgstr "Fonctions des institutions"
596+
597+#. module: base_contact_by_functions
598+#: help:res.partner,delivered_country:0
599+msgid "Country for which a passport is delivered"
600+msgstr "Pays pour lequel le passeport est délivré"
601+
602+#. module: base_contact_by_functions
603+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
604+msgid "Contacts"
605+msgstr "Contacts"
606+
607+#. module: base_contact_by_functions
608+#: view:res.partner:0
609+msgid "Street..."
610+msgstr "Rue..."
611+
612+#. module: base_contact_by_functions
613+#: view:res.institution:0
614+msgid "Add functions for this institution"
615+msgstr "Ajouter des fonctions de cette institution"
616+
617+#. module: base_contact_by_functions
618+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
619+msgid "FunctionsTree"
620+msgstr "FonctionsTree"
621+
622+#. module: base_contact_by_functions
623+#: sql_constraint:res.institution:0
624+msgid "Name already exists"
625+msgstr "Le nom existe déjà"
626+
627+#. module: base_contact_by_functions
628+#: view:res.partner:0
629+msgid "State"
630+msgstr "Etat"
631+
632+#. module: base_contact_by_functions
633+#: help:res.category.functions,sequence:0
634+#: help:res.institution.functions,sequence:0
635+msgid "Used to order"
636+msgstr "Permet d'ordonner"
637+
638+#. module: base_contact_by_functions
639+#: view:functions:0 view:res.institution:0 view:res.partner.category:0
640+msgid "FunctionsForm"
641+msgstr "FonctionsForm"
642+
643+#. module: base_contact_by_functions
644+#: view:res.partner:0
645+msgid "e.g. Sales Director"
646+msgstr "ex: Directeur de vente"
647+
648+#. module: base_contact_by_functions
649+#: help:functions,acronym:0
650+msgid "Acronym of function."
651+msgstr "Acronyme de la fonction."
652+
653+#. module: base_contact_by_functions
654+#: view:res.partner:0
655+msgid "Tags..."
656+msgstr "Etiquettes..."
657+
658+#. module: base_contact_by_functions
659+#: field:res.partner,start_date:0
660+msgid "Start date"
661+msgstr "Date de début"
662+
663+#. module: base_contact_by_functions
664+#: view:res.institution:0
665+msgid "InstitutionsForm"
666+msgstr "InstitutionsForm"
667+
668+#. module: base_contact_by_functions
669+#: view:res.partner:0
670+msgid "Fax:"
671+msgstr "Télécopie :"
672+
673+#. module: base_contact_by_functions
674+#: field:res.partner,expiration_date:0
675+msgid "Expiration date"
676+msgstr "Date d'expiration"
677+
678+#. module: base_contact_by_functions
679+#: view:res.partner:0
680+msgid "Function"
681+msgstr "Fonction"
682+
683+#. module: base_contact_by_functions
684+#: view:res.partner:0
685+msgid "Fax"
686+msgstr "Télécopie"
687+
688+#. module: base_contact_by_functions
689+#: view:res.partner:0
690+msgid "Parent Organism"
691+msgstr "Organisme parent"
692+
693+#. module: base_contact_by_functions
694+#: field:res.partner,delivered_country:0
695+msgid "Country Passport"
696+msgstr "Pays de délivrance du passeport"
697+
698+#. module: base_contact_by_functions
699+#: field:res.partner,other_contact_history_ids:0
700+msgid "unknown"
701+msgstr "inconnu"
702+
703+#. module: base_contact_by_functions
704+#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
705+msgid "Company"
706+msgstr "Organisme"
707+
708+#. module: base_contact_by_functions
709+#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
710+msgid "Categories functions"
711+msgstr "Catégories functions"
712+
713+#. module: base_contact_by_functions
714+#: help:res.institution,name:0
715+msgid "Name of institution."
716+msgstr "Nom de l'institution."
717+
718+#. module: base_contact_by_functions
719+#: help:res.partner,naming:0
720+msgid "Naming."
721+msgstr "Appellation"
722+
723+#. module: base_contact_by_functions
724+#: view:res.partner:0
725+msgid "Tag"
726+msgstr "Etiquette"
727+
728+#. module: base_contact_by_functions
729+#: view:res.partner:0
730+msgid "Passport information"
731+msgstr "Informations du passeport"
732+
733+#. module: base_contact_by_functions
734+#: view:res.partner:0
735+msgid "Address"
736+msgstr "Adresse"
737+
738+#. module: base_contact_by_functions
739+#: view:res.partner:0
740+msgid "Parent organism"
741+msgstr "Organisme parent"
742+
743+#. module: base_contact_by_functions
744+#: view:res.partner:0
745+msgid "have the same form for contact and other postions"
746+msgstr "Avoir le même formulaire de contact et d'autres postions"
747+
748+#. module: base_contact_by_functions
749+#: view:res.partner:0
750+msgid "Select functions for this organism"
751+msgstr "Sélectionner les fonctions de cet organisme"
752+
753+#. module: base_contact_by_functions
754+#: view:res.partner:0
755+msgid "Phone:"
756+msgstr "Téléphone:"
757+
758+#. module: base_contact_by_functions
759+#: field:functions,name:0 field:res.institution,name:0
760+msgid "Name"
761+msgstr "Nom"
762+
763+#. module: base_contact_by_functions
764+#: view:res.partner:0
765+msgid "ZIP"
766+msgstr "Code postal"
767+
768+#. module: base_contact_by_functions
769+#: view:res.partner:0
770+msgid "Use organism address"
771+msgstr "Utilisez l'adresse de l'organisme"
772+
773+#. module: base_contact_by_functions
774+#: view:res.partner:0
775+msgid "Country"
776+msgstr "Pays"
777+
778+#. module: base_contact_by_functions
779+#: field:functions,institution_id:0
780+msgid "institution"
781+msgstr "institution"
782+
783+#. module: base_contact_by_functions
784+#: view:res.partner:0
785+msgid "Is an Organism"
786+msgstr "Est un Organisme"
787+
788+#. module: base_contact_by_functions
789+#: field:res.partner,function_id:0
790+msgid "Position Occupied"
791+msgstr "Fonction Occupée"
792+
793+#. module: base_contact_by_functions
794+#: view:res.partner:0
795+msgid "Contact"
796+msgstr "Contact"
797+
798+#. module: base_contact_by_functions
799+#: help:res.institution,sequence:0
800+msgid "Used to order the institutions"
801+msgstr "Permet d'ordonner les institutions"
802+
803+#. module: base_contact_by_functions
804+#: view:res.partner:0
805+msgid "Mobile:"
806+msgstr "Portable :"
807+
808+#. module: base_contact_by_functions
809+#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
810+msgid "Partner Categories"
811+msgstr "Catégories de partenaires"
812+
813+#. module: base_contact_by_functions
814+#: view:res.partner:0
815+msgid "Organism"
816+msgstr "Organisme"
817+
818+#. module: base_contact_by_functions
819+#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
820+#: model:ir.model,name:base_contact_by_functions.model_res_institution
821+#: field:res.institution.functions,institution_id:0
822+msgid "Institutions"
823+msgstr "Institutions"
824+
825+#. module: base_contact_by_functions
826+#: view:res.partner:0
827+msgid "History"
828+msgstr "Historique"
829+
830+#. module: base_contact_by_functions
831+#: field:res.partner,end_date:0
832+msgid "End date"
833+msgstr "Date de fin"
834+
835+#. module: base_contact_by_functions
836+#: view:res.partner.category:0
837+msgid "Add function"
838+msgstr "Ajouter fonction"
839+
840+#. module: base_contact_by_functions
841+#: view:res.partner:0
842+msgid "Bank Details"
843+msgstr "Coordonnées bancaires"
844+
845+#. module: base_contact_by_functions
846+#: view:res.institution:0
847+msgid "InstitutionsTree"
848+msgstr "InstitutionsTree"
849+
850+#. module: base_contact_by_functions
851+#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
852+#: field:res.institution.functions,sequence:0
853+msgid "Sequence"
854+msgstr "Séquence"
855+
856+#. module: base_contact_by_functions
857+#: view:res.partner:0
858+msgid "Bank Accounts"
859+msgstr "Comptes bancaires"
860+
861+#. module: base_contact_by_functions
862+#: view:res.partner:0
863+msgid "No, Street, Apartment/Office"
864+msgstr "No, Rue, Appartement/Bureau"
865+
866+#. module: base_contact_by_functions
867+#: view:res.partner:0
868+msgid "Use address organism"
869+msgstr "Utiliser l'adresse de l'organisme"
870+
871+#. module: base_contact_by_functions
872+#: field:functions,acronym:0
873+msgid "Acronym"
874+msgstr "Acronyme"
875+
876+#. module: base_contact_by_functions
877+#: help:functions,name:0
878+msgid "Name of function."
879+msgstr "Nom de la fonction."
880+
881+#. module: base_contact_by_functions
882+#: help:res.partner,passport_number:0
883+msgid "Passport number."
884+msgstr "Numéro de passeport."
885+
886+#. module: base_contact_by_functions
887+#: field:res.partner,passport_number:0
888+msgid "Passport Number"
889+msgstr "Numéro de passeport."
890+
891+#. module: base_contact_by_functions
892+#: model:ir.model,name:base_contact_by_functions.model_res_partner
893+msgid "Partner"
894+msgstr "Partenaire"
895+
896+#. module: base_contact_by_functions
897+#: field:res.partner,naming:0
898+msgid "Naming"
899+msgstr "Appellation"
900
901=== added file 'base_contact_by_functions/res_institutions.py'
902--- base_contact_by_functions/res_institutions.py 1970-01-01 00:00:00 +0000
903+++ base_contact_by_functions/res_institutions.py 2014-04-30 15:00:54 +0000
904@@ -0,0 +1,49 @@
905+# -*- encoding: utf-8 -*-
906+##############################################################################
907+#
908+# OpenERP, Open Source Management Solution
909+# This module copyright (C) 2013 Savoir-faire Linux
910+# (<http://www.savoirfairelinux.com>).
911+#
912+# This program is free software: you can redistribute it and/or modify
913+# it under the terms of the GNU Affero General Public License as
914+# published by the Free Software Foundation, either version 3 of the
915+# License, or (at your option) any later version.
916+#
917+# This program is distributed in the hope that it will be useful,
918+# but WITHOUT ANY WARRANTY; without even the implied warranty of
919+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
920+# GNU Affero General Public License for more details.
921+#
922+# You should have received a copy of the GNU Affero General Public License
923+# along with this program. If not, see <http://www.gnu.org/licenses/>.
924+#
925+##############################################################################
926+
927+from openerp.osv import fields, orm
928+
929+
930+class res_institutions(orm.Model):
931+ _description = 'Institutions'
932+ _name = 'res.institution'
933+ _order = 'sequence asc'
934+ _columns = {
935+ 'name': fields.char('Name', size=256, required=True, select=True,
936+ help='Name of institution.'),
937+ 'sequence': fields.integer('Sequence', help="Used to order the institutions"),
938+ 'institutionfunction_ids': fields.one2many('res.institution.functions', 'institution_id', 'Functions'),
939+ }
940+ _sql_constraints = [('institution_name_unique', 'unique(name)', 'Name already exists')]
941+
942+
943+class res_institutions_functions(orm.Model):
944+ _description = 'Institutions functions'
945+ _name = 'res.institution.functions'
946+ _order = 'sequence asc'
947+ _columns = {
948+ 'functions_id': fields.many2one('functions', 'Functions', required='True'),
949+ 'sequence': fields.integer('Sequence', help="Used to order"),
950+ 'institution_id': fields.many2one('res.institution', 'Institutions'),
951+ }
952+
953+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
954
955=== added file 'base_contact_by_functions/res_institutions_view.xml'
956--- base_contact_by_functions/res_institutions_view.xml 1970-01-01 00:00:00 +0000
957+++ base_contact_by_functions/res_institutions_view.xml 2014-04-30 15:00:54 +0000
958@@ -0,0 +1,55 @@
959+<?xml version="1.0" ?>
960+<openerp>
961+ <data>
962+ <!-- Tree Views Institutions-->
963+ <record model="ir.ui.view" id="institutions_tree_view">
964+ <field name="name">Institutions Tree View</field>
965+ <field name="model">res.institution</field>
966+ <field name="type">tree</field>
967+ <field name="arch" type="xml">
968+ <tree string="InstitutionsTree" version="7.0">
969+ <field name="name"/>
970+ <field name="sequence"/>
971+ </tree>
972+ </field>
973+ </record>
974+ <!-- Form Views Institutions-->
975+ <record model="ir.ui.view" id="institutions_form_view">
976+ <field name="name">Institutions Form View</field>
977+ <field name="model">res.institution</field>
978+ <field name="type">form</field>
979+ <field name="arch" type="xml">
980+ <form string="InstitutionsForm" version="7.0" >
981+ <group col="4">
982+ <field name="name"/>
983+ <field name="sequence"/>
984+ </group>
985+ <notebook position="inside">
986+ <page string="Functions">
987+ <separator string="Add functions for this institution"/>
988+ <group col="2" colspan="4">
989+ <field name="institutionfunction_ids" nolabel="1">
990+ <tree string="FunctionsTree">
991+ <field name="sequence"/>
992+ <field name="functions_id"/>
993+ </tree>
994+ <form string="FunctionsForm">
995+ <field name="functions_id"/>
996+ <field name="sequence"/>
997+ </form>
998+ </field>
999+ </group>
1000+ </page>
1001+ </notebook>
1002+ </form>
1003+ </field>
1004+ </record>
1005+ <!-- Actions -->
1006+ <record model="ir.actions.act_window" id="action_institutions_tree_list">
1007+ <field name="name">Institutions</field>
1008+ <field name="view_id" ref="institutions_tree_view"/>
1009+ <field name="res_model">res.institution</field>
1010+ <field name="view_mode">tree,form</field>
1011+ </record>
1012+ </data>
1013+</openerp>
1014
1015=== added file 'base_contact_by_functions/res_partner.py'
1016--- base_contact_by_functions/res_partner.py 1970-01-01 00:00:00 +0000
1017+++ base_contact_by_functions/res_partner.py 2014-04-30 15:00:54 +0000
1018@@ -0,0 +1,102 @@
1019+# -*- encoding: utf-8 -*-
1020+##############################################################################
1021+#
1022+# OpenERP, Open Source Management Solution
1023+# This module copyright (C) 2013 Savoir-faire Linux
1024+# (<http://www.savoirfairelinux.com>).
1025+#
1026+# This program is free software: you can redistribute it and/or modify
1027+# it under the terms of the GNU Affero General Public License as
1028+# published by the Free Software Foundation, either version 3 of the
1029+# License, or (at your option) any later version.
1030+#
1031+# This program is distributed in the hope that it will be useful,
1032+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1033+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1034+# GNU Affero General Public License for more details.
1035+#
1036+# You should have received a copy of the GNU Affero General Public License
1037+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1038+#
1039+##############################################################################
1040+
1041+import time
1042+from openerp.osv import orm, fields
1043+
1044+
1045+class res_partner_category(orm.Model):
1046+ """
1047+ Inherits partner_category
1048+ """
1049+ _inherit = 'res.partner.category'
1050+ _columns = {
1051+ 'categoryfunction_ids': fields.one2many('res.category.functions', 'category_id', 'Functions'),
1052+ }
1053+
1054+
1055+class res_category_functions(orm.Model):
1056+ """
1057+ Adds this class to link category and functions
1058+ """
1059+ _description = 'Categories functions'
1060+ _name = 'res.category.functions'
1061+ _order = 'sequence asc'
1062+ _columns = {
1063+ 'functions_id': fields.many2one('functions', 'Functions', required='True'),
1064+ 'sequence': fields.integer('Sequence', help="Used to order"),
1065+ 'category_id': fields.many2one('res.partner.category', 'Category'),
1066+ }
1067+
1068+
1069+class res_partner(orm.Model):
1070+ """
1071+ Inherits partner and adds functions_ids : List of functions
1072+ """
1073+ _inherit = 'res.partner'
1074+
1075+ def onchange_partner_function(self, cr, uid, ids, part, context=None):
1076+ if not part:
1077+ return {'value': None}
1078+ partner_ids = self.pool.get('res.partner').search(cr, uid, [('id', '=', part)])
1079+ functions_ids = self.pool.get('res.partner').browse(cr, uid, partner_ids, context=context)[0].functions_ids
1080+ result = []
1081+ if functions_ids:
1082+ for line in functions_ids:
1083+ result.append(line.id)
1084+ dom = {'function_id': [('id', 'in', result)]}
1085+ return {'domain': dom}
1086+
1087+ def _get_history_lines(self, cr, uid, ids, name, arg, context=None):
1088+ res = {}
1089+ res_partner_pool = self.pool.get('res.partner')
1090+ for record in self.browse(cr, uid, ids, context=context):
1091+
1092+ if record.is_company:
1093+ return res
1094+ contact_ids = res_partner_pool.search(cr, uid,
1095+ [('contact_id', '=', record.id),
1096+ ('active', '=', False)],
1097+ context=context)
1098+ res[record.id] = [x.id for x in res_partner_pool.browse(cr, uid, contact_ids)
1099+ if x.end_date and x.end_date <= time.strftime('%Y-%m-%d')]
1100+ return res
1101+
1102+ _columns = {
1103+ 'functions_ids': fields.many2many('functions', 'function_partner_rel', 'partner_id',
1104+ 'function_id', 'Functions'),
1105+ 'start_date': fields.date('Start date'),
1106+ 'end_date': fields.date('End date'),
1107+ 'naming': fields.char('Naming', size=256, help="Naming."),
1108+ 'function_id': fields.many2one('functions', 'Position Occupied'),
1109+ 'other_contact_history_ids': fields.function(_get_history_lines,
1110+ relation="res.partner",
1111+ method=True,
1112+ type="one2many"),
1113+ # Replace company by Organism
1114+ 'use_parent_address': fields.boolean(
1115+ 'Use Organism Address',
1116+ help="Select this if you want to set organism's address information for this contact"),
1117+
1118+ }
1119+
1120+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1121
1122=== added file 'base_contact_by_functions/res_partner_view.xml'
1123--- base_contact_by_functions/res_partner_view.xml 1970-01-01 00:00:00 +0000
1124+++ base_contact_by_functions/res_partner_view.xml 2014-04-30 15:00:54 +0000
1125@@ -0,0 +1,526 @@
1126+<?xml version = "1.0" encoding="utf-8"?>
1127+<openerp>
1128+ <data>
1129+ <!--Add list of functions in partner view-->
1130+ <record id="view_contact_by_function_form" model="ir.ui.view">
1131+ <field name="name">contact.functions.form.inherit</field>
1132+ <field name="model">res.partner</field>
1133+ <field name="inherit_id" ref="base.view_partner_form"/>
1134+ <field name="arch" type="xml">
1135+ <field name="use_parent_address" position="replace">
1136+ <field name="use_parent_address"
1137+ class="oe_edit_only oe_inline"
1138+ on_change="onchange_address(use_parent_address, parent_id)"
1139+ attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
1140+ string="Use organism address"/>
1141+ </field>
1142+ <label for="use_parent_address" position="replace">
1143+ <label for="use_parent_address"
1144+ class="oe_edit_only"
1145+ attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
1146+ string="Use organism address"/>
1147+ </label>
1148+ <!--Add ')' at the end of 'Is an Organism?'-->
1149+ <label for="is_company" position="replace">
1150+ <label for="is_company" string="Is an Organism"/>)
1151+ </label>
1152+ <!--Replace Street placeholder by No, Street, Apartment/Office-->
1153+ <field name="street" position="attributes">
1154+ <attribute name="placeholder">No, Street, Apartment/Office</attribute>
1155+ </field>
1156+ <field name="fax" position="attributes">
1157+ <attribute name="string">Fax</attribute>
1158+ </field>
1159+
1160+ <notebook position="inside">
1161+ <page string="Functions"
1162+ attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}"
1163+ autofocus="autofocus">
1164+ <separator string="Select functions for this organism"/>
1165+ <field name="functions_ids"/>
1166+ </page>
1167+ <page string="History (Functions)" attrs="{'invisible': ['|','|',('is_company','=',True),('contact_id','!=',False),('other_contact_history_ids','=',[])]}">
1168+ <separator string="History"/>
1169+ <field name="other_contact_history_ids" mode="kanban"
1170+ attrs="{'invisible': [('other_contact_history_ids','=',False)]}">
1171+ <kanban>
1172+ <field name="color"/>
1173+ <field name="name"/>
1174+ <field name="title"/>
1175+ <field name="email"/>
1176+ <field name="parent_id" string="Organism"/>
1177+ <field name="is_company"/>
1178+ <field name="function_id" string="Function"/>
1179+ <field name="phone"/>
1180+ <field name="street"/>
1181+ <field name="street2"/>
1182+ <field name="zip"/>
1183+ <field name="city"/>
1184+ <field name="country_id"/>
1185+ <field name="mobile"/>
1186+ <field name="fax"/>
1187+ <field name="state_id"/>
1188+ <field name="has_image"/>
1189+ <templates>
1190+ <t t-name="kanban-box">
1191+ <div class="oe_kanban_vignette oe_semantic_html_override">
1192+ <a type="open">
1193+ <t t-if="record.has_image.raw_value === true">
1194+ <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
1195+ class="oe_kanban_image"/>
1196+ </t>
1197+ <t t-if="record.has_image.raw_value === false">
1198+ <t t-if="record.is_company.raw_value === true">
1199+ <img t-att-src='_s + "/base/static/src/img/company_image.png"'
1200+ class="oe_kanban_image"/>
1201+ </t>
1202+ <t t-if="record.is_company.raw_value === false">
1203+ <img t-att-src='_s + "/base/static/src/img/avatar.png"'
1204+ class="oe_kanban_image"/>
1205+ </t>
1206+ </t>
1207+ </a>
1208+ <div class="oe_kanban_details">
1209+ <h4 class="oe_partner_heading">
1210+ <a type="open">
1211+ <field name="name"/>
1212+ </a>
1213+ </h4>
1214+ <div class="oe_kanban_partner_categories"/>
1215+ <div class="oe_kanban_partner_links"/>
1216+ <ul>
1217+ <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
1218+ <field name="function_id"/>
1219+ </li>
1220+ <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
1221+ <field name="function_id"/>
1222+ ,
1223+ <field name="parent_id"/>
1224+ </li>
1225+ <li t-if="record.city.raw_value and !record.country.raw_value">
1226+ <field name="city"/>
1227+ </li>
1228+ <li t-if="!record.city.raw_value and record.country.raw_value">
1229+ <field name="country"/>
1230+ </li>
1231+ <li t-if="record.city.raw_value and record.country.raw_value">
1232+ <field name="city"/>
1233+ ,
1234+ <field name="country"/>
1235+ </li>
1236+ <li t-if="record.email.raw_value">
1237+ <a t-attf-href="mailto:#{record.email.raw_value}">
1238+ <field name="email"/>
1239+ </a>
1240+ </li>
1241+ </ul>
1242+ </div>
1243+ </div>
1244+ </t>
1245+ </templates>
1246+ </kanban>
1247+ <form string="Contact" version="7.0">
1248+ <sheet>
1249+ <field name="image" widget='image' class="oe_avatar oe_left"
1250+ options='{"preview_image": "image_medium"}'/>
1251+ <div class="oe_title">
1252+ <label for="name" class="oe_edit_only"/>
1253+ <h1>
1254+ <field name="name" style="width: 70%%"/>
1255+ </h1>
1256+ </div>
1257+ <group>
1258+ <!-- inherited part -->
1259+ <field name="category_id" widget="many2many_tags"
1260+ placeholder="Tags..." style="width: 70%%" string="Tag"/>
1261+ <field name="parent_id"
1262+ placeholder="Organism"
1263+ domain="[('is_company','=',True)]"
1264+ string="Parent Organism"/>
1265+ <!-- inherited part end -->
1266+ <field name="function_id" placeholder="e.g. Sales Director"/>
1267+ <group colspan="4">
1268+ <field name="start_date" />
1269+ <field name="end_date"/>
1270+ <field name="naming"/>
1271+ </group>
1272+ <field name="email"/>
1273+ <field name="phone"/>
1274+ <field name="mobile"/>
1275+ </group>
1276+ <div>
1277+ <field name="use_parent_address"/>
1278+ <label for="use_parent_address" string="Use organism address"/>
1279+ </div>
1280+ <group>
1281+ <label for="type"/>
1282+ <div name="div_type">
1283+ <field class="oe_inline" name="type"/>
1284+ </div>
1285+ <label for="street" string="Address"
1286+ attrs="{'invisible': [('use_parent_address','=', True)]}"/>
1287+ <div attrs="{'invisible': [('use_parent_address','=', True)]}"
1288+ name="div_address">
1289+ <field name="street" placeholder="Street..."/>
1290+ <field name="street2"/>
1291+ <div class="address_format">
1292+ <field name="city" placeholder="City" style="width: 40%%"/>
1293+ <field name="state_id" class="oe_no_button"
1294+ placeholder="State" style="width: 37%%"
1295+ options='{"no_open": True}' on_change="onchange_state(state_id)"/>
1296+ <field name="zip" placeholder="ZIP" style="width: 20%%"/>
1297+ </div>
1298+ <field name="country_id" placeholder="Country"
1299+ class="oe_no_button" options='{"no_open": True}'/>
1300+ </div>
1301+ </group>
1302+ <field name="supplier" invisible="True"/>
1303+ <group string="Bank Accounts">
1304+ <field name="bank_ids" nolabel="1">
1305+ <tree string="Bank Details">
1306+ <field name="state" invisible="1"/>
1307+ <field name="sequence" invisible="1"/>
1308+ <field name="acc_number"/>
1309+ <field name="bank_name"/>
1310+ <field name="owner_name"/>
1311+ </tree>
1312+ </field>
1313+ </group>
1314+ </sheet>
1315+ </form>
1316+ </field>
1317+ </page>
1318+ </notebook>
1319+ <!--Replace function by function_id defined by organism-->
1320+ <field name="function" position="replace"/>
1321+ </field>
1322+
1323+ </record>
1324+ <!--Add start_date, end_date, naming and account bank in partner view-->
1325+ <record id="view_position_info_form" model="ir.ui.view">
1326+ <field name="name">position.info.form.inherit</field>
1327+ <field name="model">res.partner</field>
1328+ <field name="inherit_id" ref="base_contact.view_partner_form_inherit"/>
1329+ <field name="arch" type="xml">
1330+ <xpath expr="//field[@name='other_contact_ids']/form//field[@name='category_id']"
1331+ position="attributes">
1332+ <attribute name="string">Tag</attribute>
1333+ </xpath>
1334+ <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
1335+ position="after">
1336+ <group colspan="4">
1337+ <field name="start_date" />
1338+ <field name="end_date"/>
1339+ <field name="naming"/>
1340+ </group>
1341+ </xpath>
1342+ <xpath expr="//field[@name='other_contact_ids']/form//field[@name='supplier']"
1343+ position="after">
1344+ <group string="Bank Accounts">
1345+ <field name="bank_ids" nolabel="1"/>
1346+ </group>
1347+ </xpath>
1348+ <xpath expr="//field[@name='other_contact_ids']/form//field[@name='parent_id']"
1349+ position="replace">
1350+ <group colspan="4">
1351+ <field name="parent_id" placeholder="Organism"
1352+ domain="[('is_company','=',True)]"
1353+ on_change="onchange_partner_function(parent_id)"
1354+ string="Parent Organism"/>
1355+ </group>
1356+ </xpath>
1357+ <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
1358+ position="replace">
1359+ <group colspan="4">
1360+ <field name="function_id" string="Function"/>
1361+ </group>
1362+ </xpath>
1363+ <xpath expr="//field[@name='other_contact_ids']/form//label[@for='use_parent_address']"
1364+ position="replace">
1365+ <label for="use_parent_address" string="Use address organism"/>
1366+ </xpath>
1367+ <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='function']"
1368+ position="replace">
1369+ <group colspan="4">
1370+ <field name="function_id" string="Function"/>
1371+ </group>
1372+ </xpath>
1373+ <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
1374+ position="after">
1375+ <templates>
1376+ <t t-name="kanban-box">
1377+ <t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
1378+ <div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')"
1379+ style="position: relative">
1380+ <a t-if="! read_only_mode" type="delete"
1381+ style="position: absolute; right: 0; padding: 4px; diplay: inline-block">
1382+ X
1383+ </a>
1384+ <div class="oe_module_vignette">
1385+ <a type="open">
1386+ <t t-if="record.has_image.raw_value === true">
1387+ <img t-att-src="kanban_image('res.partner', 'image',
1388+ record.id.value, {'preview_image': 'image_small'})"
1389+ class="oe_avatar oe_kanban_avatar_smallbox"/>
1390+ </t>
1391+ <t t-if="record.image and record.image.raw_value !== false">
1392+ <img t-att-src="'data:image/png;base64,'+record.image.raw_value"
1393+ class="oe_avatar oe_kanban_avatar_smallbox"/>
1394+ </t>
1395+ <t t-if="record.has_image.raw_value === false
1396+ and (!record.image or record.image.raw_value === false)">
1397+ <t t-if="record.is_company.raw_value === true">
1398+ <img t-att-src='_s + "/base/static/src/img/company_image.png"'
1399+ class="oe_kanban_image oe_kanban_avatar_smallbox"/>
1400+ </t>
1401+ <t t-if="record.is_company.raw_value === false">
1402+ <img t-att-src='_s + "/base/static/src/img/avatar.png"'
1403+ class="oe_kanban_image oe_kanban_avatar_smallbox"/>
1404+ </t>
1405+ </t>
1406+ </a>
1407+ <div class="oe_module_desc">
1408+ <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
1409+ <table class="oe_kanban_table">
1410+ <tr>
1411+ <td class="oe_kanban_title1" align="left" valign="middle">
1412+ <h4>
1413+ <a type="open">
1414+ <field name="name"/>
1415+ </a>
1416+ </h4>
1417+ <i>
1418+ <t t-if="record.parent_id.raw_value and !record.function_id.raw_value">
1419+ <field name="parent_id"/>
1420+ </t>
1421+ <t t-if="!record.parent_id.raw_value and record.function_id.raw_value">
1422+ <field name="function_id"/>
1423+ </t>
1424+ <t t-if="record.parent_id.raw_value and record.function_id.raw_value">
1425+ <field name="function_id"/>
1426+ ,
1427+ <field name="parent_id"/>
1428+ </t>
1429+ </i>
1430+ <div>
1431+ <a t-if="record.email.raw_value" title="Mail"
1432+ t-att-href="'mailto:'+record.email.value">
1433+ <field name="email"/>
1434+ </a>
1435+ </div>
1436+ <div t-if="record.phone.raw_value">
1437+ Phone: <field name="phone"/>
1438+ </div>
1439+ <div t-if="record.mobile.raw_value">
1440+ Mobile: <field name="mobile"/>
1441+ </div>
1442+ <div t-if="record.fax.raw_value">
1443+ Fax: <field name="fax"/>
1444+ </div>
1445+ </td>
1446+ </tr>
1447+ </table>
1448+ </div>
1449+ </div>
1450+ </div>
1451+ </div>
1452+ </t>
1453+ </templates>
1454+ </xpath>
1455+ have the same form for contact and other postions
1456+ <field name="parent_id" position="replace">
1457+ <field name="parent_id" placeholder="Parent organism"
1458+ domain="[('is_company','=',True)]"
1459+ attrs="{'invisible': [('is_company','=', False)]}"/>
1460+ </field>
1461+ <xpath expr="//field[@name='child_ids']/form//field[@name='supplier']"
1462+ position="after">
1463+ <group string="Bank Accounts">
1464+ <field name="bank_ids" nolabel="1"/>
1465+ </group>
1466+ </xpath>
1467+
1468+ <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
1469+ position="after">
1470+ <group colspan="4">
1471+ <field name="start_date" />
1472+ <field name="end_date"/>
1473+ <field name="naming"/>
1474+ </group>
1475+ </xpath>
1476+ <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
1477+ position="replace">
1478+ <group colspan="4">
1479+ <field name="parent_id"
1480+ placeholder="Organism"
1481+ domain="[('is_company','=',True)]"
1482+ string="Parent organism" />
1483+ <field name="function_id"
1484+ readonly="False"
1485+ domain="[('id', 'in', parent.functions_ids[0][2])]"
1486+ string="Function"/>
1487+ </group>
1488+ </xpath>
1489+
1490+ <xpath expr="//field[@name='child_ids']/form//label[@for='use_parent_address']"
1491+ position="replace">
1492+ <label for="use_parent_address" string="Use address organism"/>
1493+ </xpath>
1494+
1495+ <xpath expr="//field[@name='child_ids']/kanban//field[@name='function']"
1496+ position="replace">
1497+ <group colspan="4">
1498+ <field name="function_id" string="Function"/>
1499+ </group>
1500+ </xpath>
1501+ <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
1502+ position="after">
1503+ <templates>
1504+ <t t-name="kanban-box">
1505+ <div class="oe_kanban_vignette oe_semantic_html_override">
1506+ <a type="open">
1507+ <t t-if="record.has_image.raw_value === true">
1508+ <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
1509+ class="oe_kanban_image"/>
1510+ </t>
1511+ <t t-if="record.has_image.raw_value === false">
1512+ <t t-if="record.is_company.raw_value === true">
1513+ <img t-att-src='_s + "/base/static/src/img/company_image.png"'
1514+ class="oe_kanban_image"/>
1515+ </t>
1516+ <t t-if="record.is_company.raw_value === false">
1517+ <img t-att-src='_s + "/base/static/src/img/avatar.png"'
1518+ class="oe_kanban_image"/>
1519+ </t>
1520+ </t>
1521+ </a>
1522+ <div class="oe_kanban_details">
1523+ <h4 class="oe_partner_heading">
1524+ <a type="open">
1525+ <field name="name"/>
1526+ </a>
1527+ </h4>
1528+ <div class="oe_kanban_partner_categories"/>
1529+ <div class="oe_kanban_partner_links"/>
1530+ <ul>
1531+ <li t-if="record.parent_id.raw_value and !record.function_id.raw_value">
1532+ <field name="parent_id"/>
1533+ </li>
1534+ <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
1535+ <field name="function_id"/>
1536+ </li>
1537+ <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
1538+ <field name="function_id"/>
1539+ ,
1540+ <field name="parent_id"/>
1541+ </li>
1542+ <li t-if="record.city.raw_value and !record.country.raw_value">
1543+ <field name="city"/>
1544+ </li>
1545+ <li t-if="!record.city.raw_value and record.country.raw_value">
1546+ <field name="country"/>
1547+ </li>
1548+ <li t-if="record.city.raw_value and record.country.raw_value">
1549+ <field name="city"/>
1550+ ,
1551+ <field name="country"/>
1552+ </li>
1553+ <li t-if="record.email.raw_value">
1554+ <a t-attf-href="mailto:#{record.email.raw_value}">
1555+ <field name="email"/>
1556+ </a>
1557+ </li>
1558+ </ul>
1559+ </div>
1560+ </div>
1561+ </t>
1562+ </templates>
1563+ </xpath>
1564+ </field>
1565+ </record>
1566+ <!-- Actions for organism -->
1567+ <record id="action_partner_customer_form" model="ir.actions.act_window">
1568+ <field name="name">Company</field>
1569+ <field name="type">ir.actions.act_window</field>
1570+ <field name="res_model">res.partner</field>
1571+ <field name="view_type">form</field>
1572+ <field name="view_mode">kanban,tree,form</field>
1573+ <field name="domain">[('is_company','=',1)]</field>
1574+ <field name="context" eval="{'default_is_company': True}"/>
1575+ <field name="filter" eval="True"/>
1576+ </record>
1577+ <!-- Actions for Contacts -->
1578+ <record id="action_partner_contact_form" model="ir.actions.act_window">
1579+ <field name="name">Contacts</field>
1580+ <field name="type">ir.actions.act_window</field>
1581+ <field name="res_model">res.partner</field>
1582+ <field name="view_type">form</field>
1583+ <field name="view_mode">kanban,tree,form</field>
1584+ <field name="domain">[('is_company','=',0)]</field>
1585+ <field name="filter" eval="True"/>
1586+ </record>
1587+
1588+ <!--Add country,street fields in tree partner view-->
1589+ <record model="ir.ui.view" id="view_partner_tree_country_address">
1590+ <field name="model">res.partner</field>
1591+ <field name="inherit_id" ref="base.view_partner_tree"/>
1592+ <field name="arch" type="xml">
1593+ <field name="country_id" position="replace"/>
1594+ <field name="name" position="after">
1595+ <field name="country_id"/>
1596+ </field>
1597+ <field name="email" position="after">
1598+ <field name="street" string="Address"/>
1599+ </field>
1600+ </field>
1601+ </record>
1602+
1603+ <!-- Inherit Categories adding functions -->
1604+ <record id="view_partner_category_functions_form" model="ir.ui.view">
1605+ <field name="name">Partner Categories Functions</field>
1606+ <field name="model">res.partner.category</field>
1607+ <field name="inherit_id" ref="base.view_partner_category_form"/>
1608+ <field name="arch" type="xml">
1609+ <xpath expr="//form[@string='Partner Category']/group[1]"
1610+ position="after">
1611+ <notebook position="inside">
1612+ <page string="Functions">
1613+ <separator string="Add function"/>
1614+ <group col="2" colspan="4">
1615+ <field name="categoryfunction_ids" nolabel="1">
1616+ <tree string="FunctionsTree">
1617+ <field name="sequence"/>
1618+ <field name="functions_id"/>
1619+ </tree>
1620+ <form string="FunctionsForm">
1621+ <field name="functions_id"/>
1622+ <field name="sequence"/>
1623+ </form>
1624+ </field>
1625+ </group>
1626+ </page>
1627+ </notebook>
1628+ </xpath>
1629+ </field>
1630+ </record>
1631+
1632+ <!--Replace company by organism-->
1633+ <record id="view_partner_simple_form" model="ir.ui.view">
1634+ <field name="name">res.partner.simplified.form</field>
1635+ <field name="model">res.partner</field>
1636+ <field name="arch" type="xml">
1637+ <label for="is_company" position="replace">
1638+ <label for="is_company" string="Is an Organism"/>
1639+ </label>
1640+ <field name="parent_id" position="replace">
1641+ <field name="parent_id"
1642+ placeholder="Organism"
1643+ domain="[('is_company', '=', True)]"
1644+ context="{'default_is_company': True, 'default_supplier': supplier}"
1645+ attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"
1646+ on_change="onchange_address(use_parent_address, parent_id)"/>
1647+ </field>
1648+ </field>
1649+ </record>
1650+ </data>
1651+</openerp>
1652
1653=== added directory 'base_contact_by_functions/security'
1654=== added file 'base_contact_by_functions/security/ir.model.access.csv'
1655--- base_contact_by_functions/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
1656+++ base_contact_by_functions/security/ir.model.access.csv 2014-04-30 15:00:54 +0000
1657@@ -0,0 +1,5 @@
1658+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1659+"access_functions","functions_user","model_functions","base.group_user",1,1,1,1
1660+"access_res_category_functions","access_res_category_functions_user","model_res_category_functions","base.group_user",1,1,1,1
1661+"access_res_institution","access_res_institution_user","model_res_institution","base.group_user",1,1,1,1
1662+"access_res_institution_functions","access_res_institution_functions_user","model_res_institution_functions","base.group_user",1,1,1,1
1663
1664=== added directory 'base_contact_by_functions/tests'
1665=== added file 'base_contact_by_functions/tests/__init__.py'
1666--- base_contact_by_functions/tests/__init__.py 1970-01-01 00:00:00 +0000
1667+++ base_contact_by_functions/tests/__init__.py 2014-04-30 15:00:54 +0000
1668@@ -0,0 +1,31 @@
1669+# -*- encoding: utf-8 -*-
1670+##############################################################################
1671+#
1672+# OpenERP, Open Source Management Solution
1673+# This module copyright (C) 2013 Savoir-faire Linux
1674+# (<http://www.savoirfairelinux.com>).
1675+#
1676+# This program is free software: you can redistribute it and/or modify
1677+# it under the terms of the GNU Affero General Public License as
1678+# published by the Free Software Foundation, either version 3 of the
1679+# License, or (at your option) any later version.
1680+#
1681+# This program is distributed in the hope that it will be useful,
1682+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1683+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1684+# GNU Affero General Public License for more details.
1685+#
1686+# You should have received a copy of the GNU Affero General Public License
1687+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1688+#
1689+##############################################################################
1690+
1691+from . import test_functions
1692+from . import test_institutions
1693+from . import test_partner_category
1694+
1695+checks = [
1696+ test_functions,
1697+ test_institutions,
1698+ test_partner_category
1699+]
1700
1701=== added file 'base_contact_by_functions/tests/test_functions.py'
1702--- base_contact_by_functions/tests/test_functions.py 1970-01-01 00:00:00 +0000
1703+++ base_contact_by_functions/tests/test_functions.py 2014-04-30 15:00:54 +0000
1704@@ -0,0 +1,98 @@
1705+# -*- encoding: utf-8 -*-
1706+##############################################################################
1707+#
1708+# OpenERP, Open Source Management Solution
1709+# This module copyright (C) 2013 Savoir-faire Linux
1710+# (<http://www.savoirfairelinux.com>).
1711+#
1712+# This program is free software: you can redistribute it and/or modify
1713+# it under the terms of the GNU Affero General Public License as
1714+# published by the Free Software Foundation, either version 3 of the
1715+# License, or (at your option) any later version.
1716+#
1717+# This program is distributed in the hope that it will be useful,
1718+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1719+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1720+# GNU Affero General Public License for more details.
1721+#
1722+# You should have received a copy of the GNU Affero General Public License
1723+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1724+#
1725+##############################################################################
1726+
1727+from openerp.tests.common import TransactionCase
1728+from openerp.osv.orm import browse_record
1729+
1730+
1731+class Base_Test_function(TransactionCase):
1732+ """
1733+ Simple test creating a function
1734+ This is a base class for function test cases.
1735+ Inherit from this and setup values.
1736+ """
1737+
1738+ def setUp(self, vals={}):
1739+ """
1740+ Setting up function.
1741+ """
1742+ # Default test values
1743+ self.vals = {'name': 'This is a test function name',
1744+ 'acronym': 'This is a test function acronym',
1745+ }
1746+ super(Base_Test_function, self).setUp()
1747+ self.vals = dict(self.vals.items() + vals.items())
1748+ # Create the function object; we will be testing this, so store in self
1749+ function_function = self.registry('functions')
1750+ self.function_id = function_function.create(self.cr, self.uid, self.vals, context=None)
1751+
1752+ def test_function(self):
1753+ """
1754+ Checking the function creation.
1755+ """
1756+ function_function = self.registry('functions')
1757+ function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
1758+ for field in self.vals:
1759+ val = function_obj[field]
1760+ if type(val) == browse_record:
1761+ self.assertEquals(self.vals[field], val.id,
1762+ "IDs for %s don't match: (%i != %i)" %
1763+ (field, self.vals[field], val.id))
1764+ else:
1765+ self.assertEquals(str(self.vals[field]), str(val),
1766+ "Values for %s don't match: (%s != %s)" %
1767+ (field, str(self.vals[field]), str(val)))
1768+
1769+
1770+class Test_function_bad(Base_Test_function):
1771+ """
1772+ Simple test creating a function, test against bad values
1773+ """
1774+ def setUp(self):
1775+ """
1776+ Setting up function, then changing the values to test against.
1777+ """
1778+ super(Test_function_bad, self).setUp()
1779+ # Change vals to something wrong
1780+ self.vals = {'name': 'This is the wrong function name',
1781+ 'acronym': 'This is the wrong function acronym',
1782+ }
1783+
1784+ def test_function(self):
1785+ """
1786+ Checking the function creation, assertions should all be false.
1787+ """
1788+ function_function = self.registry('functions')
1789+ function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
1790+ for field in self.vals:
1791+ val = function_obj[field]
1792+ if type(val) == browse_record:
1793+ self.assertNotEqual(self.vals[field], val.id,
1794+ "IDs for %s don't match: (%i != %i)" %
1795+ (field, self.vals[field], val.id))
1796+ else:
1797+ self.assertNotEqual(str(self.vals[field]), str(val),
1798+ "Values for %s don't match: (%s != %s)" %
1799+ (field, str(self.vals[field]), str(val)))
1800+
1801+
1802+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1803
1804=== added file 'base_contact_by_functions/tests/test_institutions.py'
1805--- base_contact_by_functions/tests/test_institutions.py 1970-01-01 00:00:00 +0000
1806+++ base_contact_by_functions/tests/test_institutions.py 2014-04-30 15:00:54 +0000
1807@@ -0,0 +1,99 @@
1808+# -*- encoding: utf-8 -*-
1809+##############################################################################
1810+#
1811+# OpenERP, Open Source Management Solution
1812+# This module copyright (C) 2013 Savoir-faire Linux
1813+# (<http://www.savoirfairelinux.com>).
1814+#
1815+# This program is free software: you can redistribute it and/or modify
1816+# it under the terms of the GNU Affero General Public License as
1817+# published by the Free Software Foundation, either version 3 of the
1818+# License, or (at your option) any later version.
1819+#
1820+# This program is distributed in the hope that it will be useful,
1821+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1822+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1823+# GNU Affero General Public License for more details.
1824+#
1825+# You should have received a copy of the GNU Affero General Public License
1826+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1827+#
1828+##############################################################################
1829+
1830+from openerp.tests.common import TransactionCase
1831+from openerp.osv.orm import browse_record
1832+
1833+
1834+class Base_Test_institution(TransactionCase):
1835+ """
1836+ Simple test creating a institution
1837+ This is a base class for institution test cases.
1838+ Inherit from this and setup values.
1839+ """
1840+
1841+ def setUp(self, vals={}):
1842+ """
1843+ Setting up institution.
1844+ """
1845+ # Default test values
1846+ self.vals = {'name': 'This is a test institution name',
1847+ 'sequence': '1',
1848+ 'institutionfunction_ids': '[]',
1849+ }
1850+ super(Base_Test_institution, self).setUp()
1851+ self.vals = dict(self.vals.items() + vals.items())
1852+ # Create the institution object; we will be testing this, so store in self
1853+ institution_institution = self.registry('res.institution')
1854+ self.institution_id = institution_institution.create(self.cr, self.uid, self.vals, context=None)
1855+
1856+ def test_institution(self):
1857+ """
1858+ Checking the institution creation.
1859+ """
1860+ institution_institution = self.registry('res.institution')
1861+ institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
1862+ for field in self.vals:
1863+ val = institution_obj[field]
1864+ if type(val) == browse_record:
1865+ self.assertEquals(self.vals[field], val.id,
1866+ "IDs for %s don't match: (%i != %i)" %
1867+ (field, self.vals[field], val.id))
1868+ else:
1869+ self.assertEquals(str(self.vals[field]), str(val),
1870+ "Values for %s don't match: (%s != %s)" %
1871+ (field, str(self.vals[field]), str(val)))
1872+
1873+
1874+class Test_institution_bad(Base_Test_institution):
1875+ """
1876+ Simple test creating a institution, test against bad values
1877+ """
1878+ def setUp(self):
1879+ """
1880+ Setting up institution, then changing the values to test against.
1881+ """
1882+ super(Test_institution_bad, self).setUp()
1883+ # Change vals to something wrong
1884+ self.vals = {'name': 'This is the wrong institution name',
1885+ 'sequence': '0',
1886+ }
1887+
1888+ def test_institution(self):
1889+ """
1890+ Checking the institution creation, assertions should all be false.
1891+ """
1892+ institution_institution = self.registry('res.institution')
1893+ institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
1894+ for field in self.vals:
1895+ val = institution_obj[field]
1896+ if type(val) == browse_record:
1897+ self.assertNotEqual(self.vals[field], val.id,
1898+ "IDs for %s don't match: (%i != %i)" %
1899+ (field, self.vals[field], val.id))
1900+ else:
1901+ self.assertNotEqual(str(self.vals[field]), str(val),
1902+ "Values for %s don't match: (%s != %s)" %
1903+ (field, str(self.vals[field]), str(val)))
1904+
1905+
1906+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1907
1908=== added file 'base_contact_by_functions/tests/test_partner_category.py'
1909--- base_contact_by_functions/tests/test_partner_category.py 1970-01-01 00:00:00 +0000
1910+++ base_contact_by_functions/tests/test_partner_category.py 2014-04-30 15:00:54 +0000
1911@@ -0,0 +1,105 @@
1912+# -*- encoding: utf-8 -*-
1913+##############################################################################
1914+#
1915+# OpenERP, Open Source Management Solution
1916+# This module copyright (C) 2013 Savoir-faire Linux
1917+# (<http://www.savoirfairelinux.com>).
1918+#
1919+# This program is free software: you can redistribute it and/or modify
1920+# it under the terms of the GNU Affero General Public License as
1921+# published by the Free Software Foundation, either version 3 of the
1922+# License, or (at your option) any later version.
1923+#
1924+# This program is distributed in the hope that it will be useful,
1925+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1926+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1927+# GNU Affero General Public License for more details.
1928+#
1929+# You should have received a copy of the GNU Affero General Public License
1930+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1931+#
1932+##############################################################################
1933+
1934+from openerp.tests.common import TransactionCase
1935+from openerp.osv.orm import browse_record
1936+
1937+
1938+class Base_Test_partner_category(TransactionCase):
1939+ """
1940+ Simple test creating a partner_category
1941+ This is a base class for partner_category test cases.
1942+ Inherit from this and setup values.
1943+ """
1944+
1945+ def setUp(self, vals={}):
1946+ """
1947+ Setting up partner_category.
1948+ """
1949+ # Default test values
1950+ self.vals = {'name': 'This is a test partner_category name',
1951+ 'active': True,
1952+ }
1953+ super(Base_Test_partner_category, self).setUp()
1954+ # Create the parent
1955+ partner_category_partner = self.registry('res.partner.category')
1956+ self.vals['parent_id'] = partner_category_partner.create(self.cr, self.uid, {
1957+ 'name': 'Test parent',
1958+ 'active': True, }, context=None)
1959+
1960+ self.vals = dict(self.vals.items() + vals.items())
1961+ # Create the partner_category object; we will be testing this, so store in self
1962+ self.partner_category_id = partner_category_partner.create(self.cr, self.uid, self.vals, context=None)
1963+
1964+ def test_partner_category(self):
1965+ """
1966+ Checking the partner_category creation.
1967+ """
1968+ partner_category = self.registry('res.partner.category')
1969+ partner_category_obj = partner_category.browse(self.cr, self.uid, self.partner_category_id, context=None)
1970+ for field in self.vals:
1971+ val = partner_category_obj[field]
1972+ if type(val) == browse_record:
1973+ self.assertEquals(self.vals[field], val.id,
1974+ "IDs for %s don't match: (%i != %i)" %
1975+ (field, self.vals[field], val.id))
1976+ else:
1977+ self.assertEquals(str(self.vals[field]), str(val),
1978+ "Values for %s don't match: (%s != %s)" %
1979+ (field, str(self.vals[field]), str(val)))
1980+
1981+
1982+class Test_partner_category_bad(Base_Test_partner_category):
1983+ """
1984+ Simple test creating a partner_category, test against bad values
1985+ """
1986+ def setUp(self):
1987+ """
1988+ Setting up partner_category, then changing the values to test against.
1989+ """
1990+ super(Test_partner_category_bad, self).setUp()
1991+ # Change vals to something wrong
1992+ self.vals = {'name': 'This is the wrong partner_category name',
1993+ 'active': False,
1994+ }
1995+
1996+ def test_partner_category(self):
1997+ """
1998+ Checking the partner_category creation, assertions should all be false.
1999+ """
2000+ partner_category_partner_category = self.registry('res.partner.category')
2001+ partner_category_obj = partner_category_partner_category.browse(self.cr, self.uid,
2002+ self.partner_category_id,
2003+ context=None)
2004+ for field in self.vals:
2005+ val = partner_category_obj[field]
2006+ if type(val) == browse_record:
2007+ self.assertNotEqual(self.vals[field], val.id,
2008+ "IDs for %s don't match: (%i != %i)" %
2009+ (field, self.vals[field], val.id))
2010+ else:
2011+ self.assertNotEqual(str(self.vals[field]), str(val),
2012+ "Values for %s don't match: (%s != %s)" %
2013+ (field, str(self.vals[field]), str(val)))
2014+
2015+
2016+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2017
2018=== added directory 'base_contact_by_functions_partner_firstname'
2019=== added file 'base_contact_by_functions_partner_firstname/__init__.py'
2020--- base_contact_by_functions_partner_firstname/__init__.py 1970-01-01 00:00:00 +0000
2021+++ base_contact_by_functions_partner_firstname/__init__.py 2014-04-30 15:00:54 +0000
2022@@ -0,0 +1,25 @@
2023+# -*- encoding: utf-8 -*-
2024+##############################################################################
2025+#
2026+# OpenERP, Open Source Management Solution
2027+# This module copyright (C) 2013 Savoir-faire Linux
2028+# (<http://www.savoirfairelinux.com>).
2029+#
2030+# This program is free software: you can redistribute it and/or modify
2031+# it under the terms of the GNU Affero General Public License as
2032+# published by the Free Software Foundation, either version 3 of the
2033+# License, or (at your option) any later version.
2034+#
2035+# This program is distributed in the hope that it will be useful,
2036+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2037+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2038+# GNU Affero General Public License for more details.
2039+#
2040+# You should have received a copy of the GNU Affero General Public License
2041+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2042+#
2043+##############################################################################
2044+
2045+import res_partner
2046+
2047+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2048
2049=== added file 'base_contact_by_functions_partner_firstname/__openerp__.py'
2050--- base_contact_by_functions_partner_firstname/__openerp__.py 1970-01-01 00:00:00 +0000
2051+++ base_contact_by_functions_partner_firstname/__openerp__.py 2014-04-30 15:00:54 +0000
2052@@ -0,0 +1,53 @@
2053+# -*- encoding: utf-8 -*-
2054+##############################################################################
2055+#
2056+# OpenERP, Open Source Management Solution
2057+# This module copyright (C) 2013 Savoir-faire Linux
2058+# (<http://www.savoirfairelinux.com>).
2059+#
2060+# This program is free software: you can redistribute it and/or modify
2061+# it under the terms of the GNU Affero General Public License as
2062+# published by the Free Software Foundation, either version 3 of the
2063+# License, or (at your option) any later version.
2064+#
2065+# This program is distributed in the hope that it will be useful,
2066+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2067+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2068+# GNU Affero General Public License for more details.
2069+#
2070+# You should have received a copy of the GNU Affero General Public License
2071+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2072+#
2073+##############################################################################
2074+
2075+{
2076+ 'name': 'Contacts by Functions - Partner Firstname Bindings',
2077+ 'version': '0.1',
2078+ 'category': 'Customer Relationship Management',
2079+ 'summary': 'Contacts by Functions - Partner Firstname Bindings',
2080+ 'description': """
2081+Contacts by Functions - Partner Firstname Bindings
2082+==================================================
2083+
2084+Contributors
2085+------------
2086+* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
2087+""",
2088+ 'author': 'Savoir-faire Linux',
2089+ 'website': 'www.savoirfairelinux.com',
2090+ 'license': 'AGPL-3',
2091+ 'depends': [
2092+ 'base_contact_by_functions',
2093+ 'partner_firstname',
2094+ ],
2095+ 'data': [
2096+ 'res_partner_view.xml',
2097+ ],
2098+ 'test': [],
2099+ 'demo': [
2100+ ],
2101+ 'installable': True,
2102+ 'auto_install': True,
2103+}
2104+
2105+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2106
2107=== added directory 'base_contact_by_functions_partner_firstname/i18n'
2108=== added file 'base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot'
2109--- base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot 1970-01-01 00:00:00 +0000
2110+++ base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot 2014-04-30 15:00:54 +0000
2111@@ -0,0 +1,27 @@
2112+# Translation of OpenERP Server.
2113+# This file contains the translation of the following modules:
2114+# * base_contact_by_functions_partner_firstname
2115+#
2116+msgid ""
2117+msgstr ""
2118+"Project-Id-Version: OpenERP Server 7.0\n"
2119+"Report-Msgid-Bugs-To: \n"
2120+"POT-Creation-Date: 2014-01-03 07:16+0000\n"
2121+"PO-Revision-Date: 2014-01-03 02:17-0500\n"
2122+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
2123+"Language-Team: \n"
2124+"MIME-Version: 1.0\n"
2125+"Content-Type: text/plain; charset=UTF-8\n"
2126+"Content-Transfer-Encoding: 8bit\n"
2127+"Plural-Forms: \n"
2128+"X-Generator: Poedit 1.5.4\n"
2129+
2130+#. module: base_contact_by_functions_partner_firstname
2131+#: view:res.partner:0
2132+msgid "lastname"
2133+msgstr ""
2134+
2135+#. module: base_contact_by_functions_partner_firstname
2136+#: view:res.partner:0
2137+msgid "Firstname"
2138+msgstr ""
2139
2140=== added file 'base_contact_by_functions_partner_firstname/i18n/fr.po'
2141--- base_contact_by_functions_partner_firstname/i18n/fr.po 1970-01-01 00:00:00 +0000
2142+++ base_contact_by_functions_partner_firstname/i18n/fr.po 2014-04-30 15:00:54 +0000
2143@@ -0,0 +1,27 @@
2144+# Translation of OpenERP Server.
2145+# This file contains the translation of the following modules:
2146+# * base_contact_by_functions_partner_firstname
2147+#
2148+msgid ""
2149+msgstr ""
2150+"Project-Id-Version: OpenERP Server 7.0\n"
2151+"Report-Msgid-Bugs-To: \n"
2152+"POT-Creation-Date: 2014-01-03 07:17+0000\n"
2153+"PO-Revision-Date: 2014-01-03 02:18-0500\n"
2154+"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
2155+"Language-Team: \n"
2156+"MIME-Version: 1.0\n"
2157+"Content-Type: text/plain; charset=UTF-8\n"
2158+"Content-Transfer-Encoding: 8bit\n"
2159+"Plural-Forms: \n"
2160+"X-Generator: Poedit 1.5.4\n"
2161+
2162+#. module: base_contact_by_functions_partner_firstname
2163+#: view:res.partner:0
2164+msgid "lastname"
2165+msgstr "Nom"
2166+
2167+#. module: base_contact_by_functions_partner_firstname
2168+#: view:res.partner:0
2169+msgid "Firstname"
2170+msgstr "Prénom"
2171
2172=== added file 'base_contact_by_functions_partner_firstname/res_partner.py'
2173--- base_contact_by_functions_partner_firstname/res_partner.py 1970-01-01 00:00:00 +0000
2174+++ base_contact_by_functions_partner_firstname/res_partner.py 2014-04-30 15:00:54 +0000
2175@@ -0,0 +1,76 @@
2176+# -*- encoding: utf-8 -*-
2177+##############################################################################
2178+#
2179+# OpenERP, Open Source Management Solution
2180+# This module copyright (C) 2013 Savoir-faire Linux
2181+# (<http://www.savoirfairelinux.com>).
2182+#
2183+# This program is free software: you can redistribute it and/or modify
2184+# it under the terms of the GNU Affero General Public License as
2185+# published by the Free Software Foundation, either version 3 of the
2186+# License, or (at your option) any later version.
2187+#
2188+# This program is distributed in the hope that it will be useful,
2189+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2190+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2191+# GNU Affero General Public License for more details.
2192+#
2193+# You should have received a copy of the GNU Affero General Public License
2194+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2195+#
2196+##############################################################################
2197+
2198+import time
2199+from openerp.osv import orm, fields
2200+
2201+
2202+class res_partner(orm.Model):
2203+ """
2204+ Inherits partner and adds functions_ids : List of functions
2205+ """
2206+ _inherit = 'res.partner'
2207+
2208+ def create(self, cr, user, vals, context=None):
2209+ context = self._basecontact_check_context(cr, user, 'create', context)
2210+ if not vals.get('name') and vals.get('contact_id'):
2211+ vals['name'] = self.browse(cr, user, vals['contact_id'], context=context).name
2212+ if vals.get('end_date'):
2213+ if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
2214+ vals['active'] = False
2215+ if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
2216+ contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
2217+ contact_vals['active'] = True
2218+ contact_vals['function_id'] = None
2219+ vals['contact_id'] = super(res_partner, self).create(cr, user, contact_vals,
2220+ context=context)
2221+ self.write(cr, user, vals['contact_id'], {
2222+ 'firstname': vals.get('firstname', ''),
2223+ 'lastname': vals.get('lastname', ''),
2224+ }, context=context)
2225+ # Check if we create existing contact from company(ie: company is true)
2226+ # Check if we create another function from contact view
2227+ if vals.get('contact_type') == 'attached' or (not vals.get('contact_type') and vals.get('contact_id')):
2228+ contact_info = self.browse(cr, user, vals.get('contact_id'), context=context)
2229+ vals['firstname'] = contact_info.firstname
2230+ vals['title'] = contact_info.title.id or ''
2231+
2232+ if ('contact_id'in vals and ('reset_password' in context or
2233+ 'install_mode' in context)):
2234+ return vals['contact_id']
2235+ res = super(res_partner, self).create(cr, user, vals, context=context)
2236+ return res
2237+
2238+ def write(self, cr, user, ids, vals, context=None):
2239+ context = self._basecontact_check_context(cr, user, 'write', context)
2240+ if vals.get('end_date'):
2241+ if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
2242+ vals['active'] = False
2243+ if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
2244+ contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
2245+ contact_vals['active'] = True
2246+ contact_vals['function_id'] = None
2247+ vals['contact_id'] = super(res_partner, self).write(cr, user, contact_vals,
2248+ context=context)
2249+ return super(res_partner, self).write(cr, user, ids, vals, context=context)
2250+
2251+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2252
2253=== added file 'base_contact_by_functions_partner_firstname/res_partner_view.xml'
2254--- base_contact_by_functions_partner_firstname/res_partner_view.xml 1970-01-01 00:00:00 +0000
2255+++ base_contact_by_functions_partner_firstname/res_partner_view.xml 2014-04-30 15:00:54 +0000
2256@@ -0,0 +1,71 @@
2257+<?xml version = "1.0" encoding="utf-8"?>
2258+<openerp>
2259+ <data>
2260+
2261+ <!--Redefine this part of view from firstname_partner module -->
2262+ <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
2263+ <field name="name">res.partner.form.firstname.inherit11</field>
2264+ <field name="model">res.partner</field>
2265+ <field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/>
2266+ <field name="arch" type="xml">
2267+ <!--Redefine firstname field in view partner-->
2268+ <field name="firstname" position="replace">
2269+ <group attrs="{'invisible': [('is_company', '=', True)]}">
2270+ <field name="firstname"/>
2271+ </group>
2272+ </field>
2273+ <!--Redefine firstname field in contact view-->
2274+ <xpath expr="//form[@string='Contact']/sheet/div//field[@name='firstname']" position="replace">
2275+ <field name="firstname" attrs="{'invisible': [('contact_type', '=', 'attached')]}"/>
2276+ </xpath>
2277+ </field>
2278+ </record>
2279+
2280+ <!--Replace name by full name in kanban view-->
2281+ <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
2282+ <field name="model">res.partner</field>
2283+ <field name="inherit_id" ref="base_contact_by_functions.view_contact_by_function_form"/>
2284+ <field name="arch" type="xml">
2285+ <xpath expr="//field[@name='other_contact_history_ids']/kanban//field[@name='name']" position="replace">
2286+ <field name="lastname"/>
2287+ </xpath>
2288+ <xpath expr="//field[@name='other_contact_history_ids']/kanban/templates//t[@t-name='kanban-box']//div[@class='oe_kanban_details']//field[@name='name']"
2289+ position="before">
2290+ <field name="firstname"/>
2291+ </xpath>
2292+ <!--Display firstname and name after Image-->
2293+ <xpath expr="//field[@name='other_contact_history_ids']/form[@string='Contact']/sheet//field[@name='image']"
2294+ position="after">
2295+ <h1>
2296+ <field name="contact_id" style="width: 70%%" readonly="1"/>
2297+ </h1>
2298+ </xpath>
2299+ </field>
2300+ </record>
2301+
2302+ <!--Display firstname and name in kanban view for other position -->
2303+ <record id="view_partner_form_firstname_name" model="ir.ui.view">
2304+ <field name="name">res.partner.form.firstname.name</field>
2305+ <field name="model">res.partner</field>
2306+ <field name="inherit_id" ref="base_contact_by_functions.view_position_info_form"/>
2307+ <field name="arch" type="xml">
2308+ <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//field[@name='name']"
2309+ position="replace"/>
2310+ <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet//field[@name='image']"
2311+ position="after">
2312+ <h1>
2313+ <field name="contact_id" style="width: 70%%" readonly="1"/>
2314+ </h1>
2315+ </xpath>
2316+ <!--I don't want to display the label field, so I hide it-->
2317+ <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//label[@for='name']"
2318+ position="replace"/>
2319+ <!--Add firstname before name in templates view-->
2320+ <xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/h4[@class='oe_partner_heading']//field[@name='name']"
2321+ position="before">
2322+ <field name="firstname"/>
2323+ </xpath>
2324+ </field>
2325+ </record>
2326+ </data>
2327+</openerp>
2328
2329=== added directory 'base_contact_by_functions_partner_firstname/tests'
2330=== added file 'base_contact_by_functions_partner_firstname/tests/__init__.py'
2331--- base_contact_by_functions_partner_firstname/tests/__init__.py 1970-01-01 00:00:00 +0000
2332+++ base_contact_by_functions_partner_firstname/tests/__init__.py 2014-04-30 15:00:54 +0000
2333@@ -0,0 +1,27 @@
2334+# -*- encoding: utf-8 -*-
2335+##############################################################################
2336+#
2337+# OpenERP, Open Source Management Solution
2338+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
2339+# (<http://www.savoirfairelinux.com>).
2340+#
2341+# This program is free software: you can redistribute it and/or modify
2342+# it under the terms of the GNU Affero General Public License as
2343+# published by the Free Software Foundation, either version 3 of the
2344+# License, or (at your option) any later version.
2345+#
2346+# This program is distributed in the hope that it will be useful,
2347+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2348+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2349+# GNU Affero General Public License for more details.
2350+#
2351+# You should have received a copy of the GNU Affero General Public License
2352+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2353+#
2354+##############################################################################
2355+
2356+from . import test_partner
2357+
2358+checks = [
2359+ test_partner,
2360+]
2361
2362=== added file 'base_contact_by_functions_partner_firstname/tests/test_partner.py'
2363--- base_contact_by_functions_partner_firstname/tests/test_partner.py 1970-01-01 00:00:00 +0000
2364+++ base_contact_by_functions_partner_firstname/tests/test_partner.py 2014-04-30 15:00:54 +0000
2365@@ -0,0 +1,51 @@
2366+# -*- encoding: utf-8 -*-
2367+##############################################################################
2368+#
2369+# OpenERP, Open Source Management Solution
2370+# This module copyright (C) 2010 - 2014 Savoir-faire Linux
2371+# (<http://www.savoirfairelinux.com>).
2372+#
2373+# This program is free software: you can redistribute it and/or modify
2374+# it under the terms of the GNU Affero General Public License as
2375+# published by the Free Software Foundation, either version 3 of the
2376+# License, or (at your option) any later version.
2377+#
2378+# This program is distributed in the hope that it will be useful,
2379+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2380+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2381+# GNU Affero General Public License for more details.
2382+#
2383+# You should have received a copy of the GNU Affero General Public License
2384+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2385+#
2386+##############################################################################
2387+
2388+from openerp.tests.common import TransactionCase
2389+
2390+
2391+class test_partner_contact_id(TransactionCase):
2392+
2393+ def setUp(self):
2394+ super(test_partner_contact_id, self).setUp()
2395+ # Clean up registries
2396+ self.registry('ir.model').clear_caches()
2397+ self.registry('ir.model.data').clear_caches()
2398+ # Get registries
2399+ self.user_model = self.registry("res.users")
2400+ self.partner_model = self.registry("res.partner")
2401+ # Get context
2402+ self.context = self.user_model.context_get(self.cr, self.uid)
2403+ # Create values for test, contact also created
2404+ contact_id = self.partner_model.create(self.cr, self.uid, {
2405+ 'name': 'test_contact',
2406+ 'title': 1,
2407+ }, context=self.context)
2408+ self.vals = {
2409+ 'name': 'test_partner',
2410+ 'type': 'contact',
2411+ 'contact_id': contact_id,
2412+ }
2413+
2414+ def test_create_partner(self):
2415+ cr, uid, vals, context = self.cr, self.uid, self.vals, self.context
2416+ self.partner_model.create(cr, uid, vals, context=context)