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 (community) Needs Resubmitting
Stefan Rijnhart (Opener) Needs Information
Sandy Carter (http://www.savoirfairelinux.com) Abstain
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.
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) :
review: Abstain
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

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
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

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.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

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: Needs Resubmitting

Unmerged revisions

46. By Sandy Carter (http://www.savoirfairelinux.com)

Fix KeyError which sometimes arises when installing modules.

Assert that contact_id exists in vals

45. By Sandy Carter (http://www.savoirfairelinux.com)

Fix error when creating partner with contact info

44. By Sandy Carter (http://www.savoirfairelinux.com)

adapt module for community firstname module

43. By El Hadji Dem (http://www.savoirfairelinux.com)

[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)

[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)

[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
=== added directory 'base_contact_by_functions'
=== added file 'base_contact_by_functions/__init__.py'
--- base_contact_by_functions/__init__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/__init__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,27 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import res_partner
24from . import functions
25from . import res_institutions
26
27# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
028
=== added file 'base_contact_by_functions/__openerp__.py'
--- base_contact_by_functions/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/__openerp__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,56 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Contacts by Functions',
25 'version': '0.1',
26 'author': 'Savoir-faire Linux',
27 'maintainer': 'Savoir-faire Linux',
28 'website': 'http://www.savoirfairelinux.com',
29 'category': 'Customer Relationship Management',
30 'description': """
31Contacts by Functions
32=====================
33
34This module allows you to manage contacts by functions
35
36Contributors
37------------
38* EL Hadji Dem (elhadji.dem@savoirfairelinux.com)
39""",
40 'depends': [
41 'base_contact',
42 ],
43 'external_dependencies': {},
44 'data': [
45 'functions_view.xml',
46 'res_institutions_view.xml',
47 'res_partner_view.xml',
48 'security/ir.model.access.csv',
49 ],
50 'demo': [],
51 'test': [],
52 'installable': True,
53 'active': False,
54}
55
56# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
057
=== added file 'base_contact_by_functions/functions.py'
--- base_contact_by_functions/functions.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/functions.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,41 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import fields, orm
24
25
26class functions(orm.Model):
27 _description = 'Functions'
28 _name = 'functions'
29 _columns = {
30 'name': fields.char('Name', size=256, required=True, select=True,
31 help='Name of function.'),
32 'acronym': fields.char('Acronym', size=50, help='Acronym of function.'),
33 'partner_ids': fields.many2many('res.partner',
34 'function_partner_rel',
35 'function_id',
36 'partner_id',
37 'Functions'),
38 'institution_id': fields.many2one("res.institution", 'institution'),
39 }
40
41# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
042
=== added file 'base_contact_by_functions/functions_view.xml'
--- base_contact_by_functions/functions_view.xml 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/functions_view.xml 2014-04-30 15:00:54 +0000
@@ -0,0 +1,38 @@
1<?xml version="1.0" ?>
2<openerp>
3 <data>
4 <!-- Tree Views functions-->
5 <record model="ir.ui.view" id="functions_tree_view">
6 <field name="name">Functions Tree View</field>
7 <field name="model">functions</field>
8 <field name="type">tree</field>
9 <field name="arch" type="xml">
10 <tree string="FunctionsTree" version="7.0">
11 <field name="name"/>
12 <field name="acronym"/>
13 </tree>
14 </field>
15 </record>
16 <!-- Form Views functions-->
17 <record model="ir.ui.view" id="functions_form_view">
18 <field name="name">Functions Form View</field>
19 <field name="model">functions</field>
20 <field name="type">form</field>
21 <field name="arch" type="xml">
22 <form string="FunctionsForm" version="7.0" >
23 <group col="4">
24 <field name="name"/>
25 <field name="acronym"/>
26 </group>
27 </form>
28 </field>
29 </record>
30 <!-- Actions -->
31 <record model="ir.actions.act_window" id="action_functions_tree_list">
32 <field name="name">Functions</field>
33 <field name="view_id" ref="functions_tree_view"/>
34 <field name="res_model">functions</field>
35 <field name="view_mode">tree,form</field>
36 </record>
37 </data>
38</openerp>
039
=== added directory 'base_contact_by_functions/i18n'
=== added file 'base_contact_by_functions/i18n/base_contact_by_functions.pot'
--- base_contact_by_functions/i18n/base_contact_by_functions.pot 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/i18n/base_contact_by_functions.pot 2014-04-30 15:00:54 +0000
@@ -0,0 +1,353 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * base_contact_by_functions
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-28 22:15+0000\n"
10"PO-Revision-Date: 2014-01-28 17:15-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: base_contact_by_functions
20#: field:res.category.functions,category_id:0
21msgid "Category"
22msgstr ""
23
24#. module: base_contact_by_functions
25#: view:res.partner:0
26msgid "City"
27msgstr ""
28
29#. module: base_contact_by_functions
30#: field:functions,partner_ids:0
31#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
32#: model:ir.model,name:base_contact_by_functions.model_functions
33#: field:res.category.functions,functions_id:0 view:res.institution:0
34#: field:res.institution,institutionfunction_ids:0
35#: field:res.institution.functions,functions_id:0 view:res.partner:0
36#: field:res.partner,functions_ids:0 view:res.partner.category:0
37#: field:res.partner.category,categoryfunction_ids:0
38msgid "Functions"
39msgstr ""
40
41#. module: base_contact_by_functions
42#: view:res.partner:0
43msgid "History (Functions)"
44msgstr ""
45
46#. module: base_contact_by_functions
47#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
48msgid "Institutions functions"
49msgstr ""
50
51#. module: base_contact_by_functions
52#: help:res.partner,delivered_country:0
53msgid "Country for which a passport is delivered"
54msgstr ""
55
56#. module: base_contact_by_functions
57#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
58msgid "Contacts"
59msgstr ""
60
61#. module: base_contact_by_functions
62#: view:res.partner:0
63msgid "Street..."
64msgstr ""
65
66#. module: base_contact_by_functions
67#: view:res.institution:0
68msgid "Add functions for this institution"
69msgstr ""
70
71#. module: base_contact_by_functions
72#: view:functions:0 view:res.institution:0 view:res.partner.category:0
73msgid "FunctionsTree"
74msgstr ""
75
76#. module: base_contact_by_functions
77#: sql_constraint:res.institution:0
78msgid "Name already exists"
79msgstr ""
80
81#. module: base_contact_by_functions
82#: view:res.partner:0
83msgid "State"
84msgstr ""
85
86#. module: base_contact_by_functions
87#: help:res.category.functions,sequence:0
88#: help:res.institution.functions,sequence:0
89msgid "Used to order"
90msgstr ""
91
92#. module: base_contact_by_functions
93#: view:functions:0 view:res.institution:0 view:res.partner.category:0
94msgid "FunctionsForm"
95msgstr ""
96
97#. module: base_contact_by_functions
98#: view:res.partner:0
99msgid "e.g. Sales Director"
100msgstr ""
101
102#. module: base_contact_by_functions
103#: help:functions,acronym:0
104msgid "Acronym of function."
105msgstr ""
106
107#. module: base_contact_by_functions
108#: view:res.partner:0
109msgid "Tags..."
110msgstr ""
111
112#. module: base_contact_by_functions
113#: field:res.partner,start_date:0
114msgid "Start date"
115msgstr ""
116
117#. module: base_contact_by_functions
118#: view:res.institution:0
119msgid "InstitutionsForm"
120msgstr ""
121
122#. module: base_contact_by_functions
123#: view:res.partner:0
124msgid "Fax:"
125msgstr ""
126
127#. module: base_contact_by_functions
128#: field:res.partner,expiration_date:0
129msgid "Expiration date"
130msgstr ""
131
132#. module: base_contact_by_functions
133#: view:res.partner:0
134msgid "Function"
135msgstr ""
136
137#. module: base_contact_by_functions
138#: view:res.partner:0
139msgid "Parent Organism"
140msgstr ""
141
142#. module: base_contact_by_functions
143#: view:res.partner:0
144msgid "Zip"
145msgstr ""
146
147#. module: base_contact_by_functions
148#: field:res.partner,delivered_country:0
149msgid "Country Passport"
150msgstr ""
151
152#. module: base_contact_by_functions
153#: field:res.partner,other_contact_history_ids:0
154msgid "unknown"
155msgstr ""
156
157#. module: base_contact_by_functions
158#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
159msgid "Company"
160msgstr ""
161
162#. module: base_contact_by_functions
163#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
164msgid "Categories functions"
165msgstr ""
166
167#. module: base_contact_by_functions
168#: help:res.institution,name:0
169msgid "Name of institution."
170msgstr ""
171
172#. module: base_contact_by_functions
173#: help:res.partner,naming:0
174msgid "Naming."
175msgstr ""
176
177#. module: base_contact_by_functions
178#: view:res.partner:0
179msgid "Tag"
180msgstr ""
181
182#. module: base_contact_by_functions
183#: view:res.partner:0
184msgid "Passport information"
185msgstr ""
186
187#. module: base_contact_by_functions
188#: view:res.partner:0
189msgid "Address"
190msgstr ""
191
192#. module: base_contact_by_functions
193#: view:res.partner:0
194msgid "Parent organism"
195msgstr ""
196
197#. module: base_contact_by_functions
198#: view:res.partner:0
199msgid "have the same form for contact and other postions"
200msgstr ""
201
202#. module: base_contact_by_functions
203#: view:res.partner:0
204msgid "Select functions for this organism"
205msgstr ""
206
207#. module: base_contact_by_functions
208#: view:res.partner:0
209msgid "Phone:"
210msgstr ""
211
212#. module: base_contact_by_functions
213#: field:functions,name:0 field:res.institution,name:0
214msgid "Name"
215msgstr ""
216
217#. module: base_contact_by_functions
218#: view:res.partner:0
219msgid "ZIP"
220msgstr ""
221
222#. module: base_contact_by_functions
223#: view:res.partner:0
224msgid "Use organism address"
225msgstr ""
226
227#. module: base_contact_by_functions
228#: view:res.partner:0
229msgid "Country"
230msgstr ""
231
232#. module: base_contact_by_functions
233#: field:functions,institution_id:0
234msgid "institution"
235msgstr ""
236
237#. module: base_contact_by_functions
238#: view:res.partner:0
239msgid "Is an Organism"
240msgstr ""
241
242#. module: base_contact_by_functions
243#: field:res.partner,function_id:0
244msgid "Position Occupied"
245msgstr ""
246
247#. module: base_contact_by_functions
248#: view:res.partner:0
249msgid "Contact"
250msgstr ""
251
252#. module: base_contact_by_functions
253#: help:res.institution,sequence:0
254msgid "Used to order the institutions"
255msgstr ""
256
257#. module: base_contact_by_functions
258#: view:res.partner:0
259msgid "Mobile:"
260msgstr ""
261
262#. module: base_contact_by_functions
263#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
264msgid "Partner Categories"
265msgstr ""
266
267#. module: base_contact_by_functions
268#: view:res.partner:0
269msgid "Organism"
270msgstr ""
271
272#. module: base_contact_by_functions
273#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
274#: model:ir.model,name:base_contact_by_functions.model_res_institution
275#: field:res.institution.functions,institution_id:0
276msgid "Institutions"
277msgstr ""
278
279#. module: base_contact_by_functions
280#: view:res.partner:0
281msgid "History"
282msgstr ""
283
284#. module: base_contact_by_functions
285#: field:res.partner,end_date:0
286msgid "End date"
287msgstr ""
288
289#. module: base_contact_by_functions
290#: view:res.partner.category:0
291msgid "Add function"
292msgstr ""
293
294#. module: base_contact_by_functions
295#: view:res.partner:0
296msgid "Bank Details"
297msgstr ""
298
299#. module: base_contact_by_functions
300#: view:res.institution:0
301msgid "InstitutionsTree"
302msgstr ""
303
304#. module: base_contact_by_functions
305#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
306#: field:res.institution.functions,sequence:0
307msgid "Sequence"
308msgstr ""
309
310#. module: base_contact_by_functions
311#: view:res.partner:0
312msgid "Bank Accounts"
313msgstr ""
314
315#. module: base_contact_by_functions
316#: view:res.partner:0
317msgid "No, Street, Apartment/Office"
318msgstr ""
319
320#. module: base_contact_by_functions
321#: view:res.partner:0
322msgid "Use address organism"
323msgstr ""
324
325#. module: base_contact_by_functions
326#: field:functions,acronym:0
327msgid "Acronym"
328msgstr ""
329
330#. module: base_contact_by_functions
331#: help:functions,name:0
332msgid "Name of function."
333msgstr ""
334
335#. module: base_contact_by_functions
336#: help:res.partner,passport_number:0
337msgid "Passport number."
338msgstr ""
339
340#. module: base_contact_by_functions
341#: field:res.partner,passport_number:0
342msgid "Passport Number"
343msgstr ""
344
345#. module: base_contact_by_functions
346#: model:ir.model,name:base_contact_by_functions.model_res_partner
347msgid "Partner"
348msgstr ""
349
350#. module: base_contact_by_functions
351#: field:res.partner,naming:0
352msgid "Naming"
353msgstr ""
0354
=== added file 'base_contact_by_functions/i18n/fr.po'
--- base_contact_by_functions/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/i18n/fr.po 2014-04-30 15:00:54 +0000
@@ -0,0 +1,353 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * base_contact_by_functions
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-29 15:16+0000\n"
10"PO-Revision-Date: 2014-01-29 10:19-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: base_contact_by_functions
20#: field:res.category.functions,category_id:0
21msgid "Category"
22msgstr "Catégorie"
23
24#. module: base_contact_by_functions
25#: view:res.partner:0
26msgid "City"
27msgstr "Ville"
28
29#. module: base_contact_by_functions
30#: field:functions,partner_ids:0
31#: model:ir.actions.act_window,name:base_contact_by_functions.action_functions_tree_list
32#: model:ir.model,name:base_contact_by_functions.model_functions
33#: field:res.category.functions,functions_id:0 view:res.institution:0
34#: field:res.institution,institutionfunction_ids:0
35#: field:res.institution.functions,functions_id:0 view:res.partner:0
36#: field:res.partner,functions_ids:0 view:res.partner.category:0
37#: field:res.partner.category,categoryfunction_ids:0
38msgid "Functions"
39msgstr "Fonctions"
40
41#. module: base_contact_by_functions
42#: view:res.partner:0
43msgid "History (Functions)"
44msgstr "Historique (Fonctions)"
45
46#. module: base_contact_by_functions
47#: model:ir.model,name:base_contact_by_functions.model_res_institution_functions
48msgid "Institutions functions"
49msgstr "Fonctions des institutions"
50
51#. module: base_contact_by_functions
52#: help:res.partner,delivered_country:0
53msgid "Country for which a passport is delivered"
54msgstr "Pays pour lequel le passeport est délivré"
55
56#. module: base_contact_by_functions
57#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_contact_form
58msgid "Contacts"
59msgstr "Contacts"
60
61#. module: base_contact_by_functions
62#: view:res.partner:0
63msgid "Street..."
64msgstr "Rue..."
65
66#. module: base_contact_by_functions
67#: view:res.institution:0
68msgid "Add functions for this institution"
69msgstr "Ajouter des fonctions de cette institution"
70
71#. module: base_contact_by_functions
72#: view:functions:0 view:res.institution:0 view:res.partner.category:0
73msgid "FunctionsTree"
74msgstr "FonctionsTree"
75
76#. module: base_contact_by_functions
77#: sql_constraint:res.institution:0
78msgid "Name already exists"
79msgstr "Le nom existe déjà"
80
81#. module: base_contact_by_functions
82#: view:res.partner:0
83msgid "State"
84msgstr "Etat"
85
86#. module: base_contact_by_functions
87#: help:res.category.functions,sequence:0
88#: help:res.institution.functions,sequence:0
89msgid "Used to order"
90msgstr "Permet d'ordonner"
91
92#. module: base_contact_by_functions
93#: view:functions:0 view:res.institution:0 view:res.partner.category:0
94msgid "FunctionsForm"
95msgstr "FonctionsForm"
96
97#. module: base_contact_by_functions
98#: view:res.partner:0
99msgid "e.g. Sales Director"
100msgstr "ex: Directeur de vente"
101
102#. module: base_contact_by_functions
103#: help:functions,acronym:0
104msgid "Acronym of function."
105msgstr "Acronyme de la fonction."
106
107#. module: base_contact_by_functions
108#: view:res.partner:0
109msgid "Tags..."
110msgstr "Etiquettes..."
111
112#. module: base_contact_by_functions
113#: field:res.partner,start_date:0
114msgid "Start date"
115msgstr "Date de début"
116
117#. module: base_contact_by_functions
118#: view:res.institution:0
119msgid "InstitutionsForm"
120msgstr "InstitutionsForm"
121
122#. module: base_contact_by_functions
123#: view:res.partner:0
124msgid "Fax:"
125msgstr "Télécopie :"
126
127#. module: base_contact_by_functions
128#: field:res.partner,expiration_date:0
129msgid "Expiration date"
130msgstr "Date d'expiration"
131
132#. module: base_contact_by_functions
133#: view:res.partner:0
134msgid "Function"
135msgstr "Fonction"
136
137#. module: base_contact_by_functions
138#: view:res.partner:0
139msgid "Fax"
140msgstr "Télécopie"
141
142#. module: base_contact_by_functions
143#: view:res.partner:0
144msgid "Parent Organism"
145msgstr "Organisme parent"
146
147#. module: base_contact_by_functions
148#: field:res.partner,delivered_country:0
149msgid "Country Passport"
150msgstr "Pays de délivrance du passeport"
151
152#. module: base_contact_by_functions
153#: field:res.partner,other_contact_history_ids:0
154msgid "unknown"
155msgstr "inconnu"
156
157#. module: base_contact_by_functions
158#: model:ir.actions.act_window,name:base_contact_by_functions.action_partner_customer_form
159msgid "Company"
160msgstr "Organisme"
161
162#. module: base_contact_by_functions
163#: model:ir.model,name:base_contact_by_functions.model_res_category_functions
164msgid "Categories functions"
165msgstr "Catégories functions"
166
167#. module: base_contact_by_functions
168#: help:res.institution,name:0
169msgid "Name of institution."
170msgstr "Nom de l'institution."
171
172#. module: base_contact_by_functions
173#: help:res.partner,naming:0
174msgid "Naming."
175msgstr "Appellation"
176
177#. module: base_contact_by_functions
178#: view:res.partner:0
179msgid "Tag"
180msgstr "Etiquette"
181
182#. module: base_contact_by_functions
183#: view:res.partner:0
184msgid "Passport information"
185msgstr "Informations du passeport"
186
187#. module: base_contact_by_functions
188#: view:res.partner:0
189msgid "Address"
190msgstr "Adresse"
191
192#. module: base_contact_by_functions
193#: view:res.partner:0
194msgid "Parent organism"
195msgstr "Organisme parent"
196
197#. module: base_contact_by_functions
198#: view:res.partner:0
199msgid "have the same form for contact and other postions"
200msgstr "Avoir le même formulaire de contact et d'autres postions"
201
202#. module: base_contact_by_functions
203#: view:res.partner:0
204msgid "Select functions for this organism"
205msgstr "Sélectionner les fonctions de cet organisme"
206
207#. module: base_contact_by_functions
208#: view:res.partner:0
209msgid "Phone:"
210msgstr "Téléphone:"
211
212#. module: base_contact_by_functions
213#: field:functions,name:0 field:res.institution,name:0
214msgid "Name"
215msgstr "Nom"
216
217#. module: base_contact_by_functions
218#: view:res.partner:0
219msgid "ZIP"
220msgstr "Code postal"
221
222#. module: base_contact_by_functions
223#: view:res.partner:0
224msgid "Use organism address"
225msgstr "Utilisez l'adresse de l'organisme"
226
227#. module: base_contact_by_functions
228#: view:res.partner:0
229msgid "Country"
230msgstr "Pays"
231
232#. module: base_contact_by_functions
233#: field:functions,institution_id:0
234msgid "institution"
235msgstr "institution"
236
237#. module: base_contact_by_functions
238#: view:res.partner:0
239msgid "Is an Organism"
240msgstr "Est un Organisme"
241
242#. module: base_contact_by_functions
243#: field:res.partner,function_id:0
244msgid "Position Occupied"
245msgstr "Fonction Occupée"
246
247#. module: base_contact_by_functions
248#: view:res.partner:0
249msgid "Contact"
250msgstr "Contact"
251
252#. module: base_contact_by_functions
253#: help:res.institution,sequence:0
254msgid "Used to order the institutions"
255msgstr "Permet d'ordonner les institutions"
256
257#. module: base_contact_by_functions
258#: view:res.partner:0
259msgid "Mobile:"
260msgstr "Portable :"
261
262#. module: base_contact_by_functions
263#: model:ir.model,name:base_contact_by_functions.model_res_partner_category
264msgid "Partner Categories"
265msgstr "Catégories de partenaires"
266
267#. module: base_contact_by_functions
268#: view:res.partner:0
269msgid "Organism"
270msgstr "Organisme"
271
272#. module: base_contact_by_functions
273#: model:ir.actions.act_window,name:base_contact_by_functions.action_institutions_tree_list
274#: model:ir.model,name:base_contact_by_functions.model_res_institution
275#: field:res.institution.functions,institution_id:0
276msgid "Institutions"
277msgstr "Institutions"
278
279#. module: base_contact_by_functions
280#: view:res.partner:0
281msgid "History"
282msgstr "Historique"
283
284#. module: base_contact_by_functions
285#: field:res.partner,end_date:0
286msgid "End date"
287msgstr "Date de fin"
288
289#. module: base_contact_by_functions
290#: view:res.partner.category:0
291msgid "Add function"
292msgstr "Ajouter fonction"
293
294#. module: base_contact_by_functions
295#: view:res.partner:0
296msgid "Bank Details"
297msgstr "Coordonnées bancaires"
298
299#. module: base_contact_by_functions
300#: view:res.institution:0
301msgid "InstitutionsTree"
302msgstr "InstitutionsTree"
303
304#. module: base_contact_by_functions
305#: field:res.category.functions,sequence:0 field:res.institution,sequence:0
306#: field:res.institution.functions,sequence:0
307msgid "Sequence"
308msgstr "Séquence"
309
310#. module: base_contact_by_functions
311#: view:res.partner:0
312msgid "Bank Accounts"
313msgstr "Comptes bancaires"
314
315#. module: base_contact_by_functions
316#: view:res.partner:0
317msgid "No, Street, Apartment/Office"
318msgstr "No, Rue, Appartement/Bureau"
319
320#. module: base_contact_by_functions
321#: view:res.partner:0
322msgid "Use address organism"
323msgstr "Utiliser l'adresse de l'organisme"
324
325#. module: base_contact_by_functions
326#: field:functions,acronym:0
327msgid "Acronym"
328msgstr "Acronyme"
329
330#. module: base_contact_by_functions
331#: help:functions,name:0
332msgid "Name of function."
333msgstr "Nom de la fonction."
334
335#. module: base_contact_by_functions
336#: help:res.partner,passport_number:0
337msgid "Passport number."
338msgstr "Numéro de passeport."
339
340#. module: base_contact_by_functions
341#: field:res.partner,passport_number:0
342msgid "Passport Number"
343msgstr "Numéro de passeport."
344
345#. module: base_contact_by_functions
346#: model:ir.model,name:base_contact_by_functions.model_res_partner
347msgid "Partner"
348msgstr "Partenaire"
349
350#. module: base_contact_by_functions
351#: field:res.partner,naming:0
352msgid "Naming"
353msgstr "Appellation"
0354
=== added file 'base_contact_by_functions/res_institutions.py'
--- base_contact_by_functions/res_institutions.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_institutions.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,49 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import fields, orm
24
25
26class res_institutions(orm.Model):
27 _description = 'Institutions'
28 _name = 'res.institution'
29 _order = 'sequence asc'
30 _columns = {
31 'name': fields.char('Name', size=256, required=True, select=True,
32 help='Name of institution.'),
33 'sequence': fields.integer('Sequence', help="Used to order the institutions"),
34 'institutionfunction_ids': fields.one2many('res.institution.functions', 'institution_id', 'Functions'),
35 }
36 _sql_constraints = [('institution_name_unique', 'unique(name)', 'Name already exists')]
37
38
39class res_institutions_functions(orm.Model):
40 _description = 'Institutions functions'
41 _name = 'res.institution.functions'
42 _order = 'sequence asc'
43 _columns = {
44 'functions_id': fields.many2one('functions', 'Functions', required='True'),
45 'sequence': fields.integer('Sequence', help="Used to order"),
46 'institution_id': fields.many2one('res.institution', 'Institutions'),
47 }
48
49# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
050
=== added file 'base_contact_by_functions/res_institutions_view.xml'
--- base_contact_by_functions/res_institutions_view.xml 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_institutions_view.xml 2014-04-30 15:00:54 +0000
@@ -0,0 +1,55 @@
1<?xml version="1.0" ?>
2<openerp>
3 <data>
4 <!-- Tree Views Institutions-->
5 <record model="ir.ui.view" id="institutions_tree_view">
6 <field name="name">Institutions Tree View</field>
7 <field name="model">res.institution</field>
8 <field name="type">tree</field>
9 <field name="arch" type="xml">
10 <tree string="InstitutionsTree" version="7.0">
11 <field name="name"/>
12 <field name="sequence"/>
13 </tree>
14 </field>
15 </record>
16 <!-- Form Views Institutions-->
17 <record model="ir.ui.view" id="institutions_form_view">
18 <field name="name">Institutions Form View</field>
19 <field name="model">res.institution</field>
20 <field name="type">form</field>
21 <field name="arch" type="xml">
22 <form string="InstitutionsForm" version="7.0" >
23 <group col="4">
24 <field name="name"/>
25 <field name="sequence"/>
26 </group>
27 <notebook position="inside">
28 <page string="Functions">
29 <separator string="Add functions for this institution"/>
30 <group col="2" colspan="4">
31 <field name="institutionfunction_ids" nolabel="1">
32 <tree string="FunctionsTree">
33 <field name="sequence"/>
34 <field name="functions_id"/>
35 </tree>
36 <form string="FunctionsForm">
37 <field name="functions_id"/>
38 <field name="sequence"/>
39 </form>
40 </field>
41 </group>
42 </page>
43 </notebook>
44 </form>
45 </field>
46 </record>
47 <!-- Actions -->
48 <record model="ir.actions.act_window" id="action_institutions_tree_list">
49 <field name="name">Institutions</field>
50 <field name="view_id" ref="institutions_tree_view"/>
51 <field name="res_model">res.institution</field>
52 <field name="view_mode">tree,form</field>
53 </record>
54 </data>
55</openerp>
056
=== added file 'base_contact_by_functions/res_partner.py'
--- base_contact_by_functions/res_partner.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_partner.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,102 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import time
24from openerp.osv import orm, fields
25
26
27class res_partner_category(orm.Model):
28 """
29 Inherits partner_category
30 """
31 _inherit = 'res.partner.category'
32 _columns = {
33 'categoryfunction_ids': fields.one2many('res.category.functions', 'category_id', 'Functions'),
34 }
35
36
37class res_category_functions(orm.Model):
38 """
39 Adds this class to link category and functions
40 """
41 _description = 'Categories functions'
42 _name = 'res.category.functions'
43 _order = 'sequence asc'
44 _columns = {
45 'functions_id': fields.many2one('functions', 'Functions', required='True'),
46 'sequence': fields.integer('Sequence', help="Used to order"),
47 'category_id': fields.many2one('res.partner.category', 'Category'),
48 }
49
50
51class res_partner(orm.Model):
52 """
53 Inherits partner and adds functions_ids : List of functions
54 """
55 _inherit = 'res.partner'
56
57 def onchange_partner_function(self, cr, uid, ids, part, context=None):
58 if not part:
59 return {'value': None}
60 partner_ids = self.pool.get('res.partner').search(cr, uid, [('id', '=', part)])
61 functions_ids = self.pool.get('res.partner').browse(cr, uid, partner_ids, context=context)[0].functions_ids
62 result = []
63 if functions_ids:
64 for line in functions_ids:
65 result.append(line.id)
66 dom = {'function_id': [('id', 'in', result)]}
67 return {'domain': dom}
68
69 def _get_history_lines(self, cr, uid, ids, name, arg, context=None):
70 res = {}
71 res_partner_pool = self.pool.get('res.partner')
72 for record in self.browse(cr, uid, ids, context=context):
73
74 if record.is_company:
75 return res
76 contact_ids = res_partner_pool.search(cr, uid,
77 [('contact_id', '=', record.id),
78 ('active', '=', False)],
79 context=context)
80 res[record.id] = [x.id for x in res_partner_pool.browse(cr, uid, contact_ids)
81 if x.end_date and x.end_date <= time.strftime('%Y-%m-%d')]
82 return res
83
84 _columns = {
85 'functions_ids': fields.many2many('functions', 'function_partner_rel', 'partner_id',
86 'function_id', 'Functions'),
87 'start_date': fields.date('Start date'),
88 'end_date': fields.date('End date'),
89 'naming': fields.char('Naming', size=256, help="Naming."),
90 'function_id': fields.many2one('functions', 'Position Occupied'),
91 'other_contact_history_ids': fields.function(_get_history_lines,
92 relation="res.partner",
93 method=True,
94 type="one2many"),
95 # Replace company by Organism
96 'use_parent_address': fields.boolean(
97 'Use Organism Address',
98 help="Select this if you want to set organism's address information for this contact"),
99
100 }
101
102# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0103
=== added file 'base_contact_by_functions/res_partner_view.xml'
--- base_contact_by_functions/res_partner_view.xml 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/res_partner_view.xml 2014-04-30 15:00:54 +0000
@@ -0,0 +1,526 @@
1<?xml version = "1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <!--Add list of functions in partner view-->
5 <record id="view_contact_by_function_form" model="ir.ui.view">
6 <field name="name">contact.functions.form.inherit</field>
7 <field name="model">res.partner</field>
8 <field name="inherit_id" ref="base.view_partner_form"/>
9 <field name="arch" type="xml">
10 <field name="use_parent_address" position="replace">
11 <field name="use_parent_address"
12 class="oe_edit_only oe_inline"
13 on_change="onchange_address(use_parent_address, parent_id)"
14 attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
15 string="Use organism address"/>
16 </field>
17 <label for="use_parent_address" position="replace">
18 <label for="use_parent_address"
19 class="oe_edit_only"
20 attrs="{'invisible': [('parent_id','=', False),('use_parent_address','=',False)]}"
21 string="Use organism address"/>
22 </label>
23 <!--Add ')' at the end of 'Is an Organism?'-->
24 <label for="is_company" position="replace">
25 <label for="is_company" string="Is an Organism"/>)
26 </label>
27 <!--Replace Street placeholder by No, Street, Apartment/Office-->
28 <field name="street" position="attributes">
29 <attribute name="placeholder">No, Street, Apartment/Office</attribute>
30 </field>
31 <field name="fax" position="attributes">
32 <attribute name="string">Fax</attribute>
33 </field>
34
35 <notebook position="inside">
36 <page string="Functions"
37 attrs="{'invisible': [('is_company','=',False), ('child_ids', '=', [])]}"
38 autofocus="autofocus">
39 <separator string="Select functions for this organism"/>
40 <field name="functions_ids"/>
41 </page>
42 <page string="History (Functions)" attrs="{'invisible': ['|','|',('is_company','=',True),('contact_id','!=',False),('other_contact_history_ids','=',[])]}">
43 <separator string="History"/>
44 <field name="other_contact_history_ids" mode="kanban"
45 attrs="{'invisible': [('other_contact_history_ids','=',False)]}">
46 <kanban>
47 <field name="color"/>
48 <field name="name"/>
49 <field name="title"/>
50 <field name="email"/>
51 <field name="parent_id" string="Organism"/>
52 <field name="is_company"/>
53 <field name="function_id" string="Function"/>
54 <field name="phone"/>
55 <field name="street"/>
56 <field name="street2"/>
57 <field name="zip"/>
58 <field name="city"/>
59 <field name="country_id"/>
60 <field name="mobile"/>
61 <field name="fax"/>
62 <field name="state_id"/>
63 <field name="has_image"/>
64 <templates>
65 <t t-name="kanban-box">
66 <div class="oe_kanban_vignette oe_semantic_html_override">
67 <a type="open">
68 <t t-if="record.has_image.raw_value === true">
69 <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
70 class="oe_kanban_image"/>
71 </t>
72 <t t-if="record.has_image.raw_value === false">
73 <t t-if="record.is_company.raw_value === true">
74 <img t-att-src='_s + "/base/static/src/img/company_image.png"'
75 class="oe_kanban_image"/>
76 </t>
77 <t t-if="record.is_company.raw_value === false">
78 <img t-att-src='_s + "/base/static/src/img/avatar.png"'
79 class="oe_kanban_image"/>
80 </t>
81 </t>
82 </a>
83 <div class="oe_kanban_details">
84 <h4 class="oe_partner_heading">
85 <a type="open">
86 <field name="name"/>
87 </a>
88 </h4>
89 <div class="oe_kanban_partner_categories"/>
90 <div class="oe_kanban_partner_links"/>
91 <ul>
92 <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
93 <field name="function_id"/>
94 </li>
95 <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
96 <field name="function_id"/>
97 ,
98 <field name="parent_id"/>
99 </li>
100 <li t-if="record.city.raw_value and !record.country.raw_value">
101 <field name="city"/>
102 </li>
103 <li t-if="!record.city.raw_value and record.country.raw_value">
104 <field name="country"/>
105 </li>
106 <li t-if="record.city.raw_value and record.country.raw_value">
107 <field name="city"/>
108 ,
109 <field name="country"/>
110 </li>
111 <li t-if="record.email.raw_value">
112 <a t-attf-href="mailto:#{record.email.raw_value}">
113 <field name="email"/>
114 </a>
115 </li>
116 </ul>
117 </div>
118 </div>
119 </t>
120 </templates>
121 </kanban>
122 <form string="Contact" version="7.0">
123 <sheet>
124 <field name="image" widget='image' class="oe_avatar oe_left"
125 options='{"preview_image": "image_medium"}'/>
126 <div class="oe_title">
127 <label for="name" class="oe_edit_only"/>
128 <h1>
129 <field name="name" style="width: 70%%"/>
130 </h1>
131 </div>
132 <group>
133 <!-- inherited part -->
134 <field name="category_id" widget="many2many_tags"
135 placeholder="Tags..." style="width: 70%%" string="Tag"/>
136 <field name="parent_id"
137 placeholder="Organism"
138 domain="[('is_company','=',True)]"
139 string="Parent Organism"/>
140 <!-- inherited part end -->
141 <field name="function_id" placeholder="e.g. Sales Director"/>
142 <group colspan="4">
143 <field name="start_date" />
144 <field name="end_date"/>
145 <field name="naming"/>
146 </group>
147 <field name="email"/>
148 <field name="phone"/>
149 <field name="mobile"/>
150 </group>
151 <div>
152 <field name="use_parent_address"/>
153 <label for="use_parent_address" string="Use organism address"/>
154 </div>
155 <group>
156 <label for="type"/>
157 <div name="div_type">
158 <field class="oe_inline" name="type"/>
159 </div>
160 <label for="street" string="Address"
161 attrs="{'invisible': [('use_parent_address','=', True)]}"/>
162 <div attrs="{'invisible': [('use_parent_address','=', True)]}"
163 name="div_address">
164 <field name="street" placeholder="Street..."/>
165 <field name="street2"/>
166 <div class="address_format">
167 <field name="city" placeholder="City" style="width: 40%%"/>
168 <field name="state_id" class="oe_no_button"
169 placeholder="State" style="width: 37%%"
170 options='{"no_open": True}' on_change="onchange_state(state_id)"/>
171 <field name="zip" placeholder="ZIP" style="width: 20%%"/>
172 </div>
173 <field name="country_id" placeholder="Country"
174 class="oe_no_button" options='{"no_open": True}'/>
175 </div>
176 </group>
177 <field name="supplier" invisible="True"/>
178 <group string="Bank Accounts">
179 <field name="bank_ids" nolabel="1">
180 <tree string="Bank Details">
181 <field name="state" invisible="1"/>
182 <field name="sequence" invisible="1"/>
183 <field name="acc_number"/>
184 <field name="bank_name"/>
185 <field name="owner_name"/>
186 </tree>
187 </field>
188 </group>
189 </sheet>
190 </form>
191 </field>
192 </page>
193 </notebook>
194 <!--Replace function by function_id defined by organism-->
195 <field name="function" position="replace"/>
196 </field>
197
198 </record>
199 <!--Add start_date, end_date, naming and account bank in partner view-->
200 <record id="view_position_info_form" model="ir.ui.view">
201 <field name="name">position.info.form.inherit</field>
202 <field name="model">res.partner</field>
203 <field name="inherit_id" ref="base_contact.view_partner_form_inherit"/>
204 <field name="arch" type="xml">
205 <xpath expr="//field[@name='other_contact_ids']/form//field[@name='category_id']"
206 position="attributes">
207 <attribute name="string">Tag</attribute>
208 </xpath>
209 <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
210 position="after">
211 <group colspan="4">
212 <field name="start_date" />
213 <field name="end_date"/>
214 <field name="naming"/>
215 </group>
216 </xpath>
217 <xpath expr="//field[@name='other_contact_ids']/form//field[@name='supplier']"
218 position="after">
219 <group string="Bank Accounts">
220 <field name="bank_ids" nolabel="1"/>
221 </group>
222 </xpath>
223 <xpath expr="//field[@name='other_contact_ids']/form//field[@name='parent_id']"
224 position="replace">
225 <group colspan="4">
226 <field name="parent_id" placeholder="Organism"
227 domain="[('is_company','=',True)]"
228 on_change="onchange_partner_function(parent_id)"
229 string="Parent Organism"/>
230 </group>
231 </xpath>
232 <xpath expr="//field[@name='other_contact_ids']/form//field[@name='function']"
233 position="replace">
234 <group colspan="4">
235 <field name="function_id" string="Function"/>
236 </group>
237 </xpath>
238 <xpath expr="//field[@name='other_contact_ids']/form//label[@for='use_parent_address']"
239 position="replace">
240 <label for="use_parent_address" string="Use address organism"/>
241 </xpath>
242 <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='function']"
243 position="replace">
244 <group colspan="4">
245 <field name="function_id" string="Function"/>
246 </group>
247 </xpath>
248 <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
249 position="after">
250 <templates>
251 <t t-name="kanban-box">
252 <t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
253 <div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')"
254 style="position: relative">
255 <a t-if="! read_only_mode" type="delete"
256 style="position: absolute; right: 0; padding: 4px; diplay: inline-block">
257 X
258 </a>
259 <div class="oe_module_vignette">
260 <a type="open">
261 <t t-if="record.has_image.raw_value === true">
262 <img t-att-src="kanban_image('res.partner', 'image',
263 record.id.value, {'preview_image': 'image_small'})"
264 class="oe_avatar oe_kanban_avatar_smallbox"/>
265 </t>
266 <t t-if="record.image and record.image.raw_value !== false">
267 <img t-att-src="'data:image/png;base64,'+record.image.raw_value"
268 class="oe_avatar oe_kanban_avatar_smallbox"/>
269 </t>
270 <t t-if="record.has_image.raw_value === false
271 and (!record.image or record.image.raw_value === false)">
272 <t t-if="record.is_company.raw_value === true">
273 <img t-att-src='_s + "/base/static/src/img/company_image.png"'
274 class="oe_kanban_image oe_kanban_avatar_smallbox"/>
275 </t>
276 <t t-if="record.is_company.raw_value === false">
277 <img t-att-src='_s + "/base/static/src/img/avatar.png"'
278 class="oe_kanban_image oe_kanban_avatar_smallbox"/>
279 </t>
280 </t>
281 </a>
282 <div class="oe_module_desc">
283 <div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_color_border">
284 <table class="oe_kanban_table">
285 <tr>
286 <td class="oe_kanban_title1" align="left" valign="middle">
287 <h4>
288 <a type="open">
289 <field name="name"/>
290 </a>
291 </h4>
292 <i>
293 <t t-if="record.parent_id.raw_value and !record.function_id.raw_value">
294 <field name="parent_id"/>
295 </t>
296 <t t-if="!record.parent_id.raw_value and record.function_id.raw_value">
297 <field name="function_id"/>
298 </t>
299 <t t-if="record.parent_id.raw_value and record.function_id.raw_value">
300 <field name="function_id"/>
301 ,
302 <field name="parent_id"/>
303 </t>
304 </i>
305 <div>
306 <a t-if="record.email.raw_value" title="Mail"
307 t-att-href="'mailto:'+record.email.value">
308 <field name="email"/>
309 </a>
310 </div>
311 <div t-if="record.phone.raw_value">
312 Phone: <field name="phone"/>
313 </div>
314 <div t-if="record.mobile.raw_value">
315 Mobile: <field name="mobile"/>
316 </div>
317 <div t-if="record.fax.raw_value">
318 Fax: <field name="fax"/>
319 </div>
320 </td>
321 </tr>
322 </table>
323 </div>
324 </div>
325 </div>
326 </div>
327 </t>
328 </templates>
329 </xpath>
330 have the same form for contact and other postions
331 <field name="parent_id" position="replace">
332 <field name="parent_id" placeholder="Parent organism"
333 domain="[('is_company','=',True)]"
334 attrs="{'invisible': [('is_company','=', False)]}"/>
335 </field>
336 <xpath expr="//field[@name='child_ids']/form//field[@name='supplier']"
337 position="after">
338 <group string="Bank Accounts">
339 <field name="bank_ids" nolabel="1"/>
340 </group>
341 </xpath>
342
343 <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
344 position="after">
345 <group colspan="4">
346 <field name="start_date" />
347 <field name="end_date"/>
348 <field name="naming"/>
349 </group>
350 </xpath>
351 <xpath expr="//field[@name='child_ids']/form//field[@name='function']"
352 position="replace">
353 <group colspan="4">
354 <field name="parent_id"
355 placeholder="Organism"
356 domain="[('is_company','=',True)]"
357 string="Parent organism" />
358 <field name="function_id"
359 readonly="False"
360 domain="[('id', 'in', parent.functions_ids[0][2])]"
361 string="Function"/>
362 </group>
363 </xpath>
364
365 <xpath expr="//field[@name='child_ids']/form//label[@for='use_parent_address']"
366 position="replace">
367 <label for="use_parent_address" string="Use address organism"/>
368 </xpath>
369
370 <xpath expr="//field[@name='child_ids']/kanban//field[@name='function']"
371 position="replace">
372 <group colspan="4">
373 <field name="function_id" string="Function"/>
374 </group>
375 </xpath>
376 <xpath expr="//field[@name='other_contact_ids']/kanban//field[@name='has_image']"
377 position="after">
378 <templates>
379 <t t-name="kanban-box">
380 <div class="oe_kanban_vignette oe_semantic_html_override">
381 <a type="open">
382 <t t-if="record.has_image.raw_value === true">
383 <img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)"
384 class="oe_kanban_image"/>
385 </t>
386 <t t-if="record.has_image.raw_value === false">
387 <t t-if="record.is_company.raw_value === true">
388 <img t-att-src='_s + "/base/static/src/img/company_image.png"'
389 class="oe_kanban_image"/>
390 </t>
391 <t t-if="record.is_company.raw_value === false">
392 <img t-att-src='_s + "/base/static/src/img/avatar.png"'
393 class="oe_kanban_image"/>
394 </t>
395 </t>
396 </a>
397 <div class="oe_kanban_details">
398 <h4 class="oe_partner_heading">
399 <a type="open">
400 <field name="name"/>
401 </a>
402 </h4>
403 <div class="oe_kanban_partner_categories"/>
404 <div class="oe_kanban_partner_links"/>
405 <ul>
406 <li t-if="record.parent_id.raw_value and !record.function_id.raw_value">
407 <field name="parent_id"/>
408 </li>
409 <li t-if="!record.parent_id.raw_value and record.function_id.raw_value">
410 <field name="function_id"/>
411 </li>
412 <li t-if="record.parent_id.raw_value and record.function_id.raw_value">
413 <field name="function_id"/>
414 ,
415 <field name="parent_id"/>
416 </li>
417 <li t-if="record.city.raw_value and !record.country.raw_value">
418 <field name="city"/>
419 </li>
420 <li t-if="!record.city.raw_value and record.country.raw_value">
421 <field name="country"/>
422 </li>
423 <li t-if="record.city.raw_value and record.country.raw_value">
424 <field name="city"/>
425 ,
426 <field name="country"/>
427 </li>
428 <li t-if="record.email.raw_value">
429 <a t-attf-href="mailto:#{record.email.raw_value}">
430 <field name="email"/>
431 </a>
432 </li>
433 </ul>
434 </div>
435 </div>
436 </t>
437 </templates>
438 </xpath>
439 </field>
440 </record>
441 <!-- Actions for organism -->
442 <record id="action_partner_customer_form" model="ir.actions.act_window">
443 <field name="name">Company</field>
444 <field name="type">ir.actions.act_window</field>
445 <field name="res_model">res.partner</field>
446 <field name="view_type">form</field>
447 <field name="view_mode">kanban,tree,form</field>
448 <field name="domain">[('is_company','=',1)]</field>
449 <field name="context" eval="{'default_is_company': True}"/>
450 <field name="filter" eval="True"/>
451 </record>
452 <!-- Actions for Contacts -->
453 <record id="action_partner_contact_form" model="ir.actions.act_window">
454 <field name="name">Contacts</field>
455 <field name="type">ir.actions.act_window</field>
456 <field name="res_model">res.partner</field>
457 <field name="view_type">form</field>
458 <field name="view_mode">kanban,tree,form</field>
459 <field name="domain">[('is_company','=',0)]</field>
460 <field name="filter" eval="True"/>
461 </record>
462
463 <!--Add country,street fields in tree partner view-->
464 <record model="ir.ui.view" id="view_partner_tree_country_address">
465 <field name="model">res.partner</field>
466 <field name="inherit_id" ref="base.view_partner_tree"/>
467 <field name="arch" type="xml">
468 <field name="country_id" position="replace"/>
469 <field name="name" position="after">
470 <field name="country_id"/>
471 </field>
472 <field name="email" position="after">
473 <field name="street" string="Address"/>
474 </field>
475 </field>
476 </record>
477
478 <!-- Inherit Categories adding functions -->
479 <record id="view_partner_category_functions_form" model="ir.ui.view">
480 <field name="name">Partner Categories Functions</field>
481 <field name="model">res.partner.category</field>
482 <field name="inherit_id" ref="base.view_partner_category_form"/>
483 <field name="arch" type="xml">
484 <xpath expr="//form[@string='Partner Category']/group[1]"
485 position="after">
486 <notebook position="inside">
487 <page string="Functions">
488 <separator string="Add function"/>
489 <group col="2" colspan="4">
490 <field name="categoryfunction_ids" nolabel="1">
491 <tree string="FunctionsTree">
492 <field name="sequence"/>
493 <field name="functions_id"/>
494 </tree>
495 <form string="FunctionsForm">
496 <field name="functions_id"/>
497 <field name="sequence"/>
498 </form>
499 </field>
500 </group>
501 </page>
502 </notebook>
503 </xpath>
504 </field>
505 </record>
506
507 <!--Replace company by organism-->
508 <record id="view_partner_simple_form" model="ir.ui.view">
509 <field name="name">res.partner.simplified.form</field>
510 <field name="model">res.partner</field>
511 <field name="arch" type="xml">
512 <label for="is_company" position="replace">
513 <label for="is_company" string="Is an Organism"/>
514 </label>
515 <field name="parent_id" position="replace">
516 <field name="parent_id"
517 placeholder="Organism"
518 domain="[('is_company', '=', True)]"
519 context="{'default_is_company': True, 'default_supplier': supplier}"
520 attrs="{'invisible': [('is_company','=', True),('parent_id', '=', False)]}"
521 on_change="onchange_address(use_parent_address, parent_id)"/>
522 </field>
523 </field>
524 </record>
525 </data>
526</openerp>
0527
=== added directory 'base_contact_by_functions/security'
=== added file 'base_contact_by_functions/security/ir.model.access.csv'
--- base_contact_by_functions/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/security/ir.model.access.csv 2014-04-30 15:00:54 +0000
@@ -0,0 +1,5 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2"access_functions","functions_user","model_functions","base.group_user",1,1,1,1
3"access_res_category_functions","access_res_category_functions_user","model_res_category_functions","base.group_user",1,1,1,1
4"access_res_institution","access_res_institution_user","model_res_institution","base.group_user",1,1,1,1
5"access_res_institution_functions","access_res_institution_functions_user","model_res_institution_functions","base.group_user",1,1,1,1
06
=== added directory 'base_contact_by_functions/tests'
=== added file 'base_contact_by_functions/tests/__init__.py'
--- base_contact_by_functions/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/__init__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,31 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import test_functions
24from . import test_institutions
25from . import test_partner_category
26
27checks = [
28 test_functions,
29 test_institutions,
30 test_partner_category
31]
032
=== added file 'base_contact_by_functions/tests/test_functions.py'
--- base_contact_by_functions/tests/test_functions.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_functions.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,98 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tests.common import TransactionCase
24from openerp.osv.orm import browse_record
25
26
27class Base_Test_function(TransactionCase):
28 """
29 Simple test creating a function
30 This is a base class for function test cases.
31 Inherit from this and setup values.
32 """
33
34 def setUp(self, vals={}):
35 """
36 Setting up function.
37 """
38 # Default test values
39 self.vals = {'name': 'This is a test function name',
40 'acronym': 'This is a test function acronym',
41 }
42 super(Base_Test_function, self).setUp()
43 self.vals = dict(self.vals.items() + vals.items())
44 # Create the function object; we will be testing this, so store in self
45 function_function = self.registry('functions')
46 self.function_id = function_function.create(self.cr, self.uid, self.vals, context=None)
47
48 def test_function(self):
49 """
50 Checking the function creation.
51 """
52 function_function = self.registry('functions')
53 function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
54 for field in self.vals:
55 val = function_obj[field]
56 if type(val) == browse_record:
57 self.assertEquals(self.vals[field], val.id,
58 "IDs for %s don't match: (%i != %i)" %
59 (field, self.vals[field], val.id))
60 else:
61 self.assertEquals(str(self.vals[field]), str(val),
62 "Values for %s don't match: (%s != %s)" %
63 (field, str(self.vals[field]), str(val)))
64
65
66class Test_function_bad(Base_Test_function):
67 """
68 Simple test creating a function, test against bad values
69 """
70 def setUp(self):
71 """
72 Setting up function, then changing the values to test against.
73 """
74 super(Test_function_bad, self).setUp()
75 # Change vals to something wrong
76 self.vals = {'name': 'This is the wrong function name',
77 'acronym': 'This is the wrong function acronym',
78 }
79
80 def test_function(self):
81 """
82 Checking the function creation, assertions should all be false.
83 """
84 function_function = self.registry('functions')
85 function_obj = function_function.browse(self.cr, self.uid, self.function_id, context=None)
86 for field in self.vals:
87 val = function_obj[field]
88 if type(val) == browse_record:
89 self.assertNotEqual(self.vals[field], val.id,
90 "IDs for %s don't match: (%i != %i)" %
91 (field, self.vals[field], val.id))
92 else:
93 self.assertNotEqual(str(self.vals[field]), str(val),
94 "Values for %s don't match: (%s != %s)" %
95 (field, str(self.vals[field]), str(val)))
96
97
98# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
099
=== added file 'base_contact_by_functions/tests/test_institutions.py'
--- base_contact_by_functions/tests/test_institutions.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_institutions.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,99 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tests.common import TransactionCase
24from openerp.osv.orm import browse_record
25
26
27class Base_Test_institution(TransactionCase):
28 """
29 Simple test creating a institution
30 This is a base class for institution test cases.
31 Inherit from this and setup values.
32 """
33
34 def setUp(self, vals={}):
35 """
36 Setting up institution.
37 """
38 # Default test values
39 self.vals = {'name': 'This is a test institution name',
40 'sequence': '1',
41 'institutionfunction_ids': '[]',
42 }
43 super(Base_Test_institution, self).setUp()
44 self.vals = dict(self.vals.items() + vals.items())
45 # Create the institution object; we will be testing this, so store in self
46 institution_institution = self.registry('res.institution')
47 self.institution_id = institution_institution.create(self.cr, self.uid, self.vals, context=None)
48
49 def test_institution(self):
50 """
51 Checking the institution creation.
52 """
53 institution_institution = self.registry('res.institution')
54 institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
55 for field in self.vals:
56 val = institution_obj[field]
57 if type(val) == browse_record:
58 self.assertEquals(self.vals[field], val.id,
59 "IDs for %s don't match: (%i != %i)" %
60 (field, self.vals[field], val.id))
61 else:
62 self.assertEquals(str(self.vals[field]), str(val),
63 "Values for %s don't match: (%s != %s)" %
64 (field, str(self.vals[field]), str(val)))
65
66
67class Test_institution_bad(Base_Test_institution):
68 """
69 Simple test creating a institution, test against bad values
70 """
71 def setUp(self):
72 """
73 Setting up institution, then changing the values to test against.
74 """
75 super(Test_institution_bad, self).setUp()
76 # Change vals to something wrong
77 self.vals = {'name': 'This is the wrong institution name',
78 'sequence': '0',
79 }
80
81 def test_institution(self):
82 """
83 Checking the institution creation, assertions should all be false.
84 """
85 institution_institution = self.registry('res.institution')
86 institution_obj = institution_institution.browse(self.cr, self.uid, self.institution_id, context=None)
87 for field in self.vals:
88 val = institution_obj[field]
89 if type(val) == browse_record:
90 self.assertNotEqual(self.vals[field], val.id,
91 "IDs for %s don't match: (%i != %i)" %
92 (field, self.vals[field], val.id))
93 else:
94 self.assertNotEqual(str(self.vals[field]), str(val),
95 "Values for %s don't match: (%s != %s)" %
96 (field, str(self.vals[field]), str(val)))
97
98
99# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0100
=== added file 'base_contact_by_functions/tests/test_partner_category.py'
--- base_contact_by_functions/tests/test_partner_category.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions/tests/test_partner_category.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,105 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tests.common import TransactionCase
24from openerp.osv.orm import browse_record
25
26
27class Base_Test_partner_category(TransactionCase):
28 """
29 Simple test creating a partner_category
30 This is a base class for partner_category test cases.
31 Inherit from this and setup values.
32 """
33
34 def setUp(self, vals={}):
35 """
36 Setting up partner_category.
37 """
38 # Default test values
39 self.vals = {'name': 'This is a test partner_category name',
40 'active': True,
41 }
42 super(Base_Test_partner_category, self).setUp()
43 # Create the parent
44 partner_category_partner = self.registry('res.partner.category')
45 self.vals['parent_id'] = partner_category_partner.create(self.cr, self.uid, {
46 'name': 'Test parent',
47 'active': True, }, context=None)
48
49 self.vals = dict(self.vals.items() + vals.items())
50 # Create the partner_category object; we will be testing this, so store in self
51 self.partner_category_id = partner_category_partner.create(self.cr, self.uid, self.vals, context=None)
52
53 def test_partner_category(self):
54 """
55 Checking the partner_category creation.
56 """
57 partner_category = self.registry('res.partner.category')
58 partner_category_obj = partner_category.browse(self.cr, self.uid, self.partner_category_id, context=None)
59 for field in self.vals:
60 val = partner_category_obj[field]
61 if type(val) == browse_record:
62 self.assertEquals(self.vals[field], val.id,
63 "IDs for %s don't match: (%i != %i)" %
64 (field, self.vals[field], val.id))
65 else:
66 self.assertEquals(str(self.vals[field]), str(val),
67 "Values for %s don't match: (%s != %s)" %
68 (field, str(self.vals[field]), str(val)))
69
70
71class Test_partner_category_bad(Base_Test_partner_category):
72 """
73 Simple test creating a partner_category, test against bad values
74 """
75 def setUp(self):
76 """
77 Setting up partner_category, then changing the values to test against.
78 """
79 super(Test_partner_category_bad, self).setUp()
80 # Change vals to something wrong
81 self.vals = {'name': 'This is the wrong partner_category name',
82 'active': False,
83 }
84
85 def test_partner_category(self):
86 """
87 Checking the partner_category creation, assertions should all be false.
88 """
89 partner_category_partner_category = self.registry('res.partner.category')
90 partner_category_obj = partner_category_partner_category.browse(self.cr, self.uid,
91 self.partner_category_id,
92 context=None)
93 for field in self.vals:
94 val = partner_category_obj[field]
95 if type(val) == browse_record:
96 self.assertNotEqual(self.vals[field], val.id,
97 "IDs for %s don't match: (%i != %i)" %
98 (field, self.vals[field], val.id))
99 else:
100 self.assertNotEqual(str(self.vals[field]), str(val),
101 "Values for %s don't match: (%s != %s)" %
102 (field, str(self.vals[field]), str(val)))
103
104
105# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0106
=== added directory 'base_contact_by_functions_partner_firstname'
=== added file 'base_contact_by_functions_partner_firstname/__init__.py'
--- base_contact_by_functions_partner_firstname/__init__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/__init__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,25 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import res_partner
24
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
026
=== added file 'base_contact_by_functions_partner_firstname/__openerp__.py'
--- base_contact_by_functions_partner_firstname/__openerp__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/__openerp__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,53 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23{
24 'name': 'Contacts by Functions - Partner Firstname Bindings',
25 'version': '0.1',
26 'category': 'Customer Relationship Management',
27 'summary': 'Contacts by Functions - Partner Firstname Bindings',
28 'description': """
29Contacts by Functions - Partner Firstname Bindings
30==================================================
31
32Contributors
33------------
34* El Hadji Dem (elhadji.dem@savoirfairelinux.com)
35""",
36 'author': 'Savoir-faire Linux',
37 'website': 'www.savoirfairelinux.com',
38 'license': 'AGPL-3',
39 'depends': [
40 'base_contact_by_functions',
41 'partner_firstname',
42 ],
43 'data': [
44 'res_partner_view.xml',
45 ],
46 'test': [],
47 'demo': [
48 ],
49 'installable': True,
50 'auto_install': True,
51}
52
53# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
054
=== added directory 'base_contact_by_functions_partner_firstname/i18n'
=== added file 'base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot'
--- base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/i18n/base_contact_by_functions_partner_firstname.pot 2014-04-30 15:00:54 +0000
@@ -0,0 +1,27 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * base_contact_by_functions_partner_firstname
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-03 07:16+0000\n"
10"PO-Revision-Date: 2014-01-03 02:17-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: base_contact_by_functions_partner_firstname
20#: view:res.partner:0
21msgid "lastname"
22msgstr ""
23
24#. module: base_contact_by_functions_partner_firstname
25#: view:res.partner:0
26msgid "Firstname"
27msgstr ""
028
=== added file 'base_contact_by_functions_partner_firstname/i18n/fr.po'
--- base_contact_by_functions_partner_firstname/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/i18n/fr.po 2014-04-30 15:00:54 +0000
@@ -0,0 +1,27 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * base_contact_by_functions_partner_firstname
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-01-03 07:17+0000\n"
10"PO-Revision-Date: 2014-01-03 02:18-0500\n"
11"Last-Translator: EL Hadji DEM <elhadji.dem@savoirfairelinux.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: base_contact_by_functions_partner_firstname
20#: view:res.partner:0
21msgid "lastname"
22msgstr "Nom"
23
24#. module: base_contact_by_functions_partner_firstname
25#: view:res.partner:0
26msgid "Firstname"
27msgstr "Prénom"
028
=== added file 'base_contact_by_functions_partner_firstname/res_partner.py'
--- base_contact_by_functions_partner_firstname/res_partner.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/res_partner.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,76 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2013 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import time
24from openerp.osv import orm, fields
25
26
27class res_partner(orm.Model):
28 """
29 Inherits partner and adds functions_ids : List of functions
30 """
31 _inherit = 'res.partner'
32
33 def create(self, cr, user, vals, context=None):
34 context = self._basecontact_check_context(cr, user, 'create', context)
35 if not vals.get('name') and vals.get('contact_id'):
36 vals['name'] = self.browse(cr, user, vals['contact_id'], context=context).name
37 if vals.get('end_date'):
38 if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
39 vals['active'] = False
40 if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
41 contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
42 contact_vals['active'] = True
43 contact_vals['function_id'] = None
44 vals['contact_id'] = super(res_partner, self).create(cr, user, contact_vals,
45 context=context)
46 self.write(cr, user, vals['contact_id'], {
47 'firstname': vals.get('firstname', ''),
48 'lastname': vals.get('lastname', ''),
49 }, context=context)
50 # Check if we create existing contact from company(ie: company is true)
51 # Check if we create another function from contact view
52 if vals.get('contact_type') == 'attached' or (not vals.get('contact_type') and vals.get('contact_id')):
53 contact_info = self.browse(cr, user, vals.get('contact_id'), context=context)
54 vals['firstname'] = contact_info.firstname
55 vals['title'] = contact_info.title.id or ''
56
57 if ('contact_id'in vals and ('reset_password' in context or
58 'install_mode' in context)):
59 return vals['contact_id']
60 res = super(res_partner, self).create(cr, user, vals, context=context)
61 return res
62
63 def write(self, cr, user, ids, vals, context=None):
64 context = self._basecontact_check_context(cr, user, 'write', context)
65 if vals.get('end_date'):
66 if vals['end_date'] and vals['end_date'] <= time.strftime('%Y-%m-%d'):
67 vals['active'] = False
68 if vals.get('contact_type') and vals.get('contact_type') == 'standalone':
69 contact_vals = {key: vals[key] for key in vals.keys() if key != 'parent_id'}
70 contact_vals['active'] = True
71 contact_vals['function_id'] = None
72 vals['contact_id'] = super(res_partner, self).write(cr, user, contact_vals,
73 context=context)
74 return super(res_partner, self).write(cr, user, ids, vals, context=context)
75
76# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
077
=== added file 'base_contact_by_functions_partner_firstname/res_partner_view.xml'
--- base_contact_by_functions_partner_firstname/res_partner_view.xml 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/res_partner_view.xml 2014-04-30 15:00:54 +0000
@@ -0,0 +1,71 @@
1<?xml version = "1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <!--Redefine this part of view from firstname_partner module -->
6 <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
7 <field name="name">res.partner.form.firstname.inherit11</field>
8 <field name="model">res.partner</field>
9 <field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/>
10 <field name="arch" type="xml">
11 <!--Redefine firstname field in view partner-->
12 <field name="firstname" position="replace">
13 <group attrs="{'invisible': [('is_company', '=', True)]}">
14 <field name="firstname"/>
15 </group>
16 </field>
17 <!--Redefine firstname field in contact view-->
18 <xpath expr="//form[@string='Contact']/sheet/div//field[@name='firstname']" position="replace">
19 <field name="firstname" attrs="{'invisible': [('contact_type', '=', 'attached')]}"/>
20 </xpath>
21 </field>
22 </record>
23
24 <!--Replace name by full name in kanban view-->
25 <record id="view_partner_form_firstname_inherit11" model="ir.ui.view">
26 <field name="model">res.partner</field>
27 <field name="inherit_id" ref="base_contact_by_functions.view_contact_by_function_form"/>
28 <field name="arch" type="xml">
29 <xpath expr="//field[@name='other_contact_history_ids']/kanban//field[@name='name']" position="replace">
30 <field name="lastname"/>
31 </xpath>
32 <xpath expr="//field[@name='other_contact_history_ids']/kanban/templates//t[@t-name='kanban-box']//div[@class='oe_kanban_details']//field[@name='name']"
33 position="before">
34 <field name="firstname"/>
35 </xpath>
36 <!--Display firstname and name after Image-->
37 <xpath expr="//field[@name='other_contact_history_ids']/form[@string='Contact']/sheet//field[@name='image']"
38 position="after">
39 <h1>
40 <field name="contact_id" style="width: 70%%" readonly="1"/>
41 </h1>
42 </xpath>
43 </field>
44 </record>
45
46 <!--Display firstname and name in kanban view for other position -->
47 <record id="view_partner_form_firstname_name" model="ir.ui.view">
48 <field name="name">res.partner.form.firstname.name</field>
49 <field name="model">res.partner</field>
50 <field name="inherit_id" ref="base_contact_by_functions.view_position_info_form"/>
51 <field name="arch" type="xml">
52 <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//field[@name='name']"
53 position="replace"/>
54 <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet//field[@name='image']"
55 position="after">
56 <h1>
57 <field name="contact_id" style="width: 70%%" readonly="1"/>
58 </h1>
59 </xpath>
60 <!--I don't want to display the label field, so I hide it-->
61 <xpath expr="//field[@name='other_contact_ids']/form[@string='Contact']/sheet/div//label[@for='name']"
62 position="replace"/>
63 <!--Add firstname before name in templates view-->
64 <xpath expr="//t[@t-name='kanban-box']//div[@class='oe_kanban_details']/h4[@class='oe_partner_heading']//field[@name='name']"
65 position="before">
66 <field name="firstname"/>
67 </xpath>
68 </field>
69 </record>
70 </data>
71</openerp>
072
=== added directory 'base_contact_by_functions_partner_firstname/tests'
=== added file 'base_contact_by_functions_partner_firstname/tests/__init__.py'
--- base_contact_by_functions_partner_firstname/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/tests/__init__.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,27 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import test_partner
24
25checks = [
26 test_partner,
27]
028
=== added file 'base_contact_by_functions_partner_firstname/tests/test_partner.py'
--- base_contact_by_functions_partner_firstname/tests/test_partner.py 1970-01-01 00:00:00 +0000
+++ base_contact_by_functions_partner_firstname/tests/test_partner.py 2014-04-30 15:00:54 +0000
@@ -0,0 +1,51 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# This module copyright (C) 2010 - 2014 Savoir-faire Linux
6# (<http://www.savoirfairelinux.com>).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.tests.common import TransactionCase
24
25
26class test_partner_contact_id(TransactionCase):
27
28 def setUp(self):
29 super(test_partner_contact_id, self).setUp()
30 # Clean up registries
31 self.registry('ir.model').clear_caches()
32 self.registry('ir.model.data').clear_caches()
33 # Get registries
34 self.user_model = self.registry("res.users")
35 self.partner_model = self.registry("res.partner")
36 # Get context
37 self.context = self.user_model.context_get(self.cr, self.uid)
38 # Create values for test, contact also created
39 contact_id = self.partner_model.create(self.cr, self.uid, {
40 'name': 'test_contact',
41 'title': 1,
42 }, context=self.context)
43 self.vals = {
44 'name': 'test_partner',
45 'type': 'contact',
46 'contact_id': contact_id,
47 }
48
49 def test_create_partner(self):
50 cr, uid, vals, context = self.cr, self.uid, self.vals, self.context
51 self.partner_model.create(cr, uid, vals, context=context)