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
=== added directory 'hr_analytic_plans'
=== added file 'hr_analytic_plans/AUTHORS.txt'
--- hr_analytic_plans/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ hr_analytic_plans/AUTHORS.txt 2012-01-27 10:33:24 +0000
@@ -0,0 +1,1 @@
1Lorenzo Battistini <lorenzo.battistini@agilebg.com>
02
=== added file 'hr_analytic_plans/__init__.py'
--- hr_analytic_plans/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_analytic_plans/__init__.py 2012-01-27 10:33:24 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
5# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22import hr_expense
023
=== added file 'hr_analytic_plans/__openerp__.py'
--- hr_analytic_plans/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_analytic_plans/__openerp__.py 2012-01-27 10:33:24 +0000
@@ -0,0 +1,37 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
5# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
6# All Rights Reserved
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': "Analytic plans for Expenses",
24 'version': '0.1',
25 'category': 'Generic Modules/Human Resources',
26 'description': """The base module to manage analytic distributions and expenses.
27 It adds the distribution field on expense lines and writes it to the subsequently created invoice.""",
28 'author': 'Agile Business Group & Domsense',
29 'website': 'http://www.agilebg.com',
30 'license': 'AGPL-3',
31 "depends" : ['hr_expense', 'account_analytic_plans'],
32 "init_xml" : [],
33 "update_xml" : ['hr_expense_view.xml'],
34 "demo_xml" : [],
35 "active": False,
36 "installable": True
37}
038
=== added file 'hr_analytic_plans/hr_expense.py'
--- hr_analytic_plans/hr_expense.py 1970-01-01 00:00:00 +0000
+++ hr_analytic_plans/hr_expense.py 2012-01-27 10:33:24 +0000
@@ -0,0 +1,44 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
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 osv import fields, osv
23
24class hr_expense_line(osv.osv):
25 _inherit='hr.expense.line'
26 _columns = {
27 'distribution_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
28 }
29hr_expense_line()
30
31class hr_expense_expense(osv.osv):
32 _inherit = "hr.expense.expense"
33
34 def action_invoice_create(self, cr, uid, ids):
35 res = super(hr_expense_expense, self).action_invoice_create(cr, uid, ids)
36 for exp in self.browse(cr, uid, ids):
37 if exp.invoice_id:
38 for exp_line in exp.line_ids:
39 for inv_line in exp.invoice_id.invoice_line:
40 if inv_line.name == exp_line.name and inv_line.price_unit == exp_line.unit_amount \
41 and inv_line.quantity == exp_line.unit_quantity and inv_line.uos_id.id == exp_line.uom_id.id:
42 inv_line.write({'analytics_id': exp_line.distribution_id.id})
43
44hr_expense_expense()
045
=== added file 'hr_analytic_plans/hr_expense_view.xml'
--- hr_analytic_plans/hr_expense_view.xml 1970-01-01 00:00:00 +0000
+++ hr_analytic_plans/hr_expense_view.xml 2012-01-27 10:33:24 +0000
@@ -0,0 +1,30 @@
1<?xml version="1.0"?>
2<openerp>
3<data>
4
5 <record model="ir.ui.view" id="view_expenses_form">
6 <field name="name">hr.expense.form.distribution_id</field>
7 <field name="model">hr.expense.expense</field>
8 <field name="type">form</field>
9 <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
10 <field name="arch" type="xml">
11 <field name="analytic_account" position="replace">
12 <field name="distribution_id" domain="[('plan_id','&lt;&gt;',False)]"/>
13 </field>
14 </field>
15 </record>
16
17 <record id="view_expenses_line_tree" model="ir.ui.view">
18 <field name="name">hr.expense.line.tree.distribution_id</field>
19 <field name="type">tree</field>
20 <field name="model">hr.expense.line</field>
21 <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
22 <field name="arch" type="xml">
23 <field name="analytic_account" position="replace">
24 <field name="distribution_id" domain="[('plan_id','&lt;&gt;',False)]" groups="analytic.group_analytic_accounting"/>
25 </field>
26 </field>
27 </record>
28
29</data>
30</openerp>
031
=== added directory 'hr_analytic_plans/i18n'

Subscribers

People subscribed via source and target branches

to status/vote changes: