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
=== added directory 'partner_auto_salesman'
=== added file 'partner_auto_salesman/__init__.py'
--- partner_auto_salesman/__init__.py 1970-01-01 00:00:00 +0000
+++ partner_auto_salesman/__init__.py 2013-03-06 16:17:22 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import res_partner
023
=== added file 'partner_auto_salesman/__openerp__.py'
--- partner_auto_salesman/__openerp__.py 1970-01-01 00:00:00 +0000
+++ partner_auto_salesman/__openerp__.py 2013-03-06 16:17:22 +0000
@@ -0,0 +1,35 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 'name': 'Partner auto salesman',
24 'version': '1.0',
25 'category': 'Customer Relationship Management',
26 'complexity': "easy",
27 'description': """Fill the salesman field with the current user id""",
28 'author': 'Savoir-faire Linux',
29 'website': 'http://www.savoirfairelinux.com',
30 'license': 'AGPL-3',
31 'depends': ['base'],
32 'installable': True,
33 'auto_install': False,
34}
35# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
036
=== added file 'partner_auto_salesman/res_partner.py'
--- partner_auto_salesman/res_partner.py 1970-01-01 00:00:00 +0000
+++ partner_auto_salesman/res_partner.py 2013-03-06 16:17:22 +0000
@@ -0,0 +1,27 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from openerp.osv import orm
23
24
25class res_partner(orm.Model):
26 _inherit = 'res.partner'
27 _defaults = {'user_id': lambda self, cr, uid, context: uid}