Merge lp:~joao-gama/partner-contact-management/partner_auto_salesman into lp:~partner-contact-core-editors/partner-contact-management/7.0

Proposed by Joao Alfredo Gama Batista
Status: Merged
Approved by: Maxime Chambreuil (http://www.savoirfairelinux.com)
Approved revision: 19
Merged at revision: 18
Proposed branch: lp:~joao-gama/partner-contact-management/partner_auto_salesman
Merge into: lp:~partner-contact-core-editors/partner-contact-management/7.0
Diff against target: 99 lines (+84/-0)
3 files modified
partner_auto_salesman/__init__.py (+22/-0)
partner_auto_salesman/__openerp__.py (+35/-0)
partner_auto_salesman/res_partner.py (+27/-0)
To merge this branch: bzr merge lp:~joao-gama/partner-contact-management/partner_auto_salesman
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review, no test Approve
Maxime Chambreuil (http://www.savoirfairelinux.com) lgtm. no test. Approve
Review via email: mp+151985@code.launchpad.net

Description of the change

This is a teeny-tiny module that sets the default value for the salesman field with the current user id.

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

res.partner is provided by base module, not crm.

Please fix dependency.

review: Needs Fixing
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote :

No need for the class instanciation and the class should inherit from orm.Model

review: Needs Fixing
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote :

I did it like this to make the module compatible with older OE versions. I will fix it for this branch and propose another merge for the 6.1 branch.

19. By Joao Alfredo Gama Batista

[FIX] Use orm.Model instead of osv.osv

Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (lgtm. no test.)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> I did it like this to make the module compatible with older OE versions. I
> will fix it for this branch and propose another merge for the 6.1 branch.

orm.Model is usable since 6.1, and the class instanciation is useless since 6.1 as well.
This code is 6.1 compatible.

review: Approve (code review, no test)
Revision history for this message
Joao Alfredo Gama Batista (joao-gama) wrote :

Let me rephrase myself. What I mean is that I tried to follow 6.x coding standards. I myself think that orm.Model is much clearer than osv.osv and the class instantiation at the end of each declaration is simply weird. ;)

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Let me rephrase myself. What I mean is that I tried to follow 6.x coding
> standards. I myself think that orm.Model is much clearer than osv.osv and the
> class instantiation at the end of each declaration is simply weird. ;)

Alright so we agree on that :-)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'partner_auto_salesman'
2=== added file 'partner_auto_salesman/__init__.py'
3--- partner_auto_salesman/__init__.py 1970-01-01 00:00:00 +0000
4+++ partner_auto_salesman/__init__.py 2013-03-06 16:17:22 +0000
5@@ -0,0 +1,22 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+import res_partner
28
29=== added file 'partner_auto_salesman/__openerp__.py'
30--- partner_auto_salesman/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ partner_auto_salesman/__openerp__.py 2013-03-06 16:17:22 +0000
32@@ -0,0 +1,35 @@
33+# -*- coding: utf-8 -*-
34+##############################################################################
35+#
36+# OpenERP, Open Source Management Solution
37+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU Affero General Public License as
41+# published by the Free Software Foundation, either version 3 of the
42+# License, or (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Affero General Public License for more details.
48+#
49+# You should have received a copy of the GNU Affero General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+##############################################################################
53+
54+{
55+ 'name': 'Partner auto salesman',
56+ 'version': '1.0',
57+ 'category': 'Customer Relationship Management',
58+ 'complexity': "easy",
59+ 'description': """Fill the salesman field with the current user id""",
60+ 'author': 'Savoir-faire Linux',
61+ 'website': 'http://www.savoirfairelinux.com',
62+ 'license': 'AGPL-3',
63+ 'depends': ['base'],
64+ 'installable': True,
65+ 'auto_install': False,
66+}
67+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
68
69=== added file 'partner_auto_salesman/res_partner.py'
70--- partner_auto_salesman/res_partner.py 1970-01-01 00:00:00 +0000
71+++ partner_auto_salesman/res_partner.py 2013-03-06 16:17:22 +0000
72@@ -0,0 +1,27 @@
73+# -*- coding: utf-8 -*-
74+##############################################################################
75+#
76+# OpenERP, Open Source Management Solution
77+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
78+#
79+# This program is free software: you can redistribute it and/or modify
80+# it under the terms of the GNU Affero General Public License as
81+# published by the Free Software Foundation, either version 3 of the
82+# License, or (at your option) any later version.
83+#
84+# This program is distributed in the hope that it will be useful,
85+# but WITHOUT ANY WARRANTY; without even the implied warranty of
86+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
87+# GNU Affero General Public License for more details.
88+#
89+# You should have received a copy of the GNU Affero General Public License
90+# along with this program. If not, see <http://www.gnu.org/licenses/>.
91+#
92+##############################################################################
93+
94+from openerp.osv import orm
95+
96+
97+class res_partner(orm.Model):
98+ _inherit = 'res.partner'
99+ _defaults = {'user_id': lambda self, cr, uid, context: uid}