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
1=== modified file 'purchase_requisition_line_analytic/model/purchase_requisition.py'
2--- purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-11 21:45:45 +0000
3+++ purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-13 14:00:51 +0000
4@@ -35,7 +35,7 @@
5
6 _columns = {
7 'account_analytic_id': fields.many2one(
8- 'account.analytic.plan.instance', 'Analytic Distribution',
9+ 'account.analytic.account', 'Analytic Account',
10 help='This field is used to assign the selected'\
11 ' analytic account to the line of the purchase order'),
12 }
13@@ -63,5 +63,5 @@
14 for pol_id in pol_ids:
15 pol_brw = pol_obj.browse(cr, uid, pol_id)
16 pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id':
17- pol_brw.purchase_requisition_line_id.account_analytic_id}, context=context)
18+ pol_brw.purchase_requisition_line_id.account_analytic_id.id}, context=context)
19 return res
20
21=== added directory 'purchase_requisition_line_plan'
22=== added file 'purchase_requisition_line_plan/__init__.py'
23--- purchase_requisition_line_plan/__init__.py 1970-01-01 00:00:00 +0000
24+++ purchase_requisition_line_plan/__init__.py 2014-06-13 14:00:51 +0000
25@@ -0,0 +1,27 @@
26+#!/usr/bin/python
27+# -*- encoding: utf-8 -*-
28+###############################################################################
29+# Module Writen to OpenERP, Open Source Management Solution
30+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
31+# All Rights Reserved
32+############# Credits #########################################################
33+# Coded by: Yanina Aular <yani@vauxoo.com>
34+# Planified by: Humberto Arocha <hbto@vauxoo.com>
35+# Audited by: Humberto Arocha <hbto@vauxoo.com>
36+###############################################################################
37+# This program is free software: you can redistribute it and/or modify
38+# it under the terms of the GNU Affero General Public License as published
39+# by the Free Software Foundation, either version 3 of the License, or
40+# (at your option) any later version.
41+#
42+# This program is distributed in the hope that it will be useful,
43+# but WITHOUT ANY WARRANTY; without even the implied warranty of
44+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45+# GNU Affero General Public License for more details.
46+#
47+# You should have received a copy of the GNU Affero General Public License
48+# along with this program. If not, see <http://www.gnu.org/licenses/>.
49+###############################################################################
50+
51+import model
52+import wizard
53
54=== added file 'purchase_requisition_line_plan/__openerp__.py'
55--- purchase_requisition_line_plan/__openerp__.py 1970-01-01 00:00:00 +0000
56+++ purchase_requisition_line_plan/__openerp__.py 2014-06-13 14:00:51 +0000
57@@ -0,0 +1,54 @@
58+#!/usr/bin/python
59+# -*- encoding: utf-8 -*-
60+###############################################################################
61+# Module Writen to OpenERP, Open Source Management Solution
62+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
63+# All Rights Reserved
64+############# Credits #########################################################
65+# Coded by: Yanina Aular <yani@vauxoo.com>
66+# Planified by: Humberto Arocha <hbto@vauxoo.com>
67+# Audited by: Humberto Arocha <hbto@vauxoo.com>
68+###############################################################################
69+# This program is free software: you can redistribute it and/or modify
70+# it under the terms of the GNU Affero General Public License as published
71+# by the Free Software Foundation, either version 3 of the License, or
72+# (at your option) any later version.
73+#
74+# This program is distributed in the hope that it will be useful,
75+# but WITHOUT ANY WARRANTY; without even the implied warranty of
76+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77+# GNU Affero General Public License for more details.
78+#
79+# You should have received a copy of the GNU Affero General Public License
80+# along with this program. If not, see <http://www.gnu.org/licenses/>.
81+###############################################################################
82+
83+{
84+ 'name': 'Purchase Requisition Line Plan',
85+ 'version': '1.0',
86+ 'author': 'Vauxoo',
87+ 'website': 'http://www.vauxoo.com/',
88+ 'category': '',
89+ 'description': '''
90+A account analytic plan instance is added in purchase requisition lines
91+
92+Add analytic account plan instance on purchase requisition line and purchase order line, so the purchase order takes
93+the account analytic value from the purchase requisition.
94+''',
95+ 'depends': [
96+ 'account_analytic_plans',
97+ 'purchase_requisition',
98+ 'purchase_requisition_line_view',
99+ 'pr_line_related_po_line',
100+ ],
101+ 'data': [
102+ 'view/purchase_requisition_view.xml',
103+ ],
104+ 'demo': [],
105+ 'test': [],
106+ 'qweb': [],
107+ 'js': [],
108+ 'css': [],
109+ 'active': False,
110+ 'installable': True,
111+}
112
113=== added directory 'purchase_requisition_line_plan/data'
114=== added directory 'purchase_requisition_line_plan/demo'
115=== added directory 'purchase_requisition_line_plan/doc'
116=== added directory 'purchase_requisition_line_plan/doc/images'
117=== added directory 'purchase_requisition_line_plan/i18n'
118=== added directory 'purchase_requisition_line_plan/model'
119=== added file 'purchase_requisition_line_plan/model/__init__.py'
120--- purchase_requisition_line_plan/model/__init__.py 1970-01-01 00:00:00 +0000
121+++ purchase_requisition_line_plan/model/__init__.py 2014-06-13 14:00:51 +0000
122@@ -0,0 +1,26 @@
123+#!/usr/bin/python
124+# -*- encoding: utf-8 -*-
125+###############################################################################
126+# Module Writen to OpenERP, Open Source Management Solution
127+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
128+# All Rights Reserved
129+############# Credits #########################################################
130+# Coded by: Yanina Aular <yani@vauxoo.com>
131+# Planified by: Humberto Arocha <hbto@vauxoo.com>
132+# Audited by: Humberto Arocha <hbto@vauxoo.com>
133+###############################################################################
134+# This program is free software: you can redistribute it and/or modify
135+# it under the terms of the GNU Affero General Public License as published
136+# by the Free Software Foundation, either version 3 of the License, or
137+# (at your option) any later version.
138+#
139+# This program is distributed in the hope that it will be useful,
140+# but WITHOUT ANY WARRANTY; without even the implied warranty of
141+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
142+# GNU Affero General Public License for more details.
143+#
144+# You should have received a copy of the GNU Affero General Public License
145+# along with this program. If not, see <http://www.gnu.org/licenses/>.
146+###############################################################################
147+
148+import purchase_requisition
149
150=== added file 'purchase_requisition_line_plan/model/purchase_requisition.py'
151--- purchase_requisition_line_plan/model/purchase_requisition.py 1970-01-01 00:00:00 +0000
152+++ purchase_requisition_line_plan/model/purchase_requisition.py 2014-06-13 14:00:51 +0000
153@@ -0,0 +1,75 @@
154+# -*- encoding: utf-8 -*-
155+########################################################################
156+#
157+# OpenERP, Open Source Management Solution
158+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
159+# $Id$
160+#
161+# This program is free software: you can redistribute it and/or modify
162+# it under the terms of the GNU Affero General Public License as published by
163+# the Free Software Foundation, either version 3 of the License, or
164+# (at your option) any later version.
165+#
166+# This program is distributed in the hope that it will be useful,
167+# but WITHOUT ANY WARRANTY; without even the implied warranty of
168+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
169+# GNU Affero General Public License for more details.
170+#
171+# You should have received a copy of the GNU Affero General Public License
172+# along with this program. If not, see <http://www.gnu.org/licenses/>.
173+#
174+########################################################################
175+from datetime import datetime
176+from dateutil.relativedelta import relativedelta
177+import time
178+from openerp import netsvc
179+
180+from openerp.osv import fields, osv
181+from openerp.tools.translate import _
182+import openerp.addons.decimal_precision as dp
183+from openerp import tools
184+
185+class purchase_order_line(osv.Model):
186+ _inherit = "purchase.order.line"
187+
188+ _columns = {
189+ 'account_analytic_plan_id': fields.many2one(
190+ 'account.analytic.plan.instance', 'Analytic Distribution',
191+ help='This field is used to assign the selected'\
192+ ' analytic account to the line of the purchase order'),
193+
194+ }
195+
196+
197+class purchase_requisition_line(osv.Model):
198+ _inherit = "purchase.requisition.line"
199+
200+ _columns = {
201+ 'account_analytic_plan_id': fields.many2one(
202+ 'account.analytic.plan.instance', 'Analytic Distribution',
203+ help='This field is used to assign the selected'\
204+ ' analytic account to the line of the purchase order'),
205+ }
206+
207+class purchase_requisition(osv.Model):
208+ _inherit = "purchase.requisition"
209+
210+
211+ def make_purchase_order(self, cr, uid, ids, partner_id, context=None):
212+ if context is None:
213+ context = {}
214+ res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context)
215+
216+ pol_obj = self.pool.get('purchase.order.line')
217+ prl_obj = self.pool.get('purchase.requisition.line')
218+ po_obj = self.pool.get('purchase.order')
219+
220+ for requisition in self.browse(cr, uid, ids, context=context):
221+ po_req = po_obj.search(cr, uid, [('requisition_id','=',requisition.id)], context=context)
222+ for po_id in po_req:
223+ pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)])
224+ for pol_id in pol_ids:
225+ pol_brw = pol_obj.browse(cr, uid, pol_id)
226+ pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_plan_id':
227+ pol_brw.purchase_requisition_line_id.account_analytic_plan_id.id}, context=context)
228+ return res
229
230=== added directory 'purchase_requisition_line_plan/report'
231=== added directory 'purchase_requisition_line_plan/security'
232=== added directory 'purchase_requisition_line_plan/static'
233=== added directory 'purchase_requisition_line_plan/static/description'
234=== added file 'purchase_requisition_line_plan/static/description/index.html'
235=== added directory 'purchase_requisition_line_plan/static/src'
236=== added directory 'purchase_requisition_line_plan/static/src/css'
237=== added directory 'purchase_requisition_line_plan/static/src/img'
238=== added file 'purchase_requisition_line_plan/static/src/img/icon.png'
239Binary 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
240=== added directory 'purchase_requisition_line_plan/static/src/js'
241=== added directory 'purchase_requisition_line_plan/static/src/xml'
242=== added directory 'purchase_requisition_line_plan/test'
243=== added directory 'purchase_requisition_line_plan/view'
244=== added file 'purchase_requisition_line_plan/view/purchase_requisition_view.xml'
245--- purchase_requisition_line_plan/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000
246+++ purchase_requisition_line_plan/view/purchase_requisition_view.xml 2014-06-13 14:00:51 +0000
247@@ -0,0 +1,40 @@
248+<?xml version="1.0"?>
249+<openerp>
250+ <data>
251+ <record id="view_purchase_requisition_form_account_analytic_plan" model="ir.ui.view">
252+ <field name="name">purchase.requisition.form.account.analytic.plan</field>
253+ <field name="model">purchase.requisition</field>
254+ <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
255+ <field name="arch" type="xml">
256+ <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="after">
257+ <field name="account_analytic_plan_id"/>
258+ </xpath>
259+ <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="after">
260+ <field name="account_analytic_plan_id"/>
261+ </xpath>
262+ </field>
263+ </record>
264+
265+ <record id="view_purchase_requisition_line_form_account_analytic" model="ir.ui.view">
266+ <field name="name">purchase.requisition.line.form.account.analytic</field>
267+ <field name="model">purchase.requisition.line</field>
268+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_form"/>
269+ <field name="arch" type="xml">
270+ <xpath expr="//field[@name='product_qty']" position="after">
271+ <field name="account_analytic_plan_id"/>
272+ </xpath>
273+ </field>
274+ </record>
275+
276+ <record id="view_purchase_requisition_line_tree_account_analytic" model="ir.ui.view">
277+ <field name="name">purchase.requisition.line.tree.account.analytic</field>
278+ <field name="model">purchase.requisition.line</field>
279+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_tree"/>
280+ <field name="arch" type="xml">
281+ <xpath expr="//field[@name='product_qty']" position="after">
282+ <field name="account_analytic_plan_id" groups="purchase.group_analytic_accounting"/>
283+ </xpath>
284+ </field>
285+ </record>
286+ </data>
287+</openerp>
288
289=== added directory 'purchase_requisition_line_plan/wizard'
290=== added file 'purchase_requisition_line_plan/wizard/__init__.py'
291--- purchase_requisition_line_plan/wizard/__init__.py 1970-01-01 00:00:00 +0000
292+++ purchase_requisition_line_plan/wizard/__init__.py 2014-06-13 14:00:51 +0000
293@@ -0,0 +1,25 @@
294+#!/usr/bin/python
295+# -*- encoding: utf-8 -*-
296+###############################################################################
297+# Module Writen to OpenERP, Open Source Management Solution
298+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
299+# All Rights Reserved
300+############# Credits #########################################################
301+# Coded by: Yanina Aular <yani@vauxoo.com>
302+# Planified by: Humberto Arocha <hbto@vauxoo.com>
303+# Audited by: Humberto Arocha <hbto@vauxoo.com>
304+###############################################################################
305+# This program is free software: you can redistribute it and/or modify
306+# it under the terms of the GNU Affero General Public License as published
307+# by the Free Software Foundation, either version 3 of the License, or
308+# (at your option) any later version.
309+#
310+# This program is distributed in the hope that it will be useful,
311+# but WITHOUT ANY WARRANTY; without even the implied warranty of
312+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
313+# GNU Affero General Public License for more details.
314+#
315+# You should have received a copy of the GNU Affero General Public License
316+# along with this program. If not, see <http://www.gnu.org/licenses/>.
317+###############################################################################
318+
319
320=== added directory 'purchase_requisition_line_plan/workflow'