Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-procurement_order_merge-dev-julio into lp:addons-vauxoo/6.1
- addons-vauxoo-6.1-procurement_order_merge-dev-julio
- Merge into 6.1
Proposed by
Julio Serna-http://www.vauxoo.com
Status: | Merged |
---|---|
Merged at revision: | 513 |
Proposed branch: | lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-procurement_order_merge-dev-julio |
Merge into: | lp:addons-vauxoo/6.1 |
Diff against target: |
430 lines (+393/-0) 7 files modified
procurement_order_merge/__init__.py (+27/-0) procurement_order_merge/__openerp__.py (+45/-0) procurement_order_merge/i18n/es_MX.po (+98/-0) procurement_order_merge/procurement.py (+80/-0) procurement_order_merge/wizard/__init__.py (+26/-0) procurement_order_merge/wizard/procurement_order_merge.py (+67/-0) procurement_order_merge/wizard/procurement_order_merge_view.xml (+50/-0) |
To merge this branch: | bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.1-procurement_order_merge-dev-julio |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Julio Serna-http://www.vauxoo.com | Needs Resubmitting | ||
Moisés López - http://www.vauxoo.com | Pending | ||
Review via email:
|
Commit message
Description of the change
crea wizard para agrupar procurements
To post a comment you must log in.
- 515. By Julio Serna-http://www.vauxoo.com
-
[REF][procureme
nt_order_ merge] changed name files that have word group for merge - 516. By Julio Serna-http://www.vauxoo.com
-
[REF][procureme
nt_order_ merge] modified fucntions wtih name group for merge
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Julio Serna-http://www.vauxoo.com (hearthebreaker) wrote : | # |
review:
Needs Resubmitting
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'procurement_order_merge' |
2 | === added file 'procurement_order_merge/__init__.py' |
3 | --- procurement_order_merge/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ procurement_order_merge/__init__.py 2012-10-12 18:09:18 +0000 |
5 | @@ -0,0 +1,27 @@ |
6 | +# -*- encoding: utf-8 -*- |
7 | +########################################################################### |
8 | +# Module Writen to OpenERP, Open Source Management Solution |
9 | +# |
10 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
11 | +# All Rights Reserved. |
12 | +# info@vauxoo.com |
13 | +############################################################################ |
14 | +# Coded by: julio (julio@vauxoo.com) |
15 | +############################################################################ |
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 |
19 | +# published by the Free Software Foundation, either version 3 of the |
20 | +# License, or (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 procurement |
32 | +import wizard |
33 | |
34 | === added file 'procurement_order_merge/__openerp__.py' |
35 | --- procurement_order_merge/__openerp__.py 1970-01-01 00:00:00 +0000 |
36 | +++ procurement_order_merge/__openerp__.py 2012-10-12 18:09:18 +0000 |
37 | @@ -0,0 +1,45 @@ |
38 | +# -*- encoding: utf-8 -*- |
39 | +########################################################################### |
40 | +# Module Writen to OpenERP, Open Source Management Solution |
41 | +# |
42 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
43 | +# All Rights Reserved. |
44 | +# info@vauxoo.com |
45 | +############################################################################ |
46 | +# Coded by: julio (julio@vauxoo.com) |
47 | +############################################################################ |
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 |
51 | +# published by the Free Software Foundation, either version 3 of the |
52 | +# License, or (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 | +{ |
65 | + "name": "Procurement Order Merge", |
66 | + "version": "1.1", |
67 | + "author" : "Vauxoo", |
68 | + "category": "Generic Modules/Procurement", |
69 | + "website" : "http://www.vauxoo.com/", |
70 | + "description": """ Merge with wizard the procurement |
71 | + """, |
72 | + 'depends': ['procurement'], |
73 | + 'init_xml': [], |
74 | + 'update_xml': [ |
75 | + 'wizard/procurement_order_merge_view.xml', |
76 | + ], |
77 | + 'demo_xml': [], |
78 | + 'test': [], |
79 | + 'installable': True, |
80 | + 'active': False, |
81 | +} |
82 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
83 | |
84 | === added directory 'procurement_order_merge/i18n' |
85 | === added file 'procurement_order_merge/i18n/es_MX.po' |
86 | --- procurement_order_merge/i18n/es_MX.po 1970-01-01 00:00:00 +0000 |
87 | +++ procurement_order_merge/i18n/es_MX.po 2012-10-12 18:09:18 +0000 |
88 | @@ -0,0 +1,98 @@ |
89 | +# Translation of OpenERP Server. |
90 | +# This file contains the translation of the following modules: |
91 | +# * procurement_order_merge |
92 | +# |
93 | +msgid "" |
94 | +msgstr "" |
95 | +"Project-Id-Version: OpenERP Server 6.1\n" |
96 | +"Report-Msgid-Bugs-To: \n" |
97 | +"POT-Creation-Date: 2012-10-12 17:58+0000\n" |
98 | +"PO-Revision-Date: 2012-10-12 13:02-0600\n" |
99 | +"Last-Translator: julio <julio@vauxoo.com>\n" |
100 | +"Language-Team: \n" |
101 | +"MIME-Version: 1.0\n" |
102 | +"Content-Type: text/plain; charset=UTF-8\n" |
103 | +"Content-Transfer-Encoding: 8bit\n" |
104 | +"Plural-Forms: \n" |
105 | + |
106 | +#. module: procurement_order_merge |
107 | +#: view:procurement.order.merge:0 |
108 | +msgid "Are you sure you want to merge these procurements ?" |
109 | +msgstr "Estas seguro de querer mezclar estos abastecimientos ?" |
110 | + |
111 | +#. module: procurement_order_merge |
112 | +#: view:procurement.order.merge:0 |
113 | +msgid "Merge Procurement" |
114 | +msgstr "Mezclar abastecimientos" |
115 | + |
116 | +#. module: procurement_order_merge |
117 | +#: model:ir.model,name:procurement_order_merge.model_procurement_order_merge |
118 | +msgid "procurement.order.merge" |
119 | +msgstr "procurement.order.merge" |
120 | + |
121 | +#. module: procurement_order_merge |
122 | +#: model:ir.actions.act_window,name:procurement_order_merge.create_procurement_merge_action |
123 | +#: model:ir.actions.act_window,name:procurement_order_merge.procurement_merge_wizard |
124 | +#: view:procurement.order.merge:0 |
125 | +msgid "Procurement Merge" |
126 | +msgstr "Mezclar abastecimientos" |
127 | + |
128 | +#. module: procurement_order_merge |
129 | +#: model:ir.model,name:procurement_order_merge.model_procurement_order |
130 | +msgid "Procurement" |
131 | +msgstr "Abastecimiento" |
132 | + |
133 | +#. module: procurement_order_merge |
134 | +#: code:addons/procurement_order_merge/procurement.py:60 |
135 | +#, python-format |
136 | +msgid "Procurements can not be merged" |
137 | +msgstr "Abastecimientos no pueden ser mezclados" |
138 | + |
139 | +#. module: procurement_order_merge |
140 | +#: code:addons/procurement_order_merge/wizard/procurement_order_merge.py:38 |
141 | +#, python-format |
142 | +msgid "Please select multiple order to merge in the list view." |
143 | +msgstr "Por Favor seleccione varios abastecimientos en la lista para mezclarlos." |
144 | + |
145 | +#. module: procurement_order_merge |
146 | +#: code:addons/procurement_order_merge/procurement.py:57 |
147 | +#: code:addons/procurement_order_merge/procurement.py:60 |
148 | +#, python-format |
149 | +msgid "Error" |
150 | +msgstr "Error" |
151 | + |
152 | +#. module: procurement_order_merge |
153 | +#: view:procurement.order.merge:0 |
154 | +msgid "Cancel" |
155 | +msgstr "Cancelar" |
156 | + |
157 | +#. module: procurement_order_merge |
158 | +#: code:addons/procurement_order_merge/wizard/procurement_order_merge.py:37 |
159 | +#, python-format |
160 | +msgid "Warning" |
161 | +msgstr "Advertencia" |
162 | + |
163 | +#. module: procurement_order_merge |
164 | +#: code:addons/procurement_order_merge/procurement.py:57 |
165 | +#, python-format |
166 | +msgid "Procurements must be in state draft" |
167 | +msgstr "Los abastecimientos deben de estar en estado borrador" |
168 | + |
169 | +#. module: procurement_order_merge |
170 | +#: view:procurement.order.merge:0 |
171 | +msgid "" |
172 | +" Please note that: \n" |
173 | +" \n" |
174 | +" Orders will only be merged if: \n" |
175 | +" * Procurments Orders are in draft \n" |
176 | +" * Procurments Orders have same location \n" |
177 | +" * Procurments Orders have same procurement method \n" |
178 | +" * Procurments Orders have same product " |
179 | +msgstr "" |
180 | +"Por favor note que: \n" |
181 | +"Abastecimientos solo se mezclaran si: \n" |
182 | +" *Orden de abastecimiento esta en estado borrador \n" |
183 | +" * Orden de abastecimiento tienen la misma ubicacion \n" |
184 | +" * Orden de abastecimiento tienen el misma metodo de abastecimiento \n" |
185 | +" * Orden de abastecimiento tienen el mismo producto" |
186 | + |
187 | |
188 | === added file 'procurement_order_merge/procurement.py' |
189 | --- procurement_order_merge/procurement.py 1970-01-01 00:00:00 +0000 |
190 | +++ procurement_order_merge/procurement.py 2012-10-12 18:09:18 +0000 |
191 | @@ -0,0 +1,80 @@ |
192 | +# -*- encoding: utf-8 -*- |
193 | +########################################################################### |
194 | +# Module Writen to OpenERP, Open Source Management Solution |
195 | +# |
196 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
197 | +# All Rights Reserved. |
198 | +# info@vauxoo.com |
199 | +############################################################################ |
200 | +# Coded by: julio (julio@vauxoo.com) |
201 | +############################################################################ |
202 | +# |
203 | +# This program is free software: you can redistribute it and/or modify |
204 | +# it under the terms of the GNU Affero General Public License as |
205 | +# published by the Free Software Foundation, either version 3 of the |
206 | +# License, or (at your option) any later version. |
207 | +# |
208 | +# This program is distributed in the hope that it will be useful, |
209 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
210 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
211 | +# GNU Affero General Public License for more details. |
212 | +# |
213 | +# You should have received a copy of the GNU Affero General Public License |
214 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
215 | +# |
216 | +############################################################################## |
217 | +from osv import osv,fields |
218 | +from tools.translate import _ |
219 | +import netsvc |
220 | + |
221 | +class procurement_order(osv.osv): |
222 | + _inherit='procurement.order' |
223 | + |
224 | + def do_merge(self, cr, uid, ids, context={}): |
225 | + procurement_order = self.pool.get('procurement.order') |
226 | + |
227 | + res_product = {} |
228 | + res_location = {} |
229 | + res_method = {} |
230 | + res_name = [] |
231 | + res_origin = [] |
232 | + ok = False |
233 | + |
234 | + for procurement in procurement_order.browse(cr, uid, ids): |
235 | + |
236 | + if procurement.state <> 'draft': |
237 | + ok = True |
238 | + |
239 | + res_product.setdefault(procurement.product_id.id, 0) |
240 | + res_product[procurement.product_id.id] += self.pool.get('product.uom')._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, to_uom_id=procurement.product_id.uom_id.id) |
241 | + res_location.setdefault(procurement.location_id.id, 1) |
242 | + res_method.setdefault(procurement.procure_method, 1) |
243 | + res_name.append(procurement.name) |
244 | + res_origin.append(procurement.origin) |
245 | + product_uom = procurement.product_id.uom_id.id |
246 | + |
247 | + if ok == True: |
248 | + raise osv.except_osv(_('Error'), _('Procurements must be in state draft') ) |
249 | + |
250 | + if len(res_product) > 1 or len(res_location) > 1 or len(res_method) > 1: |
251 | + raise osv.except_osv(_('Error'), _('Procurements can not be merged') ) |
252 | + |
253 | + else: |
254 | + procure_name = ','.join( map(str, res_name) ) |
255 | + procure_origin = ','.join( map(str, res_origin) ) |
256 | + procurement_order.create(cr, uid, { |
257 | + 'name' : procure_name, |
258 | + 'origin' : procure_origin, |
259 | + 'product_id' : res_product.items()[0][0], |
260 | + 'location_id' : res_location.keys()[0], |
261 | + 'product_qty' : res_product.items()[0][1], |
262 | + 'product_uom' : product_uom, |
263 | + 'procure_method' : res_method.keys()[0] |
264 | + }) |
265 | + for proc in ids: |
266 | + wf_service = netsvc.LocalService("workflow") |
267 | + wf_service.trg_validate(uid, 'procurement.order', proc, 'button_cancel', cr) |
268 | + |
269 | + |
270 | +procurement_order() |
271 | + |
272 | |
273 | === added directory 'procurement_order_merge/wizard' |
274 | === added file 'procurement_order_merge/wizard/__init__.py' |
275 | --- procurement_order_merge/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
276 | +++ procurement_order_merge/wizard/__init__.py 2012-10-12 18:09:18 +0000 |
277 | @@ -0,0 +1,26 @@ |
278 | +# -*- encoding: utf-8 -*- |
279 | +########################################################################### |
280 | +# Module Writen to OpenERP, Open Source Management Solution |
281 | +# |
282 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
283 | +# All Rights Reserved. |
284 | +# info@vauxoo.com |
285 | +############################################################################ |
286 | +# Coded by: julio (julio@vauxoo.com) |
287 | +############################################################################ |
288 | +# |
289 | +# This program is free software: you can redistribute it and/or modify |
290 | +# it under the terms of the GNU Affero General Public License as |
291 | +# published by the Free Software Foundation, either version 3 of the |
292 | +# License, or (at your option) any later version. |
293 | +# |
294 | +# This program is distributed in the hope that it will be useful, |
295 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
296 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
297 | +# GNU Affero General Public License for more details. |
298 | +# |
299 | +# You should have received a copy of the GNU Affero General Public License |
300 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
301 | +# |
302 | +############################################################################## |
303 | +import procurement_order_merge |
304 | |
305 | === added file 'procurement_order_merge/wizard/procurement_order_merge.py' |
306 | --- procurement_order_merge/wizard/procurement_order_merge.py 1970-01-01 00:00:00 +0000 |
307 | +++ procurement_order_merge/wizard/procurement_order_merge.py 2012-10-12 18:09:18 +0000 |
308 | @@ -0,0 +1,67 @@ |
309 | +# -*- encoding: utf-8 -*- |
310 | +########################################################################### |
311 | +# Module Writen to OpenERP, Open Source Management Solution |
312 | +# |
313 | +# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com |
314 | +# All Rights Reserved. |
315 | +# info@vauxoo.com |
316 | +############################################################################ |
317 | +# Coded by: julio (julio@vauxoo.com) |
318 | +############################################################################ |
319 | +# |
320 | +# This program is free software: you can redistribute it and/or modify |
321 | +# it under the terms of the GNU Affero General Public License as |
322 | +# published by the Free Software Foundation, either version 3 of the |
323 | +# License, or (at your option) any later version. |
324 | +# |
325 | +# This program is distributed in the hope that it will be useful, |
326 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
327 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
328 | +# GNU Affero General Public License for more details. |
329 | +# |
330 | +# You should have received a copy of the GNU Affero General Public License |
331 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
332 | +# |
333 | +############################################################################## |
334 | +from osv import osv, fields |
335 | +from tools.translate import _ |
336 | + |
337 | +class procurement_order_merge(osv.osv_memory): |
338 | + _name='procurement.order.merge' |
339 | + |
340 | + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): |
341 | + if context is None: |
342 | + context={} |
343 | + res = super(procurement_order_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) |
344 | + if context.get('active_model','') == 'procurement.order' and len(context['active_ids']) < 2: |
345 | + raise osv.except_osv(_('Warning'), |
346 | + _('Please select multiple order to merge in the list view.')) |
347 | + return res |
348 | + |
349 | + def procurement_merge(self, cr, uid, ids, context=None): |
350 | + procurement_order = self.pool.get('procurement.order') |
351 | + if context is None: |
352 | + context = {} |
353 | + procurement_ids = context.get('active_ids', []) |
354 | + procurement_order.do_merge(cr, uid, procurement_ids, context=context) |
355 | + return {} |
356 | + |
357 | +procurement_order_merge() |
358 | + |
359 | + |
360 | + |
361 | + |
362 | + |
363 | + |
364 | + |
365 | + |
366 | + |
367 | + |
368 | + |
369 | + |
370 | + |
371 | + |
372 | + |
373 | + |
374 | + |
375 | + |
376 | |
377 | === added file 'procurement_order_merge/wizard/procurement_order_merge_view.xml' |
378 | --- procurement_order_merge/wizard/procurement_order_merge_view.xml 1970-01-01 00:00:00 +0000 |
379 | +++ procurement_order_merge/wizard/procurement_order_merge_view.xml 2012-10-12 18:09:18 +0000 |
380 | @@ -0,0 +1,50 @@ |
381 | +<?xml version="1.0" encoding="utf-8"?> |
382 | +<openerp> |
383 | + <data> |
384 | + |
385 | + <record id="procurement_order_merge_form" model="ir.ui.view"> |
386 | + <field name="name">procurement.order.merge.form</field> |
387 | + <field name="model">procurement.order.merge</field> |
388 | + <field name="type">form</field> |
389 | + <field name="arch" type="xml"> |
390 | + <form string="Procurement Merge"> |
391 | + <separator string="Are you sure you want to merge these procurements ?" colspan="4"/> |
392 | + <newline/> |
393 | + <label string=" |
394 | +Please note that: |
395 | +Orders will only be merged if: |
396 | +* Procurments Orders are in draft |
397 | +* Procurments Orders have same location |
398 | +* Procurments Orders have same procurement method |
399 | +* Procurments Orders have same product |
400 | +" colspan="4"/> |
401 | + <newline/> |
402 | + <separator string="" colspan="4" /> |
403 | + <button string="Cancel" icon="gtk-cancel" type="object" special="cancel"/> |
404 | + <button string="Merge Procurement" icon="gtk-ok" name="procurement_merge" type="object"/> |
405 | + |
406 | + </form> |
407 | + </field> |
408 | + </record> |
409 | + |
410 | + <act_window id="procurement_merge_wizard" |
411 | + name="Procurement Merge" |
412 | + src_model="procurement.order" |
413 | + res_model="procurement.order.merge" |
414 | + view_mode="form" |
415 | + target="new" |
416 | + key2="client_action_multi" |
417 | + /> |
418 | + |
419 | + |
420 | + <record id="create_procurement_merge_action" model="ir.actions.act_window"> |
421 | + <field name="name">Procurement Merge</field> |
422 | + <field name="res_model">procurement.order.merge</field> |
423 | + <field name="view_type">form</field> |
424 | + <field name="view_mode">form</field> |
425 | + <field name="target">new</field> |
426 | + </record> |
427 | + |
428 | + </data> |
429 | +</openerp> |
430 | + |
cambie group por merge