Merge lp:~pedro.baeza/account-analytic/7.0-hr_expense_analytic_plans into lp:~account-core-editors/account-analytic/7.0

Proposed by Pedro Manuel Baeza on 2014-04-18
Status: Merged
Merged at revision: 19
Proposed branch: lp:~pedro.baeza/account-analytic/7.0-hr_expense_analytic_plans
Merge into: lp:~account-core-editors/account-analytic/7.0
Diff against target: 277 lines (+239/-0)
7 files modified
hr_expense_analytic_plans/__init__.py (+21/-0)
hr_expense_analytic_plans/__openerp__.py (+43/-0)
hr_expense_analytic_plans/i18n/es.po (+36/-0)
hr_expense_analytic_plans/i18n/hr_expense_analytic_plans.pot (+36/-0)
hr_expense_analytic_plans/model/__init__.py (+23/-0)
hr_expense_analytic_plans/model/hr_expense_analytic_plans.py (+49/-0)
hr_expense_analytic_plans/view/hr_expense_analytic_plans_view.xml (+31/-0)
To merge this branch: bzr merge lp:~pedro.baeza/account-analytic/7.0-hr_expense_analytic_plans
Reviewer Review Type Date Requested Status
Omar (Pexego) code review Approve on 2014-05-26
Joël Grand-Guillaume @ camptocamp code review, no tests 2014-04-18 Approve on 2014-05-09
Review via email: mp+216469@code.launchpad.net

Description of the change

[ADD] hr_expense_analytic_plans: With this module, you will be able to link analytic distributions to expenses.

To post a comment you must log in.

LGTM, thanks !

review: Approve (code review, no tests)
Omar (Pexego) (omar7r) wrote :

