Merge lp:~domsense/domsense-agilebg-addons/adding_hr_analytic_plans into lp:domsense-agilebg-addons/6.0

Proposed by Lorenzo Battistini
Status: Merged
Merged at revision: 140
Proposed branch: lp:~domsense/domsense-agilebg-addons/adding_hr_analytic_plans
Merge into: lp:domsense-agilebg-addons/6.0
Diff against target: 161 lines (+134/-0)
5 files modified
hr_analytic_plans/AUTHORS.txt (+1/-0)
hr_analytic_plans/__init__.py (+22/-0)
hr_analytic_plans/__openerp__.py (+37/-0)
hr_analytic_plans/hr_expense.py (+44/-0)
hr_analytic_plans/hr_expense_view.xml (+30/-0)
To merge this branch: bzr merge lp:~domsense/domsense-agilebg-addons/adding_hr_analytic_plans
Reviewer Review Type Date Requested Status
Agile Business Group Pending
Review via email: mp+90392@code.launchpad.net
To post a comment you must log in.
126. By Lorenzo Battistini

[IMP] expense lines tree

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'hr_analytic_plans'
2=== added file 'hr_analytic_plans/AUTHORS.txt'
3--- hr_analytic_plans/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ hr_analytic_plans/AUTHORS.txt 2012-01-27 10:33:24 +0000
5@@ -0,0 +1,1 @@
6+Lorenzo Battistini <lorenzo.battistini@agilebg.com>
7
8=== added file 'hr_analytic_plans/__init__.py'
9--- hr_analytic_plans/__init__.py 1970-01-01 00:00:00 +0000
10+++ hr_analytic_plans/__init__.py 2012-01-27 10:33:24 +0000
11@@ -0,0 +1,22 @@
12+# -*- coding: utf-8 -*-
13+##############################################################################
14+#
15+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
16+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
17+# All Rights Reserved
18+#
19+# This program is free software: you can redistribute it and/or modify
20+# it under the terms of the GNU Affero General Public License as published
21+# by the Free Software Foundation, either version 3 of the License, or
22+# (at your option) any later version.
23+#
24+# This program is distributed in the hope that it will be useful,
25+# but WITHOUT ANY WARRANTY; without even the implied warranty of
26+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+# GNU General Public License for more details.
28+#
29+# You should have received a copy of the GNU Affero General Public License
30+# along with this program. If not, see <http://www.gnu.org/licenses/>.
31+#
32+##############################################################################
33+import hr_expense
34
35=== added file 'hr_analytic_plans/__openerp__.py'
36--- hr_analytic_plans/__openerp__.py 1970-01-01 00:00:00 +0000
37+++ hr_analytic_plans/__openerp__.py 2012-01-27 10:33:24 +0000
38@@ -0,0 +1,37 @@
39+# -*- coding: utf-8 -*-
40+##############################################################################
41+#
42+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
43+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
44+# All Rights Reserved
45+#
46+# This program is free software: you can redistribute it and/or modify
47+# it under the terms of the GNU Affero General Public License as published
48+# by the Free Software Foundation, either version 3 of the License, or
49+# (at your option) any later version.
50+#
51+# This program is distributed in the hope that it will be useful,
52+# but WITHOUT ANY WARRANTY; without even the implied warranty of
53+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
54+# GNU General Public License for more details.
55+#
56+# You should have received a copy of the GNU Affero General Public License
57+# along with this program. If not, see <http://www.gnu.org/licenses/>.
58+#
59+##############################################################################
60+{
61+ 'name': "Analytic plans for Expenses",
62+ 'version': '0.1',
63+ 'category': 'Generic Modules/Human Resources',
64+ 'description': """The base module to manage analytic distributions and expenses.
65+ It adds the distribution field on expense lines and writes it to the subsequently created invoice.""",
66+ 'author': 'Agile Business Group & Domsense',
67+ 'website': 'http://www.agilebg.com',
68+ 'license': 'AGPL-3',
69+ "depends" : ['hr_expense', 'account_analytic_plans'],
70+ "init_xml" : [],
71+ "update_xml" : ['hr_expense_view.xml'],
72+ "demo_xml" : [],
73+ "active": False,
74+ "installable": True
75+}
76
77=== added file 'hr_analytic_plans/hr_expense.py'
78--- hr_analytic_plans/hr_expense.py 1970-01-01 00:00:00 +0000
79+++ hr_analytic_plans/hr_expense.py 2012-01-27 10:33:24 +0000
80@@ -0,0 +1,44 @@
81+# -*- coding: utf-8 -*-
82+##############################################################################
83+#
84+# OpenERP, Open Source Management Solution
85+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
86+#
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU Affero General Public License as
89+# published by the Free Software Foundation, either version 3 of the
90+# License, or (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU Affero General Public License for more details.
96+#
97+# You should have received a copy of the GNU Affero General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+#
100+##############################################################################
101+
102+from osv import fields, osv
103+
104+class hr_expense_line(osv.osv):
105+ _inherit='hr.expense.line'
106+ _columns = {
107+ 'distribution_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
108+ }
109+hr_expense_line()
110+
111+class hr_expense_expense(osv.osv):
112+ _inherit = "hr.expense.expense"
113+
114+ def action_invoice_create(self, cr, uid, ids):
115+ res = super(hr_expense_expense, self).action_invoice_create(cr, uid, ids)
116+ for exp in self.browse(cr, uid, ids):
117+ if exp.invoice_id:
118+ for exp_line in exp.line_ids:
119+ for inv_line in exp.invoice_id.invoice_line:
120+ if inv_line.name == exp_line.name and inv_line.price_unit == exp_line.unit_amount \
121+ and inv_line.quantity == exp_line.unit_quantity and inv_line.uos_id.id == exp_line.uom_id.id:
122+ inv_line.write({'analytics_id': exp_line.distribution_id.id})
123+
124+hr_expense_expense()
125
126=== added file 'hr_analytic_plans/hr_expense_view.xml'
127--- hr_analytic_plans/hr_expense_view.xml 1970-01-01 00:00:00 +0000
128+++ hr_analytic_plans/hr_expense_view.xml 2012-01-27 10:33:24 +0000
129@@ -0,0 +1,30 @@
130+<?xml version="1.0"?>
131+<openerp>
132+<data>
133+
134+ <record model="ir.ui.view" id="view_expenses_form">
135+ <field name="name">hr.expense.form.distribution_id</field>
136+ <field name="model">hr.expense.expense</field>
137+ <field name="type">form</field>
138+ <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
139+ <field name="arch" type="xml">
140+ <field name="analytic_account" position="replace">
141+ <field name="distribution_id" domain="[('plan_id','&lt;&gt;',False)]"/>
142+ </field>
143+ </field>
144+ </record>
145+
146+ <record id="view_expenses_line_tree" model="ir.ui.view">
147+ <field name="name">hr.expense.line.tree.distribution_id</field>
148+ <field name="type">tree</field>
149+ <field name="model">hr.expense.line</field>
150+ <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
151+ <field name="arch" type="xml">
152+ <field name="analytic_account" position="replace">
153+ <field name="distribution_id" domain="[('plan_id','&lt;&gt;',False)]" groups="analytic.group_analytic_accounting"/>
154+ </field>
155+ </field>
156+ </record>
157+
158+</data>
159+</openerp>
160
161=== added directory 'hr_analytic_plans/i18n'

Subscribers

People subscribed via source and target branches

to status/vote changes: