Merge lp:~vauxoo/addons-vauxoo/7.0-modularize_purchase_requisition_make_po_to_module_with_description-dev-yani into lp:addons-vauxoo/7.0

Proposed by Yanina Aular (Vauxoo)
Status: Merged
Merged at revision: 1023
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-modularize_purchase_requisition_make_po_to_module_with_description-dev-yani
Merge into: lp:addons-vauxoo/7.0
Diff against target: 1235 lines (+866/-126)
24 files modified
pr_line_related_po_line/__init__.py (+27/-0)
pr_line_related_po_line/__openerp__.py (+52/-0)
pr_line_related_po_line/model/__init__.py (+25/-0)
pr_line_related_po_line/model/purchase_order_line.py (+92/-0)
pr_line_related_po_line/wizard/__init__.py (+25/-0)
purchase_order_requisitor/__init__.py (+27/-0)
purchase_order_requisitor/__openerp__.py (+48/-0)
purchase_order_requisitor/model/__init__.py (+26/-0)
purchase_order_requisitor/model/purchase_requisition.py (+7/-104)
purchase_order_requisitor/view/purchase_requisition_view.xml (+0/-19)
purchase_order_requisitor/wizard/__init__.py (+25/-0)
purchase_requisition_line_analytic/__init__.py (+27/-0)
purchase_requisition_line_analytic/__openerp__.py (+53/-0)
purchase_requisition_line_analytic/model/__init__.py (+26/-0)
purchase_requisition_line_analytic/model/purchase_requisition.py (+67/-0)
purchase_requisition_line_analytic/view/purchase_requisition_view.xml (+40/-0)
purchase_requisition_line_analytic/wizard/__init__.py (+25/-0)
purchase_requisition_line_description/__init__.py (+27/-0)
purchase_requisition_line_description/__openerp__.py (+61/-0)
purchase_requisition_line_description/model/__init__.py (+26/-0)
purchase_requisition_line_description/model/purchase_requisition_line.py (+88/-0)
purchase_requisition_line_description/view/purchase_requisition_view.xml (+41/-0)
purchase_requisition_line_description/wizard/__init__.py (+25/-0)
purchase_requisition_make_po/__openerp__.py (+6/-3)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-modularize_purchase_requisition_make_po_to_module_with_description-dev-yani
Reviewer Review Type Date Requested Status
Yanina Aular (Vauxoo) Approve
Review via email: mp+221748@code.launchpad.net

Description of the change

The field name is separated from the module purchase_requisition_make_po to purchase_requisition_line_description

To post a comment you must log in.
Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) wrote :

The merge was made to monitor the RunBot. It is developing

1029. By Yanina Aular (Vauxoo)

[FIX] bad link to view

1030. By Yanina Aular (Vauxoo)

[ADD] dependence to purchase_requisition

1031. By Yanina Aular (Vauxoo)

[IMP] edit original view of purchase_requisition_line

1032. By Yanina Aular (Vauxoo)

[ADD] module description

1033. By Yanina Aular (Vauxoo)

[IMP] word line in view id

1034. By Yanina Aular (Vauxoo)

[DEL] code related with acccount_analytic and requisition user

1035. By Yanina Aular (Vauxoo)

[ADD] new module, related field purchase_order_line is added in purchase_requisition_line

1036. By Yanina Aular (Vauxoo)

[ADD] field purchase_requisition_line_id

1037. By Yanina Aular (Vauxoo)

[IMP] change name file python

1038. By Yanina Aular (Vauxoo)

[IMP] Overwrite method make_purchase_order, purchase_requisition_line field is added to purchase.order.line model

1039. By Yanina Aular (Vauxoo)

[ADD] field related from purchase order line to purchase requisition line

1040. By Yanina Aular (Vauxoo)

[ADD] module that adds a field related to purchase requisition line from purchase requisition order

1041. By Yanina Aular (Vauxoo)

[ADD] new module purchase_requisition_line_account_analytic

1042. By Yanina Aular (Vauxoo)

[FIX] view in purchase_requisition_line_account_analytic

1043. By Yanina Aular (Vauxoo)

[ADD] depends in purchase_requisition_make_po

1044. By Yanina Aular (Vauxoo)

[IMP] clean code in purchase_requisition_make_po

1045. By Yanina Aular (Vauxoo)

[ADD] new module purchase_requisition_requisitor

1046. By Yanina Aular (Vauxoo)

[IMP] clean in __openerp__.py of purchase_requisition_make_po and purchase_requisition_requisitor

1047. By Yanina Aular (Vauxoo)

[IMP] module name chaged by Purchase Requisition Line Analytic

1048. By Yanina Aular (Vauxoo)

[IMP] purchase_requisition_requisitor renamed to purchase_order_requisitor

1049. By Yanina Aular (Vauxoo)

[IMP] change depends in urchase_requisition_make_po

1050. By Yanina Aular (Vauxoo)

[IMP] module purchase_requisition_line_account_analytic name changed to purchase_requisition_line_analytic

1051. By Yanina Aular (Vauxoo)

[ADD] copy requisitor of purchase requisition line to purchase order

1052. By Yanina Aular (Vauxoo)

[ADD] description added to pr_line_related_po_line, purchase_requisition_line_analytic, and purchase_requisition_line_description modules

Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) wrote :