LGTM

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'hr_expense_analytic_plans'
2=== added file 'hr_expense_analytic_plans/__init__.py'
3--- hr_expense_analytic_plans/__init__.py 1970-01-01 00:00:00 +0000
4+++ hr_expense_analytic_plans/__init__.py 2014-04-18 16:55:28 +0000
5@@ -0,0 +1,21 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
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 License
22+# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+#
24+##############################################################################
25+
26+from . import model
27
28=== added file 'hr_expense_analytic_plans/__openerp__.py'
29--- hr_expense_analytic_plans/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ hr_expense_analytic_plans/__openerp__.py 2014-04-18 16:55:28 +0000
31@@ -0,0 +1,43 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# OpenERP, Open Source Management Solution
36+# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
37+# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.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': 'HR expenses analytic distribution',
56+ 'version': '1.0',
57+ 'category': 'Human Resources',
58+ 'description': """
59+The base module to manage analytic distribution on HR expenses
60+==============================================================
61+
62+Using this module, you will be able to link analytic distributions to expenses.
63+ """,
64+ 'author': 'Serv. Tecnolog. Avanzados - Pedro M. Baeza',
65+ 'website' : 'http://www.serviciosbaeza.com',
66+ 'depends': [
67+ 'hr_expense',
68+ 'account_analytic_plans',
69+ ],
70+ 'data': [
71+ 'view/hr_expense_analytic_plans_view.xml'
72+ ],
73+ 'installable': True,
74+}
75
76=== added directory 'hr_expense_analytic_plans/i18n'
77=== added file 'hr_expense_analytic_plans/i18n/es.po'
78--- hr_expense_analytic_plans/i18n/es.po 1970-01-01 00:00:00 +0000
79+++ hr_expense_analytic_plans/i18n/es.po 2014-04-18 16:55:28 +0000
80@@ -0,0 +1,36 @@
81+# Translation of OpenERP Server.
82+# This file contains the translation of the following modules:
83+# * hr_expense_analytic_plans
84+#
85+msgid ""
86+msgstr ""
87+"Project-Id-Version: OpenERP Server 7.0\n"
88+"Report-Msgid-Bugs-To: \n"
89+"POT-Creation-Date: 2014-04-04 18:17+0000\n"
90+"PO-Revision-Date: 2014-04-04 20:18+0100\n"
91+"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n"
92+"Language-Team: \n"
93+"MIME-Version: 1.0\n"
94+"Content-Type: text/plain; charset=UTF-8\n"
95+"Content-Transfer-Encoding: 8bit\n"
96+"Plural-Forms: \n"
97+
98+#. module: hr_expense_analytic_plans
99+#: field:hr.expense.line,analytics_id:0
100+msgid "Analytic distribution"
101+msgstr "Distribución analítica"
102+
103+#. module: hr_expense_analytic_plans
104+#: code:_description:0
105+#: model:ir.model,name:hr_expense_analytic_plans.model_hr_expense_expense
106+#, python-format
107+msgid "Expense"
108+msgstr "Gasto"
109+
110+#. module: hr_expense_analytic_plans
111+#: code:_description:0
112+#: model:ir.model,name:hr_expense_analytic_plans.model_hr_expense_line
113+#, python-format
114+msgid "Expense Line"
115+msgstr "Línea de gasto"
116+
117
118=== added file 'hr_expense_analytic_plans/i18n/hr_expense_analytic_plans.pot'
119--- hr_expense_analytic_plans/i18n/hr_expense_analytic_plans.pot 1970-01-01 00:00:00 +0000
120+++ hr_expense_analytic_plans/i18n/hr_expense_analytic_plans.pot 2014-04-18 16:55:28 +0000
121@@ -0,0 +1,36 @@
122+# Translation of OpenERP Server.
123+# This file contains the translation of the following modules:
124+# * hr_expense_analytic_plans
125+#
126+msgid ""
127+msgstr ""
128+"Project-Id-Version: OpenERP Server 7.0\n"
129+"Report-Msgid-Bugs-To: \n"
130+"POT-Creation-Date: 2014-04-04 18:17+0000\n"
131+"PO-Revision-Date: 2014-04-04 20:17+0100\n"
132+"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n"
133+"Language-Team: \n"
134+"MIME-Version: 1.0\n"
135+"Content-Type: text/plain; charset=UTF-8\n"
136+"Content-Transfer-Encoding: 8bit\n"
137+"Plural-Forms: \n"
138+
139+#. module: hr_expense_analytic_plans
140+#: field:hr.expense.line,analytics_id:0
141+msgid "Analytic distribution"
142+msgstr ""
143+
144+#. module: hr_expense_analytic_plans
145+#: code:_description:0
146+#: model:ir.model,name:hr_expense_analytic_plans.model_hr_expense_expense
147+#, python-format
148+msgid "Expense"
149+msgstr ""
150+
151+#. module: hr_expense_analytic_plans
152+#: code:_description:0
153+#: model:ir.model,name:hr_expense_analytic_plans.model_hr_expense_line
154+#, python-format
155+msgid "Expense Line"
156+msgstr ""
157+
158
159=== added directory 'hr_expense_analytic_plans/model'
160=== added file 'hr_expense_analytic_plans/model/__init__.py'
161--- hr_expense_analytic_plans/model/__init__.py 1970-01-01 00:00:00 +0000
162+++ hr_expense_analytic_plans/model/__init__.py 2014-04-18 16:55:28 +0000
163@@ -0,0 +1,23 @@
164+# -*- coding: utf-8 -*-
165+##############################################################################
166+#
167+# OpenERP, Open Source Management Solution
168+# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
169+# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
170+#
171+# This program is free software: you can redistribute it and/or modify
172+# it under the terms of the GNU Affero General Public License as
173+# published by the Free Software Foundation, either version 3 of the
174+# License, or (at your option) any later version.
175+#
176+# This program is distributed in the hope that it will be useful,
177+# but WITHOUT ANY WARRANTY; without even the implied warranty of
178+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
179+# GNU Affero General Public License for more details.
180+#
181+# You should have received a copy of the GNU Affero General Public License
182+# along with this program. If not, see <http://www.gnu.org/licenses/>.
183+#
184+##############################################################################
185+
186+from . import hr_expense_analytic_plans
187
188=== added file 'hr_expense_analytic_plans/model/hr_expense_analytic_plans.py'
189--- hr_expense_analytic_plans/model/hr_expense_analytic_plans.py 1970-01-01 00:00:00 +0000
190+++ hr_expense_analytic_plans/model/hr_expense_analytic_plans.py 2014-04-18 16:55:28 +0000
191@@ -0,0 +1,49 @@
192+# -*- coding: utf-8 -*-
193+##############################################################################
194+#
195+# OpenERP, Open Source Management Solution
196+# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
197+# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
198+#
199+# This program is free software: you can redistribute it and/or modify
200+# it under the terms of the GNU Affero General Public License as
201+# published by the Free Software Foundation, either version 3 of the
202+# License, or (at your option) any later version.
203+#
204+# This program is distributed in the hope that it will be useful,
205+# but WITHOUT ANY WARRANTY; without even the implied warranty of
206+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
207+# GNU Affero General Public License for more details.
208+#
209+# You should have received a copy of the GNU Affero General Public License
210+# along with this program. If not, see <http://www.gnu.org/licenses/>.
211+#
212+##############################################################################
213+
214+from openerp.osv import fields, orm
215+
216+class HrExpenseExpense(orm.Model):
217+ _inherit = 'hr.expense.expense'
218+
219+ def line_get_convert(self, cr, uid, x, part, date, context=None):
220+ res = super(HrExpenseExpense, self).line_get_convert(cr, uid, x, part,
221+ date,
222+ context=context)
223+ res['analytics_id'] = x.get('analytics_id', False)
224+ return res
225+
226+ def move_line_get_item(self, cr, uid, line, context=None):
227+ res = super(HrExpenseExpense, self).move_line_get_item(cr, uid, line,
228+ context=context)
229+ if line.analytics_id:
230+ res['analytics_id'] = line.analytics_id.id
231+ return res
232+
233+
234+class HrExpenseLine(orm.Model):
235+ _inherit = 'hr.expense.line'
236+ _columns = {
237+ 'analytics_id': fields.many2one('account.analytic.plan.instance',
238+ 'Analytic distribution'),
239+ }
240+
241
242=== added directory 'hr_expense_analytic_plans/view'
243=== added file 'hr_expense_analytic_plans/view/hr_expense_analytic_plans_view.xml'
244--- hr_expense_analytic_plans/view/hr_expense_analytic_plans_view.xml 1970-01-01 00:00:00 +0000
245+++ hr_expense_analytic_plans/view/hr_expense_analytic_plans_view.xml 2014-04-18 16:55:28 +0000
246@@ -0,0 +1,31 @@
247+<?xml version="1.0"?>
248+<openerp>
249+ <data>
250+
251+ <record model="ir.ui.view" id="view_expenses_line_tree_plans">
252+ <field name="name">hr.expense.line.tree.plans</field>
253+ <field name="model">hr.expense.line</field>
254+ <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
255+ <field name="arch" type="xml">
256+ <field name="analytic_account" position="replace">
257+ <field name="analytics_id" domain="[('plan_id', '&lt;&gt;', False)]" groups="analytic.group_analytic_accounting"/>
258+ </field>
259+ </field>
260+ </record>
261+
262+ <record model="ir.ui.view" id="view_expenses_form_plans">
263+ <field name="name">hr.expense.form.plans</field>
264+ <field name="model">hr.expense.expense</field>
265+ <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
266+ <field name="arch" type="xml">
267+ <xpath expr="//field[@name='line_ids']/form//field[@name='analytic_account']" position="replace">
268+ <field name="analytics_id" domain="[('plan_id', '&lt;&gt;', False)]" groups="analytic.group_analytic_accounting"/>
269+ </xpath>
270+ <xpath expr="//field[@name='line_ids']/tree//field[@name='analytic_account']" position="replace">
271+ <field name="analytics_id" domain="[('plan_id', '&lt;&gt;', False)]" groups="analytic.group_analytic_accounting"/>
272+ </xpath>
273+ </field>
274+ </record>
275+
276+ </data>
277+</openerp>

Subscribers

People subscribed via source and target branches

to status/vote changes: