Merge lp:~dreis-pt/department-mgmt/analytic-v7 into lp:~department-core-editors/department-mgmt/7.0

Proposed by Daniel Reis
Status: Merged
Merged at revision: 10
Proposed branch: lp:~dreis-pt/department-mgmt/analytic-v7
Merge into: lp:~department-core-editors/department-mgmt/7.0
Diff against target: 314 lines (+61/-174)
5 files modified
analytic_department/LICENSE (+18/-0)
analytic_department/__init__.py (+0/-31)
analytic_department/__openerp__.py (+10/-50)
analytic_department/analytic.py (+7/-49)
analytic_department/analytic_view.xml (+26/-44)
To merge this branch: bzr merge lp:~dreis-pt/department-mgmt/analytic-v7
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Niels Huylebroeck (community) no test Approve
Review via email: mp+150798@code.launchpad.net

Description of the change

Migrated analytic_department to v7.
I chose to remove the features depending on the deprecated user department.

To post a comment you must log in.
Revision history for this message
Niels Huylebroeck (red15) wrote :

Very good styling, this could serve as an example for us all!

I'd like to point out you are adding +x attributes (executable) on each file? Are you perhaps using bzr under windows? Is there any way you can avoid passing this in the commit ?

Also feel free I'd say to add yourself to the authors by converting it to a list of strings:
"author": ["Camptocamp", "Daniel Reis"],

Perhaps even the copyright section can be expanded to include your name and the current year.

review: Approve (no test)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

Thank you - I'm just applying what I learned in other MP reviews.

I'm fixing the +x attributes, and I'll be adding my name to the authors list as you kindly suggested.
I tried with the list, but it just gets converted to a string, so it's best not to the list.

As for the license text, IMHO it's rather pointless to repeat it in every .py file, including empty __init__.py files. And the license is ment to apply to all files, not only python code. I have seen that newer modules include a LICENSE text file for this, and I think that a DRYer single license file makes more sense.

I'll be resubmitting the changes soon.

11. By Daniel Reis

[FIX] file 'x' attributes; license now stated in a single place.

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Just pushed the changes into the MP.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Nit picking : I believe Joël's last name is correctly spelled 'Grand-Guillaume" (with two capital "G"s).

Apart from that LGTM.

review: Approve (code review, no test)
12. By Daniel Reis

[FIX] License and author

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Don't want to mess with Joël - fixed.

Revision history for this message
Niels Huylebroeck (red15) wrote :

