Merge lp:~vauxoo/addons-vauxoo/hr_expense_analytic_dev_rodo into lp:addons-vauxoo/6.1

Proposed by Rodolfo Lopez
Status: Merged
Merged at revision: 508
Proposed branch: lp:~vauxoo/addons-vauxoo/hr_expense_analytic_dev_rodo
Merge into: lp:addons-vauxoo/6.1
Diff against target: 169 lines (+149/-0)
4 files modified
hr_expense_analytic/__init__.py (+1/-0)
hr_expense_analytic/__openerp__.py (+42/-0)
hr_expense_analytic/hr_expense_analytic.py (+51/-0)
hr_expense_analytic/hr_expense_analytic_view.xml (+55/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/hr_expense_analytic_dev_rodo
Reviewer Review Type Date Requested Status
Vauxoo Pending
Review via email: mp+129075@code.launchpad.net

Description of the change

[ADD][hr_expense_analytic] add field analytic_account in hr_department and default in hr_expense_line

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'hr_expense_analytic'
2=== added file 'hr_expense_analytic/__init__.py'
3--- hr_expense_analytic/__init__.py 1970-01-01 00:00:00 +0000
4+++ hr_expense_analytic/__init__.py 2012-10-10 23:56:23 +0000
5@@ -0,0 +1,1 @@
6+import hr_expense_analytic
7
8=== added file 'hr_expense_analytic/__openerp__.py'
9--- hr_expense_analytic/__openerp__.py 1970-01-01 00:00:00 +0000
10+++ hr_expense_analytic/__openerp__.py 2012-10-10 23:56:23 +0000
11@@ -0,0 +1,42 @@
12+# -*- encoding: utf-8 -*-
13+###########################################################################
14+# Module Writen to OpenERP, Open Source Management Solution
15+#
16+# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/
17+# All Rights Reserved.
18+# info Vauxoo (info@vauxoo.com)
19+############################################################################
20+# Coded by: el_rodo_1 (rodo@vauxoo.com)
21+############################################################################
22+#
23+# This program is free software: you can redistribute it and/or modify
24+# it under the terms of the GNU Affero General Public License as
25+# published by the Free Software Foundation, either version 3 of the
26+# License, or (at your option) any later version.
27+#
28+# This program is distributed in the hope that it will be useful,
29+# but WITHOUT ANY WARRANTY; without even the implied warranty of
30+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31+# GNU Affero General Public License for more details.
32+#
33+# You should have received a copy of the GNU Affero General Public License
34+# along with this program. If not, see <http://www.gnu.org/licenses/>.
35+#
36+##############################################################################
37+
38+{
39+ "name" : "hr_expense_analytic",
40+ "version" : "1.0",
41+ "author" : "Vauxoo",
42+ "category" : "hr",
43+ "description" : """This module add analytic account to departament""",
44+ "website" : "http://www.vauxoo.com/",
45+ "license" : "AGPL-3",
46+ "depends" : ["hr","hr_expense","account"],
47+ "init_xml" : [],
48+ "demo_xml" : [],
49+ "update_xml" : ["hr_expense_analytic_view.xml"],
50+ "test": [],
51+ "installable" : True,
52+ "active" : False,
53+}
54
55=== added file 'hr_expense_analytic/hr_expense_analytic.py'
56--- hr_expense_analytic/hr_expense_analytic.py 1970-01-01 00:00:00 +0000
57+++ hr_expense_analytic/hr_expense_analytic.py 2012-10-10 23:56:23 +0000
58@@ -0,0 +1,51 @@
59+# -*- coding: utf-8 -*-
60+###########################################################################
61+# Module Writen to OpenERP, Open Source Management Solution
62+#
63+# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
64+# All Rights Reserved.
65+# info@vauxoo.com
66+############################################################################
67+# Coded by: Rodo (rodo@vauxoo.com)
68+############################################################################
69+#
70+# This program is free software: you can redistribute it and/or modify
71+# it under the terms of the GNU Affero General Public License as
72+# published by the Free Software Foundation, either version 3 of the
73+# License, or (at your option) any later version.
74+#
75+# This program is distributed in the hope that it will be useful,
76+# but WITHOUT ANY WARRANTY; without even the implied warranty of
77+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78+# GNU Affero General Public License for more details.
79+#
80+# You should have received a copy of the GNU Affero General Public License
81+# along with this program. If not, see <http://www.gnu.org/licenses/>.
82+#
83+##############################################################################
84+from osv import osv, fields
85+
86+
87+class hr_department(osv.osv):
88+ _inherit = "hr.department"
89+
90+ _columns = {
91+ 'analytic_account_id': fields.many2one('account.analytic.account','Analytic'),
92+ }
93+
94+hr_department()
95+
96+class hr_expense_line(osv.osv):
97+ _inherit ="hr.expense.line"
98+
99+ def _get_analytic(self,cr,uid,context={}):
100+ if context['depto']:
101+ depto=self.pool.get('hr.department').browse(cr,uid,[context['depto']])[0]
102+ return depto.analytic_account_id.id
103+ return False
104+
105+ _defaults= {
106+ 'analytic_account': _get_analytic
107+ }
108+
109+hr_expense_line()
110
111=== added file 'hr_expense_analytic/hr_expense_analytic_view.xml'
112--- hr_expense_analytic/hr_expense_analytic_view.xml 1970-01-01 00:00:00 +0000
113+++ hr_expense_analytic/hr_expense_analytic_view.xml 2012-10-10 23:56:23 +0000
114@@ -0,0 +1,55 @@
115+<?xml version="1.0" encoding="utf-8"?>
116+<openerp>
117+ <data>
118+
119+ <record id="view_hr_expense_analytic" model="ir.ui.view">
120+ <field name="name">view.hr.expense.analytic</field>
121+ <field name="model">hr.department</field>
122+ <field name="type">form</field>
123+ <field name="inherit_id" ref="hr.view_department_form"/>
124+ <field name="arch" type="xml">
125+ <field name="company_id" position="after">
126+ <field name="analytic_account_id" />
127+ </field>
128+ </field>
129+ </record>
130+
131+ <record id="view_hr_expense_analytic_context" model="ir.ui.view">
132+ <field name="name">view.hr.expense.analytic.context</field>
133+ <field name="model">hr.expense.expense</field>
134+ <field name="type">form</field>
135+ <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
136+ <field name="arch" type="xml">
137+ <field name="line_ids" position="replace">
138+ <field colspan="4" name="line_ids" nolabel="1" context="{'currency_id': currency_id, 'depto': department_id}">
139+ <form string="Expense Lines">
140+ <group col="6" colspan="4">
141+ <field name="product_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
142+ <field name="name" colspan="4"/>
143+ <newline/>
144+ <field name="unit_amount"/>
145+ <field name="unit_quantity"/>
146+ <field name="uom_id" on_change="onchange_product_id(product_id, uom_id, parent.employee_id, context)"/>
147+ </group>
148+ <group colspan="2" col="2" groups="analytic.group_analytic_accounting">
149+ <separator string="Customer Project" colspan="2"/>
150+ <field domain="[('type','=','normal')]" name="analytic_account"/>
151+ </group>
152+ <group colspan="2" col="2">
153+ <separator string="References" colspan="2"/>
154+ <field name="date_value"/>
155+ <field name="ref"/>
156+ </group>
157+ </form>
158+ </field>
159+ </field>
160+ </field>
161+ </record>
162+
163+
164+
165+
166+
167+
168+ </data>
169+</openerp>