Merge lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani into lp:addons-vauxoo/7.0

Proposed by Yanina Aular (Vauxoo)
Status: Merged
Merged at revision: 1055
Proposed branch: lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani
Merge into: lp:addons-vauxoo/7.0
Diff against target: 320 lines (+249/-2)
7 files modified
purchase_requisition_line_analytic/model/purchase_requisition.py (+2/-2)
purchase_requisition_line_plan/__init__.py (+27/-0)
purchase_requisition_line_plan/__openerp__.py (+54/-0)
purchase_requisition_line_plan/model/__init__.py (+26/-0)
purchase_requisition_line_plan/model/purchase_requisition.py (+75/-0)
purchase_requisition_line_plan/view/purchase_requisition_view.xml (+40/-0)
purchase_requisition_line_plan/wizard/__init__.py (+25/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/purchase_requisition_line_analytic-rev1-yani
Reviewer Review Type Date Requested Status
Yanina Aular (Vauxoo) Pending
Review via email: mp+223071@code.launchpad.net

Description of the change

New module that adds a cost center to the purchase requisition line

To post a comment you must log in.
1059. By Yanina Aular (Vauxoo)

[IMP] description and name

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'purchase_requisition_line_analytic/model/purchase_requisition.py'
--- purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-11 21:45:45 +0000
+++ purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-13 14:00:51 +0000
@@ -35,7 +35,7 @@
3535
36 _columns = {36 _columns = {
37 'account_analytic_id': fields.many2one(37 'account_analytic_id': fields.many2one(
38 'account.analytic.plan.instance', 'Analytic Distribution',38 'account.analytic.account', 'Analytic Account',
39 help='This field is used to assign the selected'\39 help='This field is used to assign the selected'\
40 ' analytic account to the line of the purchase order'),40 ' analytic account to the line of the purchase order'),
41 }41 }
@@ -63,5 +63,5 @@
63 for pol_id in pol_ids:63 for pol_id in pol_ids:
64 pol_brw = pol_obj.browse(cr, uid, pol_id) 64 pol_brw = pol_obj.browse(cr, uid, pol_id)
65 pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id':65 pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id':
66 pol_brw.purchase_requisition_line_id.account_analytic_id}, context=context)66 pol_brw.purchase_requisition_line_id.account_analytic_id.id}, context=context)
67 return res67 return res
6868
=== added directory 'purchase_requisition_line_plan'
=== added file 'purchase_requisition_line_plan/__init__.py'
--- purchase_requisition_line_plan/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/__init__.py 2014-06-13 14:00:51 +0000
@@ -0,0 +1,27 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###############################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
6# All Rights Reserved
7############# Credits #########################################################
8# Coded by: Yanina Aular <yani@vauxoo.com>
9# Planified by: Humberto Arocha <hbto@vauxoo.com>
10# Audited by: Humberto Arocha <hbto@vauxoo.com>
11###############################################################################
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24###############################################################################
25
26import model
27import wizard
028
=== added file 'purchase_requisition_line_plan/__openerp__.py'
--- purchase_requisition_line_plan/__openerp__.py 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/__openerp__.py 2014-06-13 14:00:51 +0000
@@ -0,0 +1,54 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###############################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
6# All Rights Reserved
7############# Credits #########################################################
8# Coded by: Yanina Aular <yani@vauxoo.com>
9# Planified by: Humberto Arocha <hbto@vauxoo.com>
10# Audited by: Humberto Arocha <hbto@vauxoo.com>
11###############################################################################
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24###############################################################################
25
26{
27 'name': 'Purchase Requisition Line Plan',
28 'version': '1.0',
29 'author': 'Vauxoo',
30 'website': 'http://www.vauxoo.com/',
31 'category': '',
32 'description': '''
33A account analytic plan instance is added in purchase requisition lines
34
35Add analytic account plan instance on purchase requisition line and purchase order line, so the purchase order takes
36the account analytic value from the purchase requisition.
37''',
38 'depends': [
39 'account_analytic_plans',
40 'purchase_requisition',
41 'purchase_requisition_line_view',
42 'pr_line_related_po_line',
43 ],
44 'data': [
45 'view/purchase_requisition_view.xml',
46 ],
47 'demo': [],
48 'test': [],
49 'qweb': [],
50 'js': [],
51 'css': [],
52 'active': False,
53 'installable': True,
54}
055
=== added directory 'purchase_requisition_line_plan/data'
=== added directory 'purchase_requisition_line_plan/demo'
=== added directory 'purchase_requisition_line_plan/doc'
=== added directory 'purchase_requisition_line_plan/doc/images'
=== added directory 'purchase_requisition_line_plan/i18n'
=== added directory 'purchase_requisition_line_plan/model'
=== added file 'purchase_requisition_line_plan/model/__init__.py'
--- purchase_requisition_line_plan/model/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/model/__init__.py 2014-06-13 14:00:51 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###############################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
6# All Rights Reserved
7############# Credits #########################################################
8# Coded by: Yanina Aular <yani@vauxoo.com>
9# Planified by: Humberto Arocha <hbto@vauxoo.com>
10# Audited by: Humberto Arocha <hbto@vauxoo.com>
11###############################################################################
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24###############################################################################
25
26import purchase_requisition
027
=== added file 'purchase_requisition_line_plan/model/purchase_requisition.py'
--- purchase_requisition_line_plan/model/purchase_requisition.py 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/model/purchase_requisition.py 2014-06-13 14:00:51 +0000
@@ -0,0 +1,75 @@
1# -*- encoding: utf-8 -*-
2########################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
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 by
10# 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 Affero 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########################################################################
22from datetime import datetime
23from dateutil.relativedelta import relativedelta
24import time
25from openerp import netsvc
26
27from openerp.osv import fields, osv
28from openerp.tools.translate import _
29import openerp.addons.decimal_precision as dp
30from openerp import tools
31
32class purchase_order_line(osv.Model):
33 _inherit = "purchase.order.line"
34
35 _columns = {
36 'account_analytic_plan_id': fields.many2one(
37 'account.analytic.plan.instance', 'Analytic Distribution',
38 help='This field is used to assign the selected'\
39 ' analytic account to the line of the purchase order'),
40
41 }
42
43
44class purchase_requisition_line(osv.Model):
45 _inherit = "purchase.requisition.line"
46
47 _columns = {
48 'account_analytic_plan_id': fields.many2one(
49 'account.analytic.plan.instance', 'Analytic Distribution',
50 help='This field is used to assign the selected'\
51 ' analytic account to the line of the purchase order'),
52 }
53
54class purchase_requisition(osv.Model):
55 _inherit = "purchase.requisition"
56
57
58 def make_purchase_order(self, cr, uid, ids, partner_id, context=None):
59 if context is None:
60 context = {}
61 res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context)
62
63 pol_obj = self.pool.get('purchase.order.line')
64 prl_obj = self.pool.get('purchase.requisition.line')
65 po_obj = self.pool.get('purchase.order')
66
67 for requisition in self.browse(cr, uid, ids, context=context):
68 po_req = po_obj.search(cr, uid, [('requisition_id','=',requisition.id)], context=context)
69 for po_id in po_req:
70 pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)])
71 for pol_id in pol_ids:
72 pol_brw = pol_obj.browse(cr, uid, pol_id)
73 pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_plan_id':
74 pol_brw.purchase_requisition_line_id.account_analytic_plan_id.id}, context=context)
75 return res
076
=== added directory 'purchase_requisition_line_plan/report'
=== added directory 'purchase_requisition_line_plan/security'
=== added directory 'purchase_requisition_line_plan/static'
=== added directory 'purchase_requisition_line_plan/static/description'
=== added file 'purchase_requisition_line_plan/static/description/index.html'
=== added directory 'purchase_requisition_line_plan/static/src'
=== added directory 'purchase_requisition_line_plan/static/src/css'
=== added directory 'purchase_requisition_line_plan/static/src/img'
=== added file 'purchase_requisition_line_plan/static/src/img/icon.png'
1Binary files purchase_requisition_line_plan/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_plan/static/src/img/icon.png 2014-06-13 14:00:51 +0000 differ77Binary files purchase_requisition_line_plan/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_plan/static/src/img/icon.png 2014-06-13 14:00:51 +0000 differ
=== added directory 'purchase_requisition_line_plan/static/src/js'
=== added directory 'purchase_requisition_line_plan/static/src/xml'
=== added directory 'purchase_requisition_line_plan/test'
=== added directory 'purchase_requisition_line_plan/view'
=== added file 'purchase_requisition_line_plan/view/purchase_requisition_view.xml'
--- purchase_requisition_line_plan/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/view/purchase_requisition_view.xml 2014-06-13 14:00:51 +0000
@@ -0,0 +1,40 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4 <record id="view_purchase_requisition_form_account_analytic_plan" model="ir.ui.view">
5 <field name="name">purchase.requisition.form.account.analytic.plan</field>
6 <field name="model">purchase.requisition</field>
7 <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
8 <field name="arch" type="xml">
9 <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="after">
10 <field name="account_analytic_plan_id"/>
11 </xpath>
12 <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="after">
13 <field name="account_analytic_plan_id"/>
14 </xpath>
15 </field>
16 </record>
17
18 <record id="view_purchase_requisition_line_form_account_analytic" model="ir.ui.view">
19 <field name="name">purchase.requisition.line.form.account.analytic</field>
20 <field name="model">purchase.requisition.line</field>
21 <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_form"/>
22 <field name="arch" type="xml">
23 <xpath expr="//field[@name='product_qty']" position="after">
24 <field name="account_analytic_plan_id"/>
25 </xpath>
26 </field>
27 </record>
28
29 <record id="view_purchase_requisition_line_tree_account_analytic" model="ir.ui.view">
30 <field name="name">purchase.requisition.line.tree.account.analytic</field>
31 <field name="model">purchase.requisition.line</field>
32 <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_tree"/>
33 <field name="arch" type="xml">
34 <xpath expr="//field[@name='product_qty']" position="after">
35 <field name="account_analytic_plan_id" groups="purchase.group_analytic_accounting"/>
36 </xpath>
37 </field>
38 </record>
39 </data>
40</openerp>
041
=== added directory 'purchase_requisition_line_plan/wizard'
=== added file 'purchase_requisition_line_plan/wizard/__init__.py'
--- purchase_requisition_line_plan/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ purchase_requisition_line_plan/wizard/__init__.py 2014-06-13 14:00:51 +0000
@@ -0,0 +1,25 @@
1#!/usr/bin/python
2# -*- encoding: utf-8 -*-
3###############################################################################
4# Module Writen to OpenERP, Open Source Management Solution
5# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
6# All Rights Reserved
7############# Credits #########################################################
8# Coded by: Yanina Aular <yani@vauxoo.com>
9# Planified by: Humberto Arocha <hbto@vauxoo.com>
10# Audited by: Humberto Arocha <hbto@vauxoo.com>
11###############################################################################
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero General Public License as published
14# by the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24###############################################################################
25
026
=== added directory 'purchase_requisition_line_plan/workflow'