For that author field, I know inside OpenERP it's listed as simple repr() output but I think it's correctly parsed and assigned on the openerp apps (and it's future proof too). It still is a better way imho to indicate who worked on it instead of concatenating all the author names together inside and unbreakable string.

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

Oh, I saw that you proposed the module 2 times, here and in this branch: https://code.launchpad.net/~dreis-pt/department-mgmt/project-v7b/+merge/151006

I guess that this merge proposal is a pre-requisite for the other one, next time, in such case can you resubmit the 'project-v7b/+merge/151006' putting this branch as 'pre-requisite' please? Thus, the changes of this branch won't be displayed on the other one. Thanks

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

Same remark than the other merge proposal, the <field name="type">...</field> is now useless in v7, they can be removed.

13. By Daniel Reis

[FIX] removing useless <field name=type>; fixing DOS linebreaks and +x file attributes.

Revision history for this message
Daniel Reis (dreis-pt) wrote :

Fixed!

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

Thanks! LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'analytic_department/LICENSE'
2--- analytic_department/LICENSE 1970-01-01 00:00:00 +0000
3+++ analytic_department/LICENSE 2013-03-04 16:38:22 +0000
4@@ -0,0 +1,18 @@
5+OpenERP, Open Source Management Solution
6+
7+Original author: Joël Grand-Guillaume
8+Copyright © 2011 Camptocamp SA (http://www.camptocamp.com)
9+Copyright © 2013 Daniel Reis (SECURITAS)
10+
11+This program is free software: you can redistribute it and/or modify
12+it under the terms of the GNU Affero General Public License as
13+published by the Free Software Foundation, either version 3 of the
14+License, or (at your option) any later version.
15+
16+This program is distributed in the hope that it will be useful,
17+but WITHOUT ANY WARRANTY; without even the implied warranty of
18+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+GNU Affero General Public License for more details.
20+
21+You should have received a copy of the GNU Affero General Public Lice
22+along with this program. If not, see <http://www.gnu.org/licenses/>.
23
24=== modified file 'analytic_department/__init__.py'
25--- analytic_department/__init__.py 2011-08-12 12:53:16 +0000
26+++ analytic_department/__init__.py 2013-03-04 16:38:22 +0000
27@@ -1,32 +1,1 @@
28-# -*- coding: utf-8 -*-
29-##############################################################################
30-#
31-# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
32-# All Right Reserved
33-#
34-# Author : Joel Grand-guillaume (Camptocamp)
35-#
36-# WARNING: This program as such is intended to be used by professional
37-# programmers who take the whole responsability of assessing all potential
38-# consequences resulting from its eventual inadequacies and bugs
39-# End users who are looking for a ready-to-use solution with commercial
40-# garantees and support are strongly adviced to contract a Free Software
41-# Service Company
42-#
43-# This program is Free Software; you can redistribute it and/or
44-# modify it under the terms of the GNU General Public License
45-# as published by the Free Software Foundation; either version 2
46-# of the License, or (at your option) any later version.
47-#
48-# This program is distributed in the hope that it will be useful,
49-# but WITHOUT ANY WARRANTY; without even the implied warranty of
50-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51-# GNU General Public License for more details.
52-#
53-# You should have received a copy of the GNU General Public License
54-# along with this program; if not, write to the Free Software
55-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
56-#
57-##############################################################################
58-
59 import analytic
60
61=== modified file 'analytic_department/__openerp__.py'
62--- analytic_department/__openerp__.py 2013-01-04 10:32:58 +0000
63+++ analytic_department/__openerp__.py 2013-03-04 16:38:22 +0000
64@@ -1,55 +1,15 @@
65 # -*- coding: utf-8 -*-
66-##############################################################################
67-#
68-# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
69-# All Right Reserved
70-#
71-# Author : Joel Grand-guillaume (Camptocamp)
72-#
73-# WARNING: This program as such is intended to be used by professional
74-# programmers who take the whole responsability of assessing all potential
75-# consequences resulting from its eventual inadequacies and bugs
76-# End users who are looking for a ready-to-use solution with commercial
77-# garantees and support are strongly adviced to contract a Free Software
78-# Service Company
79-#
80-# This program is Free Software; you can redistribute it and/or
81-# modify it under the terms of the GNU General Public License
82-# as published by the Free Software Foundation; either version 2
83-# of the License, or (at your option) any later version.
84-#
85-# This program is distributed in the hope that it will be useful,
86-# but WITHOUT ANY WARRANTY; without even the implied warranty of
87-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88-# GNU General Public License for more details.
89-#
90-# You should have received a copy of the GNU General Public License
91-# along with this program; if not, write to the Free Software
92-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
93-#
94-##############################################################################
95-
96 {
97- "name" : "Analytic Account Department Categorization",
98- "version" : "1.0",
99- "author" : "Camptocamp",
100- "category" : "Generic Modules/Projects & Services",
101- "description":
102-"""
103- Add the department on Analytic Account and Analytical line as well as the related filter and button in the search form of
104- both object.
105-
106+ "name": "Analytic Account Department Categorization",
107+ "version": "1.0",
108+ "author": "Camptocamp, Daniel Reis",
109+ "license": "AGPL-3",
110+ "category": "Generic Modules/Projects & Services",
111+ "description": """\
112+Add Department to Analytic Account and Analytical Line models, and to
113+corresponding tree, search and form views.
114 """,
115 "website": "http://camptocamp.com",
116- "depends" : [
117- "account",
118- "hr",
119- ],
120- "init_xml" : [],
121- "demo_xml" : [],
122- "update_xml" : [
123- "analytic_view.xml",
124- ],
125- "active": False,
126- 'installable': False
127+ "depends": ["account", "hr"],
128+ "data": ["analytic_view.xml"],
129 }
130
131=== modified file 'analytic_department/analytic.py'
132--- analytic_department/analytic.py 2011-08-12 12:53:16 +0000
133+++ analytic_department/analytic.py 2013-03-04 16:38:22 +0000
134@@ -1,58 +1,16 @@
135 # -*- coding: utf-8 -*-
136-##############################################################################
137-#
138-# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
139-# All Right Reserved
140-#
141-# Author : Joel Grand-guillaume (Camptocamp)
142-#
143-# WARNING: This program as such is intended to be used by professional
144-# programmers who take the whole responsability of assessing all potential
145-# consequences resulting from its eventual inadequacies and bugs
146-# End users who are looking for a ready-to-use solution with commercial
147-# garantees and support are strongly adviced to contract a Free Software
148-# Service Company
149-#
150-# This program is Free Software; you can redistribute it and/or
151-# modify it under the terms of the GNU General Public License
152-# as published by the Free Software Foundation; either version 2
153-# of the License, or (at your option) any later version.
154-#
155-# This program is distributed in the hope that it will be useful,
156-# but WITHOUT ANY WARRANTY; without even the implied warranty of
157-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158-# GNU General Public License for more details.
159-#
160-# You should have received a copy of the GNU General Public License
161-# along with this program; if not, write to the Free Software
162-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
163-#
164-##############################################################################
165-
166-from osv import osv
167-from osv import fields
168-
169-class analytic_account(osv.osv):
170+from openerp.osv import fields, orm
171+
172+
173+class AnalyticAccount(orm.Model):
174 _inherit = "account.analytic.account"
175-
176 _columns = {
177 'department_id': fields.many2one('hr.department', 'Department'),
178 }
179- _defaults = {
180- 'department_id': lambda s,cr,uid,c: s.pool.get('res.users').browse(cr,uid,uid).context_department_id.id,
181- }
182-
183-analytic_account()
184-
185-class analytic_line(osv.osv):
186+
187+
188+class AnalyticLine(orm.Model):
189 _inherit = "account.analytic.line"
190-
191 _columns = {
192 'department_id': fields.many2one('hr.department', 'Department'),
193 }
194- _defaults = {
195- 'department_id': lambda s,cr,uid,c: s.pool.get('res.users').browse(cr,uid,uid).context_department_id.id,
196- }
197-
198-analytic_line()
199-
200
201=== modified file 'analytic_department/analytic_view.xml'
202--- analytic_department/analytic_view.xml 2012-07-23 06:52:34 +0000
203+++ analytic_department/analytic_view.xml 2013-03-04 16:38:22 +0000
204@@ -5,15 +5,12 @@
205 <record id="view_account_analytic_account_search" model="ir.ui.view">
206 <field name="name">account.analytic.account.search</field>
207 <field name="model">account.analytic.account</field>
208- <field name="inherit_id" ref="account.view_account_analytic_account_search" />
209- <field name="type">search</field>
210+ <field name="inherit_id" ref="account.view_account_analytic_account_search"/>
211 <field name="arch" type="xml">
212- <xpath expr="/search/group/field[@name='user_id']" position="after">
213- <field name="department_id" widget="selection" >
214- <filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]" string="My Departments Employee"/>
215- </field>
216- </xpath>
217- <xpath expr="/search/group/filter[@string='Manager']" position="after">
218+ <field name="user_id" position="after">
219+ <field name="department_id"/>
220+ </field>
221+ <xpath expr="/search/group/filter[1]" position="after">
222 <filter string="Department" icon="terp-folder-orange" domain="[]" context="{'group_by':'department_id'}"/>
223 </xpath>
224 </field>
225@@ -22,60 +19,44 @@
226 <record id="view_account_analytic_account_tree" model="ir.ui.view">
227 <field name="name">account.analytic.account.tree</field>
228 <field name="model">account.analytic.account</field>
229- <field name="inherit_id" ref="account.view_account_analytic_account_tree" />
230- <field name="type">tree</field>
231- <field name="arch" type="xml">
232- <xpath expr="/tree/field[@name='code']" position="after">
233- <field name="department_id" />
234- </xpath>
235- </field>
236- </record>
237-
238- <record id="view_account_analytic_account_form" model="ir.ui.view">
239- <field name="name">account.analytic.account.form</field>
240- <field name="model">account.analytic.account</field>
241- <field name="inherit_id" ref="account.view_account_analytic_account_form" />
242- <field name="type">form</field>
243- <field name="arch" type="xml">
244- <xpath expr="/form/notebook/page/group/field[@name='partner_id']" position="after">
245- <field name="department_id" />
246- </xpath>
247- </field>
248- </record>
249-
250+ <field name="inherit_id" ref="account.view_account_analytic_account_tree"/>
251+ <field name="arch" type="xml">
252+ <field name="code" position="after">
253+ <field name="department_id"/>
254+ </field>
255+ </field>
256+ </record>
257
258 <record id="view_account_analytic_line_form" model="ir.ui.view">
259 <field name="name">account.analytic.line.form</field>
260 <field name="model">account.analytic.line</field>
261- <field name="inherit_id" ref="account.view_account_analytic_line_form" />
262- <field name="type">form</field>
263+ <field name="inherit_id" ref="account.view_account_analytic_line_form"/>
264 <field name="arch" type="xml">
265- <xpath expr="/form/group/field[@name='company_id']" position="after">
266- <field name="department_id" />
267- </xpath>
268+ <field name="company_id" position="after">
269+ <field name="department_id"/>
270+ </field>
271 </field>
272 </record>
273
274 <record id="view_account_analytic_line_tree" model="ir.ui.view">
275 <field name="name">account.analytic.line.tree</field>
276 <field name="model">account.analytic.line</field>
277- <field name="inherit_id" ref="account.view_account_analytic_line_tree" />
278- <field name="type">tree</field>
279+ <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
280 <field name="arch" type="xml">
281- <xpath expr="/tree/field[@name='user_id']" position="after">
282- <field name="department_id" />
283- </xpath>
284+ <field name="company_id" position="after">
285+ <field name="department_id"/>
286+ </field>
287 </field>
288 </record>
289+
290 <record id="view_account_analytic_line_filter" model="ir.ui.view">
291 <field name="name">account.analytic.line.select</field>
292 <field name="model">account.analytic.line</field>
293- <field name="inherit_id" ref="account.view_account_analytic_line_filter" />
294- <field name="type">search</field>
295+ <field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
296 <field name="arch" type="xml">
297- <xpath expr="/search/group/field[@name='user_id']" position="before">
298- <field name="department_id" widget="selection" />
299- </xpath>
300+ <field name="user_id" position="before">
301+ <field name="department_id" widget="selection"/>
302+ </field>
303 <xpath expr="/search/group/filter[@string='User']" position="after">
304 <filter string="Department" icon="terp-folder-orange" domain="[]" context="{'group_by':'department_id'}"/>
305 </xpath>
306@@ -84,3 +65,4 @@
307
308 </data>
309 </openerp>
310+
311
312=== modified file 'analytic_department/i18n/analytic_department.pot' (properties changed: +x to -x)
313=== modified file 'analytic_department/i18n/es.po' (properties changed: +x to -x)
314=== removed directory 'analytic_department/security'

Subscribers

People subscribed via source and target branches