Ready to merge

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'pr_line_related_po_line'
2=== added file 'pr_line_related_po_line/__init__.py'
3--- pr_line_related_po_line/__init__.py 1970-01-01 00:00:00 +0000
4+++ pr_line_related_po_line/__init__.py 2014-06-02 22:18:31 +0000
5@@ -0,0 +1,27 @@
6+#!/usr/bin/python
7+# -*- encoding: utf-8 -*-
8+###############################################################################
9+# Module Writen to OpenERP, Open Source Management Solution
10+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
11+# All Rights Reserved
12+############# Credits #########################################################
13+# Coded by: Yanina Aular <yani@vauxoo.com>
14+# Planified by: Humberto Arocha <hbto@vauxoo.com>
15+# Audited by: Humberto Arocha <hbto@vauxoo.com>
16+###############################################################################
17+# This program is free software: you can redistribute it and/or modify
18+# it under the terms of the GNU Affero General Public License as published
19+# by the Free Software Foundation, either version 3 of the License, or
20+# (at your option) any later version.
21+#
22+# This program is distributed in the hope that it will be useful,
23+# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+# GNU Affero General Public License for more details.
26+#
27+# You should have received a copy of the GNU Affero General Public License
28+# along with this program. If not, see <http://www.gnu.org/licenses/>.
29+###############################################################################
30+
31+import model
32+import wizard
33
34=== added file 'pr_line_related_po_line/__openerp__.py'
35--- pr_line_related_po_line/__openerp__.py 1970-01-01 00:00:00 +0000
36+++ pr_line_related_po_line/__openerp__.py 2014-06-02 22:18:31 +0000
37@@ -0,0 +1,52 @@
38+#!/usr/bin/python
39+# -*- encoding: utf-8 -*-
40+###############################################################################
41+# Module Writen to OpenERP, Open Source Management Solution
42+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
43+# All Rights Reserved
44+############# Credits #########################################################
45+# Coded by: Yanina Aular <yani@vauxoo.com>
46+# Planified by: Humberto Arocha <hbto@vauxoo.com>
47+# Audited by: Humberto Arocha <hbto@vauxoo.com>
48+###############################################################################
49+# This program is free software: you can redistribute it and/or modify
50+# it under the terms of the GNU Affero General Public License as published
51+# by the Free Software Foundation, either version 3 of the License, or
52+# (at your option) any later version.
53+#
54+# This program is distributed in the hope that it will be useful,
55+# but WITHOUT ANY WARRANTY; without even the implied warranty of
56+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
57+# GNU Affero General Public License for more details.
58+#
59+# You should have received a copy of the GNU Affero General Public License
60+# along with this program. If not, see <http://www.gnu.org/licenses/>.
61+###############################################################################
62+
63+{
64+ 'name': 'pr_line_related_po_line',
65+ 'version': '1.0',
66+ 'author': 'Vauxoo',
67+ 'website': 'http://www.vauxoo.com/',
68+ 'category': '',
69+ 'description': '''
70+Add purchase_requisition_line_id field, it is id of purchase requisition line from where purchase
71+order line is created, overwrite the make_purchase_order method for add value of
72+purchase_requisition_line_id to record purchase order line, it is help to make best inherit and
73+modification of make_purchase_order method, as can be seen in
74+purchase_requisition_line_description, purchase_requisition_line_analytic and
75+purchase_requisition_requisitor modules.
76+''',
77+ 'depends': [
78+ 'purchase',
79+ 'purchase_requisition',
80+ ],
81+ 'data': [],
82+ 'demo': [],
83+ 'test': [],
84+ 'qweb': [],
85+ 'js': [],
86+ 'css': [],
87+ 'active': False,
88+ 'installable': True,
89+}
90
91=== added directory 'pr_line_related_po_line/data'
92=== added directory 'pr_line_related_po_line/demo'
93=== added directory 'pr_line_related_po_line/doc'
94=== added directory 'pr_line_related_po_line/doc/images'
95=== added directory 'pr_line_related_po_line/i18n'
96=== added directory 'pr_line_related_po_line/model'
97=== added file 'pr_line_related_po_line/model/__init__.py'
98--- pr_line_related_po_line/model/__init__.py 1970-01-01 00:00:00 +0000
99+++ pr_line_related_po_line/model/__init__.py 2014-06-02 22:18:31 +0000
100@@ -0,0 +1,25 @@
101+#!/usr/bin/python
102+# -*- encoding: utf-8 -*-
103+###############################################################################
104+# Module Writen to OpenERP, Open Source Management Solution
105+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
106+# All Rights Reserved
107+############# Credits #########################################################
108+# Coded by: Yanina Aular <yani@vauxoo.com>
109+# Planified by: Humberto Arocha <hbto@vauxoo.com>
110+# Audited by: Humberto Arocha <hbto@vauxoo.com>
111+###############################################################################
112+# This program is free software: you can redistribute it and/or modify
113+# it under the terms of the GNU Affero General Public License as published
114+# by the Free Software Foundation, either version 3 of the License, or
115+# (at your option) any later version.
116+#
117+# This program is distributed in the hope that it will be useful,
118+# but WITHOUT ANY WARRANTY; without even the implied warranty of
119+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
120+# GNU Affero General Public License for more details.
121+#
122+# You should have received a copy of the GNU Affero General Public License
123+# along with this program. If not, see <http://www.gnu.org/licenses/>.
124+###############################################################################
125+import purchase_order_line
126
127=== added file 'pr_line_related_po_line/model/purchase_order_line.py'
128--- pr_line_related_po_line/model/purchase_order_line.py 1970-01-01 00:00:00 +0000
129+++ pr_line_related_po_line/model/purchase_order_line.py 2014-06-02 22:18:31 +0000
130@@ -0,0 +1,92 @@
131+#!/usr/bin/python
132+# -*- encoding: utf-8 -*-
133+###############################################################################
134+# Module Writen to OpenERP, Open Source Management Solution
135+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
136+# All Rights Reserved
137+############# Credits #########################################################
138+# Coded by: Yanina Aular <yani@vauxoo.com>
139+# Planified by: Humberto Arocha <hbto@vauxoo.com>
140+# Audited by: Humberto Arocha <hbto@vauxoo.com>
141+###############################################################################
142+# This program is free software: you can redistribute it and/or modify
143+# it under the terms of the GNU Affero General Public License as published
144+# by the Free Software Foundation, either version 3 of the License, or
145+# (at your option) any later version.
146+#
147+# This program is distributed in the hope that it will be useful,
148+# but WITHOUT ANY WARRANTY; without even the implied warranty of
149+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
150+# GNU Affero General Public License for more details.
151+#
152+# You should have received a copy of the GNU Affero General Public License
153+# along with this program. If not, see <http://www.gnu.org/licenses/>.
154+###############################################################################
155+
156+from openerp.osv import fields, osv
157+from openerp import netsvc
158+from openerp.tools.translate import _
159+
160+class purchase_order_line(osv.Model):
161+
162+ _inherit = 'purchase.order.line'
163+
164+ _columns = {
165+ 'purchase_requisition_line_id': fields.many2one('purchase.requisition.line',"Purchase \
166+ Requisition Line"),
167+ }
168+
169+class purchase_requisition(osv.Model):
170+
171+ _inherit = 'purchase.requisition'
172+
173+ def make_purchase_order(self, cr, uid, ids, partner_id, context=None):
174+ """
175+ Create New RFQ for Supplier
176+ """
177+ if context is None:
178+ context = {}
179+ assert partner_id, 'Supplier should be specified'
180+ purchase_order = self.pool.get('purchase.order')
181+ purchase_order_line = self.pool.get('purchase.order.line')
182+ res_partner = self.pool.get('res.partner')
183+ fiscal_position = self.pool.get('account.fiscal.position')
184+ supplier = res_partner.browse(cr, uid, partner_id, context=context)
185+ supplier_pricelist = supplier.property_product_pricelist_purchase or False
186+ res = {}
187+ for requisition in self.browse(cr, uid, ids, context=context):
188+ if supplier.id in filter(lambda x: x, [rfq.state <> 'cancel' and rfq.partner_id.id or None for rfq in requisition.purchase_ids]):
189+ raise osv.except_osv(_('Warning!'), _('You have already one %s purchase order for this partner, you must cancel this purchase order to create a new quotation.') % rfq.state)
190+ location_id = requisition.warehouse_id.lot_input_id.id
191+ purchase_id = purchase_order.create(cr, uid, {
192+ 'origin': requisition.name,
193+ 'partner_id': supplier.id,
194+ 'pricelist_id': supplier_pricelist.id,
195+ 'location_id': location_id,
196+ 'company_id': requisition.company_id.id,
197+ 'fiscal_position': supplier.property_account_position and supplier.property_account_position.id or False,
198+ 'requisition_id':requisition.id,
199+ 'notes':requisition.description,
200+ 'warehouse_id':requisition.warehouse_id.id ,
201+ })
202+ res[requisition.id] = purchase_id
203+ for line in requisition.line_ids:
204+ product = line.product_id
205+ seller_price, qty, default_uom_po_id, date_planned = self._seller_details(cr, uid, line, supplier, context=context)
206+ taxes_ids = product.supplier_taxes_id
207+ taxes = fiscal_position.map_tax(cr, uid, supplier.property_account_position, taxes_ids)
208+ purchase_order_line.create(cr, uid, {
209+ 'order_id': purchase_id,
210+ #change
211+ 'purchase_requisition_line_id': line.id,
212+ #end change
213+ 'name': product.partner_ref,
214+ 'product_qty': qty,
215+ 'product_id': product.id,
216+ 'product_uom': default_uom_po_id,
217+ 'price_unit': seller_price,
218+ 'date_planned': date_planned,
219+ 'taxes_id': [(6, 0, taxes)],
220+ }, context=context)
221+
222+ return res
223
224=== added directory 'pr_line_related_po_line/report'
225=== added directory 'pr_line_related_po_line/security'
226=== added directory 'pr_line_related_po_line/static'
227=== added directory 'pr_line_related_po_line/static/description'
228=== added file 'pr_line_related_po_line/static/description/index.html'
229=== added directory 'pr_line_related_po_line/static/src'
230=== added directory 'pr_line_related_po_line/static/src/css'
231=== added directory 'pr_line_related_po_line/static/src/img'
232=== added file 'pr_line_related_po_line/static/src/img/icon.png'
233Binary files pr_line_related_po_line/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and pr_line_related_po_line/static/src/img/icon.png 2014-06-02 22:18:31 +0000 differ
234=== added directory 'pr_line_related_po_line/static/src/js'
235=== added directory 'pr_line_related_po_line/static/src/xml'
236=== added directory 'pr_line_related_po_line/test'
237=== added directory 'pr_line_related_po_line/view'
238=== added directory 'pr_line_related_po_line/wizard'
239=== added file 'pr_line_related_po_line/wizard/__init__.py'
240--- pr_line_related_po_line/wizard/__init__.py 1970-01-01 00:00:00 +0000
241+++ pr_line_related_po_line/wizard/__init__.py 2014-06-02 22:18:31 +0000
242@@ -0,0 +1,25 @@
243+#!/usr/bin/python
244+# -*- encoding: utf-8 -*-
245+###############################################################################
246+# Module Writen to OpenERP, Open Source Management Solution
247+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
248+# All Rights Reserved
249+############# Credits #########################################################
250+# Coded by: Yanina Aular <yani@vauxoo.com>
251+# Planified by: Humberto Arocha <hbto@vauxoo.com>
252+# Audited by: Humberto Arocha <hbto@vauxoo.com>
253+###############################################################################
254+# This program is free software: you can redistribute it and/or modify
255+# it under the terms of the GNU Affero General Public License as published
256+# by the Free Software Foundation, either version 3 of the License, or
257+# (at your option) any later version.
258+#
259+# This program is distributed in the hope that it will be useful,
260+# but WITHOUT ANY WARRANTY; without even the implied warranty of
261+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
262+# GNU Affero General Public License for more details.
263+#
264+# You should have received a copy of the GNU Affero General Public License
265+# along with this program. If not, see <http://www.gnu.org/licenses/>.
266+###############################################################################
267+
268
269=== added directory 'pr_line_related_po_line/workflow'
270=== added directory 'purchase_order_requisitor'
271=== added file 'purchase_order_requisitor/__init__.py'
272--- purchase_order_requisitor/__init__.py 1970-01-01 00:00:00 +0000
273+++ purchase_order_requisitor/__init__.py 2014-06-02 22:18:31 +0000
274@@ -0,0 +1,27 @@
275+#!/usr/bin/python
276+# -*- encoding: utf-8 -*-
277+###############################################################################
278+# Module Writen to OpenERP, Open Source Management Solution
279+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
280+# All Rights Reserved
281+############# Credits #########################################################
282+# Coded by: Yanina Aular <yani@vauxoo.com>
283+# Planified by: Humberto Arocha <hbto@vauxoo.com>
284+# Audited by: Humberto Arocha <hbto@vauxoo.com>
285+###############################################################################
286+# This program is free software: you can redistribute it and/or modify
287+# it under the terms of the GNU Affero General Public License as published
288+# by the Free Software Foundation, either version 3 of the License, or
289+# (at your option) any later version.
290+#
291+# This program is distributed in the hope that it will be useful,
292+# but WITHOUT ANY WARRANTY; without even the implied warranty of
293+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
294+# GNU Affero General Public License for more details.
295+#
296+# You should have received a copy of the GNU Affero General Public License
297+# along with this program. If not, see <http://www.gnu.org/licenses/>.
298+###############################################################################
299+
300+import model
301+import wizard
302
303=== added file 'purchase_order_requisitor/__openerp__.py'
304--- purchase_order_requisitor/__openerp__.py 1970-01-01 00:00:00 +0000
305+++ purchase_order_requisitor/__openerp__.py 2014-06-02 22:18:31 +0000
306@@ -0,0 +1,48 @@
307+#!/usr/bin/python
308+# -*- encoding: utf-8 -*-
309+###############################################################################
310+# Module Writen to OpenERP, Open Source Management Solution
311+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
312+# All Rights Reserved
313+############# Credits #########################################################
314+# Coded by: Yanina Aular <yani@vauxoo.com>
315+# Planified by: Humberto Arocha <hbto@vauxoo.com>
316+# Audited by: Humberto Arocha <hbto@vauxoo.com>
317+###############################################################################
318+# This program is free software: you can redistribute it and/or modify
319+# it under the terms of the GNU Affero General Public License as published
320+# by the Free Software Foundation, either version 3 of the License, or
321+# (at your option) any later version.
322+#
323+# This program is distributed in the hope that it will be useful,
324+# but WITHOUT ANY WARRANTY; without even the implied warranty of
325+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
326+# GNU Affero General Public License for more details.
327+#
328+# You should have received a copy of the GNU Affero General Public License
329+# along with this program. If not, see <http://www.gnu.org/licenses/>.
330+###############################################################################
331+
332+{
333+ 'name': 'Purchase Requisition Requisitor',
334+ 'version': '1.0',
335+ 'author': 'Vauxoo',
336+ 'website': 'http://www.vauxoo.com/',
337+ 'category': '',
338+ 'description': '''
339+ Add a user field named Requisitor.
340+''',
341+ 'depends': [
342+ 'purchase_requisition',
343+ ],
344+ 'data': [
345+ 'view/purchase_requisition_view.xml',
346+ ],
347+ 'demo': [],
348+ 'test': [],
349+ 'qweb': [],
350+ 'js': [],
351+ 'css': [],
352+ 'active': False,
353+ 'installable': True,
354+}
355
356=== added directory 'purchase_order_requisitor/data'
357=== added directory 'purchase_order_requisitor/demo'
358=== added directory 'purchase_order_requisitor/doc'
359=== added directory 'purchase_order_requisitor/doc/images'
360=== added directory 'purchase_order_requisitor/i18n'
361=== added directory 'purchase_order_requisitor/model'
362=== added file 'purchase_order_requisitor/model/__init__.py'
363--- purchase_order_requisitor/model/__init__.py 1970-01-01 00:00:00 +0000
364+++ purchase_order_requisitor/model/__init__.py 2014-06-02 22:18:31 +0000
365@@ -0,0 +1,26 @@
366+#!/usr/bin/python
367+# -*- encoding: utf-8 -*-
368+###############################################################################
369+# Module Writen to OpenERP, Open Source Management Solution
370+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
371+# All Rights Reserved
372+############# Credits #########################################################
373+# Coded by: Yanina Aular <yani@vauxoo.com>
374+# Planified by: Humberto Arocha <hbto@vauxoo.com>
375+# Audited by: Humberto Arocha <hbto@vauxoo.com>
376+###############################################################################
377+# This program is free software: you can redistribute it and/or modify
378+# it under the terms of the GNU Affero General Public License as published
379+# by the Free Software Foundation, either version 3 of the License, or
380+# (at your option) any later version.
381+#
382+# This program is distributed in the hope that it will be useful,
383+# but WITHOUT ANY WARRANTY; without even the implied warranty of
384+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
385+# GNU Affero General Public License for more details.
386+#
387+# You should have received a copy of the GNU Affero General Public License
388+# along with this program. If not, see <http://www.gnu.org/licenses/>.
389+###############################################################################
390+
391+import purchase_requisition
392
393=== renamed file 'purchase_requisition_make_po/purchase_requisition.py' => 'purchase_order_requisitor/model/purchase_requisition.py'
394--- purchase_requisition_make_po/purchase_requisition.py 2014-05-09 21:51:34 +0000
395+++ purchase_order_requisitor/model/purchase_requisition.py 2014-06-02 22:18:31 +0000
396@@ -29,112 +29,23 @@
397 import openerp.addons.decimal_precision as dp
398 from openerp import tools
399
400-
401-class purchase_requisition_line(osv.Model):
402- _inherit = "purchase.requisition.line"
403+class purchase_order(osv.Model):
404+ _inherit = "purchase.order"
405
406 _columns = {
407- 'name': fields.text('Description', required=True),
408- 'account_analytic_id': fields.many2one(
409- 'account.analytic.account', 'Analytic Account',
410- help='This field is used to assign the selected'\
411- ' analytic account to the line of the purchase order'),
412+ 'rfq_user_id': fields.many2one('res.users', 'Requisitor'),
413 }
414-
415- def init(self, cr ):
416- cr.execute("""UPDATE purchase_requisition_line prl
417- SET name = (SELECT CONCAT('[',default_code,']',' ', name_template )
418- FROM product_product pp
419- WHERE pp.id = prl.product_id)
420- WHERE prl.name is NULL""")
421-
422- def onchange_product_id(self, cr, uid, ids, product_id,
423- product_uom_id, context=None):
424- product_obj = self.pool.get('product.product')
425- res = {'value': {'name': ''}}
426- if product_id:
427- product_name = product_obj.name_get(
428- cr, uid, product_id, context=context)
429- dummy, name = product_name and product_name[0] or (False,
430- False)
431-
432- product = product_obj.browse(cr, uid, product_id,
433- context=context)
434- if product.description_purchase:
435- name += '\n' + product.description_purchase
436- res['value'].update({'name': name})
437- return res
438-
439-purchase_requisition_line()
440-
441
442 class purchase_requisition(osv.Model):
443 _inherit = "purchase.requisition"
444
445+
446 def make_purchase_order(self, cr, uid, ids, partner_id,
447- context=None): # method override
448- """
449- Create New RFQ for Supplier
450- """
451+ context=None):
452 if context is None:
453 context = {}
454- assert partner_id, 'Supplier should be specified'
455- purchase_order = self.pool.get('purchase.order')
456- purchase_order_line = self.pool.get('purchase.order.line')
457- res_partner = self.pool.get('res.partner')
458- fiscal_position = self.pool.get('account.fiscal.position')
459- supplier = res_partner.browse(cr, uid, partner_id,
460- context=context)
461- supplier_pricelist =\
462- supplier.property_product_pricelist_purchase or False
463- res = {}
464- for requisition in self.browse(cr, uid, ids, context=context):
465- if supplier.id in filter(lambda x: x,
466- [rfq.state <> 'cancel' and rfq.partner_id.id or None\
467- for rfq in requisition.purchase_ids]):
468- raise osv.except_osv(
469- _('Warning!'), _('You have already one %s purchase'\
470- ' order for this partner, you must cancel this'\
471- ' purchase order to create a new quotation.') %\
472- rfq.state)
473- location_id = requisition.warehouse_id.lot_input_id.id
474- purchase_id = purchase_order.create(cr, uid, {
475- 'origin': requisition.name,
476- 'partner_id': supplier.id,
477- 'pricelist_id': supplier_pricelist.id,
478- 'location_id': location_id,
479- 'company_id': requisition.company_id.id,
480- 'fiscal_position': supplier.property_account_position\
481- and supplier.property_account_position.id or False,
482- 'requisition_id': requisition.id,
483- 'notes': requisition.description,
484- 'warehouse_id': requisition.warehouse_id.id,
485- })
486- res[requisition.id] = purchase_id
487- for line in requisition.line_ids:
488- product = line.product_id
489- seller_price, qty, default_uom_po_id, date_planned =\
490- self._seller_details(cr, uid, line, supplier,
491- context=context)
492- taxes_ids = product.supplier_taxes_id
493- taxes = fiscal_position.map_tax(
494- cr, uid, supplier.property_account_position,
495- taxes_ids)
496- purchase_order_line.create(cr, uid, {
497- 'order_id': purchase_id,
498- # start custom change
499- #'name': product.partner_ref,
500- 'name': line.name,
501- # end custom change
502- 'product_qty': qty,
503- 'product_id': product.id,
504- 'product_uom': default_uom_po_id,
505- 'price_unit': seller_price,
506- 'date_planned': date_planned,
507- 'taxes_id': [(6, 0, taxes)],
508- 'account_analytic_id': line.account_analytic_id\
509- and line.account_analytic_id.id or False,
510- }, context=context)
511+ res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context)
512+
513 if res:
514 requisition_user = self.browse(
515 cr, uid, res.keys()[0], context=context).user_id
516@@ -143,11 +54,3 @@
517 cr, uid, res[res.keys()[0]],
518 {'rfq_user_id': requisition_user.id})
519 return res
520-
521-
522-class purchase_order(osv.Model):
523- _inherit = "purchase.order"
524-
525- _columns = {
526- 'rfq_user_id': fields.many2one('res.users', 'Requisitor'),
527- }
528
529=== added directory 'purchase_order_requisitor/report'
530=== added directory 'purchase_order_requisitor/security'
531=== added directory 'purchase_order_requisitor/static'
532=== added directory 'purchase_order_requisitor/static/description'
533=== added file 'purchase_order_requisitor/static/description/index.html'
534=== added directory 'purchase_order_requisitor/static/src'
535=== added directory 'purchase_order_requisitor/static/src/css'
536=== added directory 'purchase_order_requisitor/static/src/img'
537=== added file 'purchase_order_requisitor/static/src/img/icon.png'
538Binary files purchase_order_requisitor/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_order_requisitor/static/src/img/icon.png 2014-06-02 22:18:31 +0000 differ
539=== added directory 'purchase_order_requisitor/static/src/js'
540=== added directory 'purchase_order_requisitor/static/src/xml'
541=== added directory 'purchase_order_requisitor/test'
542=== added directory 'purchase_order_requisitor/view'
543=== renamed file 'purchase_requisition_make_po/purchase_requisition_view.xml' => 'purchase_order_requisitor/view/purchase_requisition_view.xml'
544--- purchase_requisition_make_po/purchase_requisition_view.xml 2014-05-09 21:51:34 +0000
545+++ purchase_order_requisitor/view/purchase_requisition_view.xml 2014-06-02 22:18:31 +0000
546@@ -1,25 +1,6 @@
547 <?xml version="1.0"?>
548 <openerp>
549 <data>
550- <record id="view_purchase_requisition_form_inherit" model="ir.ui.view">
551- <field name="name">purchase.requisition.form.inherit</field>
552- <field name="model">purchase.requisition</field>
553- <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
554- <field name="arch" type="xml">
555- <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="before">
556- <field name="name"/>
557- </xpath>
558- <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="before">
559- <field name="name"/>
560- </xpath>
561- <xpath expr="//field[@name='line_ids']//form//field[@name='name']" position="after">
562- <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
563- </xpath>
564- <xpath expr="//field[@name='line_ids']//tree//field[@name='name']" position="after">
565- <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
566- </xpath>
567- </field>
568- </record>
569 <record model="ir.ui.view" id="inherit_purchase_order_view2">
570 <field name="name">purchase.order.view.inherit2</field>
571 <field name="model">purchase.order</field>
572
573=== added directory 'purchase_order_requisitor/wizard'
574=== added file 'purchase_order_requisitor/wizard/__init__.py'
575--- purchase_order_requisitor/wizard/__init__.py 1970-01-01 00:00:00 +0000
576+++ purchase_order_requisitor/wizard/__init__.py 2014-06-02 22:18:31 +0000
577@@ -0,0 +1,25 @@
578+#!/usr/bin/python
579+# -*- encoding: utf-8 -*-
580+###############################################################################
581+# Module Writen to OpenERP, Open Source Management Solution
582+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
583+# All Rights Reserved
584+############# Credits #########################################################
585+# Coded by: Yanina Aular <yani@vauxoo.com>
586+# Planified by: Humberto Arocha <hbto@vauxoo.com>
587+# Audited by: Humberto Arocha <hbto@vauxoo.com>
588+###############################################################################
589+# This program is free software: you can redistribute it and/or modify
590+# it under the terms of the GNU Affero General Public License as published
591+# by the Free Software Foundation, either version 3 of the License, or
592+# (at your option) any later version.
593+#
594+# This program is distributed in the hope that it will be useful,
595+# but WITHOUT ANY WARRANTY; without even the implied warranty of
596+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
597+# GNU Affero General Public License for more details.
598+#
599+# You should have received a copy of the GNU Affero General Public License
600+# along with this program. If not, see <http://www.gnu.org/licenses/>.
601+###############################################################################
602+
603
604=== added directory 'purchase_order_requisitor/workflow'
605=== added directory 'purchase_requisition_line_analytic'
606=== added file 'purchase_requisition_line_analytic/__init__.py'
607--- purchase_requisition_line_analytic/__init__.py 1970-01-01 00:00:00 +0000
608+++ purchase_requisition_line_analytic/__init__.py 2014-06-02 22:18:31 +0000
609@@ -0,0 +1,27 @@
610+#!/usr/bin/python
611+# -*- encoding: utf-8 -*-
612+###############################################################################
613+# Module Writen to OpenERP, Open Source Management Solution
614+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
615+# All Rights Reserved
616+############# Credits #########################################################
617+# Coded by: Yanina Aular <yani@vauxoo.com>
618+# Planified by: Humberto Arocha <hbto@vauxoo.com>
619+# Audited by: Humberto Arocha <hbto@vauxoo.com>
620+###############################################################################
621+# This program is free software: you can redistribute it and/or modify
622+# it under the terms of the GNU Affero General Public License as published
623+# by the Free Software Foundation, either version 3 of the License, or
624+# (at your option) any later version.
625+#
626+# This program is distributed in the hope that it will be useful,
627+# but WITHOUT ANY WARRANTY; without even the implied warranty of
628+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
629+# GNU Affero General Public License for more details.
630+#
631+# You should have received a copy of the GNU Affero General Public License
632+# along with this program. If not, see <http://www.gnu.org/licenses/>.
633+###############################################################################
634+
635+import model
636+import wizard
637
638=== added file 'purchase_requisition_line_analytic/__openerp__.py'
639--- purchase_requisition_line_analytic/__openerp__.py 1970-01-01 00:00:00 +0000
640+++ purchase_requisition_line_analytic/__openerp__.py 2014-06-02 22:18:31 +0000
641@@ -0,0 +1,53 @@
642+#!/usr/bin/python
643+# -*- encoding: utf-8 -*-
644+###############################################################################
645+# Module Writen to OpenERP, Open Source Management Solution
646+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
647+# All Rights Reserved
648+############# Credits #########################################################
649+# Coded by: Yanina Aular <yani@vauxoo.com>
650+# Planified by: Humberto Arocha <hbto@vauxoo.com>
651+# Audited by: Humberto Arocha <hbto@vauxoo.com>
652+###############################################################################
653+# This program is free software: you can redistribute it and/or modify
654+# it under the terms of the GNU Affero General Public License as published
655+# by the Free Software Foundation, either version 3 of the License, or
656+# (at your option) any later version.
657+#
658+# This program is distributed in the hope that it will be useful,
659+# but WITHOUT ANY WARRANTY; without even the implied warranty of
660+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
661+# GNU Affero General Public License for more details.
662+#
663+# You should have received a copy of the GNU Affero General Public License
664+# along with this program. If not, see <http://www.gnu.org/licenses/>.
665+###############################################################################
666+
667+{
668+ 'name': 'Purchase Requisition Line Analytic',
669+ 'version': '1.0',
670+ 'author': 'Vauxoo',
671+ 'website': 'http://www.vauxoo.com/',
672+ 'category': '',
673+ 'description': '''
674+A account analytic is added in purchase requisition lines
675+
676+Add analytic account on purchase requisition line, so the purchase order takes
677+the account analytic value from the purchase requisition.
678+''',
679+ 'depends': [
680+ 'purchase_requisition',
681+ 'purchase_requisition_line_view',
682+ 'pr_line_related_po_line',
683+ ],
684+ 'data': [
685+ 'view/purchase_requisition_view.xml',
686+ ],
687+ 'demo': [],
688+ 'test': [],
689+ 'qweb': [],
690+ 'js': [],
691+ 'css': [],
692+ 'active': False,
693+ 'installable': True,
694+}
695
696=== added directory 'purchase_requisition_line_analytic/data'
697=== added directory 'purchase_requisition_line_analytic/demo'
698=== added directory 'purchase_requisition_line_analytic/doc'
699=== added directory 'purchase_requisition_line_analytic/doc/images'
700=== added directory 'purchase_requisition_line_analytic/i18n'
701=== added directory 'purchase_requisition_line_analytic/model'
702=== added file 'purchase_requisition_line_analytic/model/__init__.py'
703--- purchase_requisition_line_analytic/model/__init__.py 1970-01-01 00:00:00 +0000
704+++ purchase_requisition_line_analytic/model/__init__.py 2014-06-02 22:18:31 +0000
705@@ -0,0 +1,26 @@
706+#!/usr/bin/python
707+# -*- encoding: utf-8 -*-
708+###############################################################################
709+# Module Writen to OpenERP, Open Source Management Solution
710+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
711+# All Rights Reserved
712+############# Credits #########################################################
713+# Coded by: Yanina Aular <yani@vauxoo.com>
714+# Planified by: Humberto Arocha <hbto@vauxoo.com>
715+# Audited by: Humberto Arocha <hbto@vauxoo.com>
716+###############################################################################
717+# This program is free software: you can redistribute it and/or modify
718+# it under the terms of the GNU Affero General Public License as published
719+# by the Free Software Foundation, either version 3 of the License, or
720+# (at your option) any later version.
721+#
722+# This program is distributed in the hope that it will be useful,
723+# but WITHOUT ANY WARRANTY; without even the implied warranty of
724+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
725+# GNU Affero General Public License for more details.
726+#
727+# You should have received a copy of the GNU Affero General Public License
728+# along with this program. If not, see <http://www.gnu.org/licenses/>.
729+###############################################################################
730+
731+import purchase_requisition
732
733=== added file 'purchase_requisition_line_analytic/model/purchase_requisition.py'
734--- purchase_requisition_line_analytic/model/purchase_requisition.py 1970-01-01 00:00:00 +0000
735+++ purchase_requisition_line_analytic/model/purchase_requisition.py 2014-06-02 22:18:31 +0000
736@@ -0,0 +1,67 @@
737+# -*- encoding: utf-8 -*-
738+########################################################################
739+#
740+# OpenERP, Open Source Management Solution
741+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
742+# $Id$
743+#
744+# This program is free software: you can redistribute it and/or modify
745+# it under the terms of the GNU Affero General Public License as published by
746+# the Free Software Foundation, either version 3 of the License, or
747+# (at your option) any later version.
748+#
749+# This program is distributed in the hope that it will be useful,
750+# but WITHOUT ANY WARRANTY; without even the implied warranty of
751+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
752+# GNU Affero General Public License for more details.
753+#
754+# You should have received a copy of the GNU Affero General Public License
755+# along with this program. If not, see <http://www.gnu.org/licenses/>.
756+#
757+########################################################################
758+from datetime import datetime
759+from dateutil.relativedelta import relativedelta
760+import time
761+from openerp import netsvc
762+
763+from openerp.osv import fields, osv
764+from openerp.tools.translate import _
765+import openerp.addons.decimal_precision as dp
766+from openerp import tools
767+
768+
769+class purchase_requisition_line(osv.Model):
770+ _inherit = "purchase.requisition.line"
771+
772+ _columns = {
773+ 'account_analytic_id': fields.many2one(
774+ 'account.analytic.account', 'Analytic Account',
775+ help='This field is used to assign the selected'\
776+ ' analytic account to the line of the purchase order'),
777+ }
778+
779+purchase_requisition_line()
780+
781+class purchase_requisition(osv.Model):
782+ _inherit = "purchase.requisition"
783+
784+
785+ def make_purchase_order(self, cr, uid, ids, partner_id,
786+ context=None):
787+ if context is None:
788+ context = {}
789+ res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context)
790+
791+ pol_obj = self.pool.get('purchase.order.line')
792+ prl_obj = self.pool.get('purchase.requisition.line')
793+ po_obj = self.pool.get('purchase.order')
794+
795+ for requisition in self.browse(cr, uid, ids, context=context):
796+ po_req = po_obj.search(cr, uid, [('requisition_id','=',requisition.id)], context=context)
797+ for po_id in po_req:
798+ pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)])
799+ for pol_id in pol_ids:
800+ pol_brw = pol_obj.browse(cr, uid, pol_id)
801+ pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_id':
802+ pol_brw.purchase_requisition_line_id.account_analytic_id}, context=context)
803+ return res
804
805=== added directory 'purchase_requisition_line_analytic/report'
806=== added directory 'purchase_requisition_line_analytic/security'
807=== added directory 'purchase_requisition_line_analytic/static'
808=== added directory 'purchase_requisition_line_analytic/static/description'
809=== added file 'purchase_requisition_line_analytic/static/description/index.html'
810=== added directory 'purchase_requisition_line_analytic/static/src'
811=== added directory 'purchase_requisition_line_analytic/static/src/css'
812=== added directory 'purchase_requisition_line_analytic/static/src/img'
813=== added file 'purchase_requisition_line_analytic/static/src/img/icon.png'
814Binary files purchase_requisition_line_analytic/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_analytic/static/src/img/icon.png 2014-06-02 22:18:31 +0000 differ
815=== added directory 'purchase_requisition_line_analytic/static/src/js'
816=== added directory 'purchase_requisition_line_analytic/static/src/xml'
817=== added directory 'purchase_requisition_line_analytic/test'
818=== added directory 'purchase_requisition_line_analytic/view'
819=== added file 'purchase_requisition_line_analytic/view/purchase_requisition_view.xml'
820--- purchase_requisition_line_analytic/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000
821+++ purchase_requisition_line_analytic/view/purchase_requisition_view.xml 2014-06-02 22:18:31 +0000
822@@ -0,0 +1,40 @@
823+<?xml version="1.0"?>
824+<openerp>
825+ <data>
826+ <record id="view_purchase_requisition_form_account_analytic" model="ir.ui.view">
827+ <field name="name">purchase.requisition.form.account.analytic</field>
828+ <field name="model">purchase.requisition</field>
829+ <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
830+ <field name="arch" type="xml">
831+ <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="after">
832+ <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
833+ </xpath>
834+ <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="after">
835+ <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
836+ </xpath>
837+ </field>
838+ </record>
839+
840+ <record id="view_purchase_requisition_line_form_account_analytic" model="ir.ui.view">
841+ <field name="name">purchase.requisition.line.form.account.analytic</field>
842+ <field name="model">purchase.requisition.line</field>
843+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_form"/>
844+ <field name="arch" type="xml">
845+ <xpath expr="//field[@name='product_qty']" position="after">
846+ <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
847+ </xpath>
848+ </field>
849+ </record>
850+
851+ <record id="view_purchase_requisition_line_tree_account_analytic" model="ir.ui.view">
852+ <field name="name">purchase.requisition.line.tree.account.analytic</field>
853+ <field name="model">purchase.requisition.line</field>
854+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_tree"/>
855+ <field name="arch" type="xml">
856+ <xpath expr="//field[@name='product_qty']" position="after">
857+ <field name="account_analytic_id" groups="purchase.group_analytic_accounting"/>
858+ </xpath>
859+ </field>
860+ </record>
861+ </data>
862+</openerp>
863
864=== added directory 'purchase_requisition_line_analytic/wizard'
865=== added file 'purchase_requisition_line_analytic/wizard/__init__.py'
866--- purchase_requisition_line_analytic/wizard/__init__.py 1970-01-01 00:00:00 +0000
867+++ purchase_requisition_line_analytic/wizard/__init__.py 2014-06-02 22:18:31 +0000
868@@ -0,0 +1,25 @@
869+#!/usr/bin/python
870+# -*- encoding: utf-8 -*-
871+###############################################################################
872+# Module Writen to OpenERP, Open Source Management Solution
873+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
874+# All Rights Reserved
875+############# Credits #########################################################
876+# Coded by: Yanina Aular <yani@vauxoo.com>
877+# Planified by: Humberto Arocha <hbto@vauxoo.com>
878+# Audited by: Humberto Arocha <hbto@vauxoo.com>
879+###############################################################################
880+# This program is free software: you can redistribute it and/or modify
881+# it under the terms of the GNU Affero General Public License as published
882+# by the Free Software Foundation, either version 3 of the License, or
883+# (at your option) any later version.
884+#
885+# This program is distributed in the hope that it will be useful,
886+# but WITHOUT ANY WARRANTY; without even the implied warranty of
887+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
888+# GNU Affero General Public License for more details.
889+#
890+# You should have received a copy of the GNU Affero General Public License
891+# along with this program. If not, see <http://www.gnu.org/licenses/>.
892+###############################################################################
893+
894
895=== added directory 'purchase_requisition_line_analytic/workflow'
896=== added directory 'purchase_requisition_line_description'
897=== added file 'purchase_requisition_line_description/__init__.py'
898--- purchase_requisition_line_description/__init__.py 1970-01-01 00:00:00 +0000
899+++ purchase_requisition_line_description/__init__.py 2014-06-02 22:18:31 +0000
900@@ -0,0 +1,27 @@
901+#!/usr/bin/python
902+# -*- encoding: utf-8 -*-
903+###############################################################################
904+# Module Writen to OpenERP, Open Source Management Solution
905+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
906+# All Rights Reserved
907+############# Credits #########################################################
908+# Coded by: Yanina Aular <yani@vauxoo.com>
909+# Planified by: Humberto Arocha <hbto@vauxoo.com>
910+# Audited by: Humberto Arocha <hbto@vauxoo.com>
911+###############################################################################
912+# This program is free software: you can redistribute it and/or modify
913+# it under the terms of the GNU Affero General Public License as published
914+# by the Free Software Foundation, either version 3 of the License, or
915+# (at your option) any later version.
916+#
917+# This program is distributed in the hope that it will be useful,
918+# but WITHOUT ANY WARRANTY; without even the implied warranty of
919+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
920+# GNU Affero General Public License for more details.
921+#
922+# You should have received a copy of the GNU Affero General Public License
923+# along with this program. If not, see <http://www.gnu.org/licenses/>.
924+###############################################################################
925+
926+import model
927+import wizard
928
929=== added file 'purchase_requisition_line_description/__openerp__.py'
930--- purchase_requisition_line_description/__openerp__.py 1970-01-01 00:00:00 +0000
931+++ purchase_requisition_line_description/__openerp__.py 2014-06-02 22:18:31 +0000
932@@ -0,0 +1,61 @@
933+#!/usr/bin/python
934+# -*- encoding: utf-8 -*-
935+###############################################################################
936+# Module Writen to OpenERP, Open Source Management Solution
937+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
938+# All Rights Reserved
939+############# Credits #########################################################
940+# Coded by: Yanina Aular <yani@vauxoo.com>
941+# Planified by: Humberto Arocha <hbto@vauxoo.com>
942+# Audited by: Humberto Arocha <hbto@vauxoo.com>
943+###############################################################################
944+# This program is free software: you can redistribute it and/or modify
945+# it under the terms of the GNU Affero General Public License as published
946+# by the Free Software Foundation, either version 3 of the License, or
947+# (at your option) any later version.
948+#
949+# This program is distributed in the hope that it will be useful,
950+# but WITHOUT ANY WARRANTY; without even the implied warranty of
951+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
952+# GNU Affero General Public License for more details.
953+#
954+# You should have received a copy of the GNU Affero General Public License
955+# along with this program. If not, see <http://www.gnu.org/licenses/>.
956+###############################################################################
957+
958+{
959+ 'name': 'Purchase Requisition Line Description',
960+ 'version': '1.0',
961+ 'author': 'Vauxoo',
962+ 'website': 'http://www.vauxoo.com/',
963+ 'category': '',
964+ 'description': '''
965+A description is added in purchase requisition lines
966+
967+Add description on product.
968+
969+Technical warning \n
970+Add method override to def make_purchase_order from purchase_requisition\n
971+When you install this module in the server show this warning:
972+
973+ WARNING: unable to set column name of table purchase_requisition_line not null !
974+
975+When you upgrade this module the field 'name' is set product name and
976+this warning not be displayed more.
977+''',
978+ 'depends': [
979+ 'purchase_requisition',
980+ 'purchase_requisition_line_view',
981+ 'pr_line_related_po_line',
982+ ],
983+ 'data': [
984+ 'view/purchase_requisition_view.xml',
985+ ],
986+ 'demo': [],
987+ 'test': [],
988+ 'qweb': [],
989+ 'js': [],
990+ 'css': [],
991+ 'active': False,
992+ 'installable': True,
993+}
994
995=== added directory 'purchase_requisition_line_description/data'
996=== added directory 'purchase_requisition_line_description/demo'
997=== added directory 'purchase_requisition_line_description/doc'
998=== added directory 'purchase_requisition_line_description/doc/images'
999=== added directory 'purchase_requisition_line_description/i18n'
1000=== added directory 'purchase_requisition_line_description/model'
1001=== added file 'purchase_requisition_line_description/model/__init__.py'
1002--- purchase_requisition_line_description/model/__init__.py 1970-01-01 00:00:00 +0000
1003+++ purchase_requisition_line_description/model/__init__.py 2014-06-02 22:18:31 +0000
1004@@ -0,0 +1,26 @@
1005+#!/usr/bin/python
1006+# -*- encoding: utf-8 -*-
1007+###############################################################################
1008+# Module Writen to OpenERP, Open Source Management Solution
1009+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
1010+# All Rights Reserved
1011+############# Credits #########################################################
1012+# Coded by: Yanina Aular <yani@vauxoo.com>
1013+# Planified by: Humberto Arocha <hbto@vauxoo.com>
1014+# Audited by: Humberto Arocha <hbto@vauxoo.com>
1015+###############################################################################
1016+# This program is free software: you can redistribute it and/or modify
1017+# it under the terms of the GNU Affero General Public License as published
1018+# by the Free Software Foundation, either version 3 of the License, or
1019+# (at your option) any later version.
1020+#
1021+# This program is distributed in the hope that it will be useful,
1022+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1023+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1024+# GNU Affero General Public License for more details.
1025+#
1026+# You should have received a copy of the GNU Affero General Public License
1027+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1028+###############################################################################
1029+
1030+import purchase_requisition_line
1031
1032=== added file 'purchase_requisition_line_description/model/purchase_requisition_line.py'
1033--- purchase_requisition_line_description/model/purchase_requisition_line.py 1970-01-01 00:00:00 +0000
1034+++ purchase_requisition_line_description/model/purchase_requisition_line.py 2014-06-02 22:18:31 +0000
1035@@ -0,0 +1,88 @@
1036+# -*- encoding: utf-8 -*-
1037+########################################################################
1038+#
1039+# OpenERP, Open Source Management Solution
1040+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
1041+# $Id$
1042+#
1043+# This program is free software: you can redistribute it and/or modify
1044+# it under the terms of the GNU Affero General Public License as published by
1045+# the Free Software Foundation, either version 3 of the License, or
1046+# (at your option) any later version.
1047+#
1048+# This program is distributed in the hope that it will be useful,
1049+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1050+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1051+# GNU Affero General Public License for more details.
1052+#
1053+# You should have received a copy of the GNU Affero General Public License
1054+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1055+#
1056+########################################################################
1057+from datetime import datetime
1058+from dateutil.relativedelta import relativedelta
1059+import time
1060+from openerp import netsvc
1061+
1062+from openerp.osv import fields, osv
1063+from openerp.tools.translate import _
1064+import openerp.addons.decimal_precision as dp
1065+from openerp import tools
1066+
1067+
1068+class purchase_requisition_line(osv.Model):
1069+ _inherit = "purchase.requisition.line"
1070+
1071+ _columns = {
1072+ 'name': fields.text('Description', required=True),
1073+ }
1074+
1075+ def init(self, cr ):
1076+ cr.execute("""UPDATE purchase_requisition_line prl
1077+ SET name = (SELECT CONCAT('[',default_code,']',' ', name_template )
1078+ FROM product_product pp
1079+ WHERE pp.id = prl.product_id)
1080+ WHERE prl.name is NULL""")
1081+
1082+ def onchange_product_id(self, cr, uid, ids, product_id,
1083+ product_uom_id, context=None):
1084+ product_obj = self.pool.get('product.product')
1085+ res = {'value': {'name': ''}}
1086+ if product_id:
1087+ product_name = product_obj.name_get(
1088+ cr, uid, product_id, context=context)
1089+ dummy, name = product_name and product_name[0] or (False,
1090+ False)
1091+
1092+ product = product_obj.browse(cr, uid, product_id,
1093+ context=context)
1094+ if product.description_purchase:
1095+ name += '\n' + product.description_purchase
1096+ res['value'].update({'name': name})
1097+ return res
1098+
1099+purchase_requisition_line()
1100+
1101+
1102+class purchase_requisition(osv.Model):
1103+ _inherit = "purchase.requisition"
1104+
1105+ def make_purchase_order(self, cr, uid, ids, partner_id,
1106+ context=None):
1107+ if context is None:
1108+ context = {}
1109+ res = super(purchase_requisition, self).make_purchase_order(cr, uid, ids, partner_id, context=context)
1110+
1111+ pol_obj = self.pool.get('purchase.order.line')
1112+ prl_obj = self.pool.get('purchase.requisition.line')
1113+ po_obj = self.pool.get('purchase.order')
1114+
1115+ for requisition in self.browse(cr, uid, ids, context=context):
1116+ po_req = po_obj.search(cr, uid, [('requisition_id','=',requisition.id)], context=context)
1117+ for po_id in po_req:
1118+ pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)])
1119+ for pol_id in pol_ids:
1120+ pol_brw = pol_obj.browse(cr, uid, pol_id)
1121+ pol_obj.write(cr, uid, [pol_brw.id], {'name':
1122+ pol_brw.purchase_requisition_line_id.name}, context=context)
1123+ return res
1124
1125=== added directory 'purchase_requisition_line_description/report'
1126=== added directory 'purchase_requisition_line_description/security'
1127=== added directory 'purchase_requisition_line_description/static'
1128=== added directory 'purchase_requisition_line_description/static/description'
1129=== added file 'purchase_requisition_line_description/static/description/index.html'
1130=== added directory 'purchase_requisition_line_description/static/src'
1131=== added directory 'purchase_requisition_line_description/static/src/css'
1132=== added directory 'purchase_requisition_line_description/static/src/img'
1133=== added file 'purchase_requisition_line_description/static/src/img/icon.png'
1134Binary files purchase_requisition_line_description/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and purchase_requisition_line_description/static/src/img/icon.png 2014-06-02 22:18:31 +0000 differ
1135=== added directory 'purchase_requisition_line_description/static/src/js'
1136=== added directory 'purchase_requisition_line_description/static/src/xml'
1137=== added directory 'purchase_requisition_line_description/test'
1138=== added directory 'purchase_requisition_line_description/view'
1139=== added file 'purchase_requisition_line_description/view/purchase_requisition_view.xml'
1140--- purchase_requisition_line_description/view/purchase_requisition_view.xml 1970-01-01 00:00:00 +0000
1141+++ purchase_requisition_line_description/view/purchase_requisition_view.xml 2014-06-02 22:18:31 +0000
1142@@ -0,0 +1,41 @@
1143+<?xml version="1.0"?>
1144+<openerp>
1145+ <data>
1146+ <record id="view_purchase_requisition_form_inherit_description" model="ir.ui.view">
1147+ <field name="name">purchase.requisition.form.inherit.description</field>
1148+ <field name="model">purchase.requisition</field>
1149+ <field name="inherit_id" ref="purchase_requisition.view_purchase_requisition_form"/>
1150+ <field name="arch" type="xml">
1151+ <xpath expr="//field[@name='line_ids']//tree//field[@name='product_qty']" position="before">
1152+ <field name="name"/>
1153+ </xpath>
1154+ <xpath expr="//field[@name='line_ids']//form//field[@name='product_qty']" position="before">
1155+ <field name="name"/>
1156+ </xpath>
1157+ </field>
1158+ </record>
1159+
1160+
1161+ <record id="view_purchase_requisition_line_form_description" model="ir.ui.view">
1162+ <field name="name">purchase.requisition.line.form.description</field>
1163+ <field name="model">purchase.requisition.line</field>
1164+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_form"/>
1165+ <field name="arch" type="xml">
1166+ <xpath expr="//field[@name='product_id']" position="after">
1167+ <field name="name"/>
1168+ </xpath>
1169+ </field>
1170+ </record>
1171+ <record id="view_purchase_requisition_line_tree_description" model="ir.ui.view">
1172+ <field name="name">purchase.requisition.line.tree.description</field>
1173+ <field name="model">purchase.requisition.line</field>
1174+ <field name="inherit_id" ref="purchase_requisition_line_view.view_purchase_requisition_line_tree"/>
1175+ <field name="arch" type="xml">
1176+ <xpath expr="//field[@name='product_id']" position="after">
1177+ <field name="name"/>
1178+ </xpath>
1179+ </field>
1180+ </record>
1181+
1182+ </data>
1183+</openerp>
1184
1185=== added directory 'purchase_requisition_line_description/wizard'
1186=== added file 'purchase_requisition_line_description/wizard/__init__.py'
1187--- purchase_requisition_line_description/wizard/__init__.py 1970-01-01 00:00:00 +0000
1188+++ purchase_requisition_line_description/wizard/__init__.py 2014-06-02 22:18:31 +0000
1189@@ -0,0 +1,25 @@
1190+#!/usr/bin/python
1191+# -*- encoding: utf-8 -*-
1192+###############################################################################
1193+# Module Writen to OpenERP, Open Source Management Solution
1194+# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
1195+# All Rights Reserved
1196+############# Credits #########################################################
1197+# Coded by: Yanina Aular <yani@vauxoo.com>
1198+# Planified by: Humberto Arocha <hbto@vauxoo.com>
1199+# Audited by: Humberto Arocha <hbto@vauxoo.com>
1200+###############################################################################
1201+# This program is free software: you can redistribute it and/or modify
1202+# it under the terms of the GNU Affero General Public License as published
1203+# by the Free Software Foundation, either version 3 of the License, or
1204+# (at your option) any later version.
1205+#
1206+# This program is distributed in the hope that it will be useful,
1207+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1208+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1209+# GNU Affero General Public License for more details.
1210+#
1211+# You should have received a copy of the GNU Affero General Public License
1212+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1213+###############################################################################
1214+
1215
1216=== added directory 'purchase_requisition_line_description/workflow'
1217=== modified file 'purchase_requisition_make_po/__openerp__.py'
1218--- purchase_requisition_make_po/__openerp__.py 2014-05-09 21:51:34 +0000
1219+++ purchase_requisition_make_po/__openerp__.py 2014-06-02 22:18:31 +0000
1220@@ -40,9 +40,12 @@
1221 When you upgrade this module the field 'name' is set product name and
1222 this warning not be displayed more.
1223 """,
1224- 'depends' : ['purchase_requisition'],
1225- 'data': [ 'purchase_requisition_view.xml',
1226- ],
1227+ 'depends' : ['purchase_requisition',
1228+ 'purchase_requisition_line_description',
1229+ 'purchase_requisition_line_analytic',
1230+ 'purchase_order_requisitor',
1231+ ],
1232+ 'data': [],
1233 'auto_install': False,
1234 'installable': True,
1235 }