Merge lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_sale_order_copy_line_dev_jorge into lp:addons-vauxoo/7.0

Status: Merged
Merged at revision: 1090
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_sale_order_copy_line_dev_jorge
Merge into: lp:addons-vauxoo/7.0
Diff against target: 443 lines (+381/-0)
11 files modified
sale_order_copy_line/__init__.py (+26/-0)
sale_order_copy_line/__openerp__.py (+51/-0)
sale_order_copy_line/demo/sale_order_demo.xml (+75/-0)
sale_order_copy_line/i18n/es.po (+55/-0)
sale_order_copy_line/i18n/es_MX.po (+16/-0)
sale_order_copy_line/i18n/es_VE.po (+16/-0)
sale_order_copy_line/model/__init__.py (+26/-0)
sale_order_copy_line/model/sale_order_line.py (+52/-0)
sale_order_copy_line/security/sale_order_line_copy_group.xml (+11/-0)
sale_order_copy_line/test/sale_order_copy_line_test.yml (+38/-0)
sale_order_copy_line/view/sale_order_line_copy.xml (+15/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0_addons-vauxoo_sale_order_copy_line_dev_jorge
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Nhomar - Vauxoo Pending
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Review via email: mp+227376@code.launchpad.net

Description of the change

Se agrega botón para duplicar la linea de la sale order.

To post a comment you must log in.
Revision history for this message
Jorge Angel Naranjo Rogel - http://www.vauxoo.com (jorge-nr) wrote :

Se agregan test yaml y data demo

1094. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][sale_order_copy_line] Fixed test yaml

1095. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][sale_order_copy_line] Added description to module

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve
1096. By Jorge Angel Naranjo Rogel - http://www.vauxoo.com

[IMP][sale_order_copy_line] Added translation in module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'sale_order_copy_line'
2=== added file 'sale_order_copy_line/__init__.py'
3--- sale_order_copy_line/__init__.py 1970-01-01 00:00:00 +0000
4+++ sale_order_copy_line/__init__.py 2014-07-19 00:18:31 +0000
5@@ -0,0 +1,26 @@
6+# -*- encoding: utf-8 -*-
7+#
8+# Module Writen to OpenERP, Open Source Management Solution
9+#
10+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
11+# All Rights Reserved.
12+# info Vauxoo (info@vauxoo.com)
13+#
14+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@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 model
32
33=== added file 'sale_order_copy_line/__openerp__.py'
34--- sale_order_copy_line/__openerp__.py 1970-01-01 00:00:00 +0000
35+++ sale_order_copy_line/__openerp__.py 2014-07-19 00:18:31 +0000
36@@ -0,0 +1,51 @@
37+# -*- encoding: utf-8 -*-
38+#
39+# Module Writen to OpenERP, Open Source Management Solution
40+#
41+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
42+# All Rights Reserved.
43+# info Vauxoo (info@vauxoo.com)
44+#
45+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@vauxoo.com)
46+#
47+#
48+# This program is free software: you can redistribute it and/or modify
49+# it under the terms of the GNU Affero General Public License as
50+# published by the Free Software Foundation, either version 3 of the
51+# License, or (at your option) any later version.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU Affero General Public License for more details.
57+#
58+# You should have received a copy of the GNU Affero General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+#
61+#
62+
63+{
64+ "name": "Sale Order Line Copy",
65+ "version": "1.0",
66+ "author": "Vauxoo",
67+ "category": "Sale Order",
68+ "description" : """
69+Sale Order Line Copy
70+====================
71+
72+This module add the button in the sale order line for copy data.
73+
74+ """,
75+ "website": "http://www.vauxoo.com/",
76+ "license": "AGPL-3",
77+ "depends": ["base",
78+ "sale",
79+ "sale_stock",],
80+ "demo": ["demo/sale_order_demo.xml"],
81+ "test": ["test/sale_order_copy_line_test.yml"],
82+ "data": [
83+ "security/sale_order_line_copy_group.xml",
84+ "view/sale_order_line_copy.xml"],
85+ "installable": True,
86+ "active": False,
87+}
88
89=== added directory 'sale_order_copy_line/demo'
90=== added file 'sale_order_copy_line/demo/sale_order_demo.xml'
91--- sale_order_copy_line/demo/sale_order_demo.xml 1970-01-01 00:00:00 +0000
92+++ sale_order_copy_line/demo/sale_order_demo.xml 2014-07-19 00:18:31 +0000
93@@ -0,0 +1,75 @@
94+<?xml version="1.0" encoding="utf-8"?>
95+<openerp>
96+ <data noupdate="0">
97+
98+ <record id="sale_order_copy_0" model="sale.order">
99+ <field name="partner_id" ref="base.res_partner_23"/>
100+ <field name="partner_invoice_id" ref="base.res_partner_23"/>
101+ <field name="partner_shipping_id" ref="base.res_partner_23"/>
102+ <field name="user_id" ref="base.user_demo"/>
103+ <field name="pricelist_id" ref="product.list0"/>
104+ </record>
105+
106+ <record id="sale_order_copy_line_1" model="sale.order.line">
107+ <field name="order_id" ref="sale_order_copy_0"/>
108+ <field name="name">Laptop E5023</field>
109+ <field name="product_id" ref="product.product_product_25"/>
110+ <field name="product_uom_qty">3</field>
111+ <field name="product_uos_qty">3</field>
112+ <field name="product_uom" ref="product.product_uom_unit"/>
113+ <field name="price_unit">2950.00</field>
114+ </record>
115+
116+ <record id="sale_order_copy_line_2" model="sale.order.line">
117+ <field name="order_id" ref="sale_order_copy_0"/>
118+ <field name="name">Pen drive, 16GB</field>
119+ <field name="product_id" ref="product.product_product_30"/>
120+ <field name="product_uom_qty">5</field>
121+ <field name="product_uos_qty">5</field>
122+ <field name="product_uom" ref="product.product_uom_unit"/>
123+ <field name="price_unit">145.00</field>
124+ </record>
125+
126+ <record id="sale_order_copy_line_3" model="sale.order.line">
127+ <field name="order_id" ref="sale_order_copy_0"/>
128+ <field name="name">Headset USB</field>
129+ <field name="product_id" ref="product.product_product_33"/>
130+ <field name="product_uom_qty">2</field>
131+ <field name="product_uos_qty">2</field>
132+ <field name="product_uom" ref="product.product_uom_unit"/>
133+ <field name="price_unit">65.00</field>
134+ </record>
135+
136+ <record id="sale_order_copy_1" model="sale.order">
137+ <field name="partner_id" ref="base.res_partner_23"/>
138+ <field name="partner_invoice_id" ref="base.res_partner_address_23"/>
139+ <field name="partner_shipping_id" ref="base.res_partner_address_23"/>
140+ <field name="user_id" ref="base.user_root"/>
141+ <field name="pricelist_id" ref="product.list0"/>
142+ <field name="order_policy">manual</field>
143+ </record>
144+
145+ <record id="sale_order_copy_line_4" model="sale.order.line">
146+ <field name="order_id" ref="sale_order_copy_1"/>
147+ <field name="name">Service on demand</field>
148+ <field name="product_id" ref="product.product_product_consultant"/>
149+ <field name="product_uom_qty">24</field>
150+ <field name="product_uos_qty">24</field>
151+ <field name="product_uom" ref="product.product_uom_hour"/>
152+ <field name="price_unit">75.00</field>
153+ </record>
154+
155+ <record id="sale_order_copy_line_5" model="sale.order.line">
156+ <field name="order_id" ref="sale_order_copy_1"/>
157+ <field name="name">On Site Assistance</field>
158+ <field name="product_id" ref="product.product_product_2"/>
159+ <field name="product_uom_qty">30</field>
160+ <field name="product_uos_qty">30</field>
161+ <field name="product_uom" ref="product.product_uom_hour"/>
162+ <field name="price_unit">38.25</field>
163+ </record>
164+
165+ <!-- Confirm some Sale Orders-->
166+ <workflow action="order_confirm" model="sale.order" ref="sale_order_copy_1"/>
167+ </data>
168+</openerp>
169
170=== added directory 'sale_order_copy_line/i18n'
171=== added file 'sale_order_copy_line/i18n/es.po'
172--- sale_order_copy_line/i18n/es.po 1970-01-01 00:00:00 +0000
173+++ sale_order_copy_line/i18n/es.po 2014-07-19 00:18:31 +0000
174@@ -0,0 +1,55 @@
175+# Translation of OpenERP Server.
176+# This file contains the translation of the following modules:
177+# * sale_order_copy_line
178+#
179+msgid ""
180+msgstr ""
181+"Project-Id-Version: OpenERP Server 7.0\n"
182+"Report-Msgid-Bugs-To: \n"
183+"POT-Creation-Date: 2014-07-18 19:12+0000\n"
184+"PO-Revision-Date: 2014-07-18 19:12+0000\n"
185+"Last-Translator: <>\n"
186+"Language-Team: \n"
187+"MIME-Version: 1.0\n"
188+"Content-Type: text/plain; charset=UTF-8\n"
189+"Content-Transfer-Encoding: \n"
190+"Plural-Forms: \n"
191+
192+#. module: sale_order_copy_line
193+#: view:sale.order:0
194+msgid "Copy this line in sale order"
195+msgstr "Copia esta línea en la orden de venta"
196+
197+#. module: sale_order_copy_line
198+#: model:res.groups,comment:sale_order_copy_line.group_sale_order_line_copy
199+msgid "Show button for copy line in sale order"
200+msgstr "Muestra el boton para copiar la línea de la orden de venta"
201+
202+#. module: sale_order_copy_line
203+#: code:addons/sale_order_copy_line/model/sale_order_line.py:51
204+#, python-format
205+msgid "Error!"
206+msgstr "Error!"
207+
208+#. module: sale_order_copy_line
209+#: model:res.groups,name:sale_order_copy_line.group_sale_order_line_copy
210+msgid "Sale Order Line Copy"
211+msgstr "Sale Order Line Copy"
212+
213+#. module: sale_order_copy_line
214+#: code:addons/sale_order_copy_line/model/sale_order_line.py:51
215+#, python-format
216+msgid "This sale order is not in draft state"
217+msgstr "Esta orden de venta no esta en estado borrador"
218+
219+#. module: sale_order_copy_line
220+#: code:addons/sale_order_copy_line/model/sale_order_line.py:43
221+#, python-format
222+msgid "Sales Order"
223+msgstr "Orden de venta"
224+
225+#. module: sale_order_copy_line
226+#: model:ir.model,name:sale_order_copy_line.model_sale_order_line
227+msgid "Sales Order Line"
228+msgstr "Línea pedido de venta"
229+
230
231=== added file 'sale_order_copy_line/i18n/es_MX.po'
232--- sale_order_copy_line/i18n/es_MX.po 1970-01-01 00:00:00 +0000
233+++ sale_order_copy_line/i18n/es_MX.po 2014-07-19 00:18:31 +0000
234@@ -0,0 +1,16 @@
235+# Translation of OpenERP Server.
236+# This file contains the translation of the following modules:
237+# * sale_order_copy_line
238+#
239+msgid ""
240+msgstr ""
241+"Project-Id-Version: OpenERP Server 7.0\n"
242+"Report-Msgid-Bugs-To: \n"
243+"POT-Creation-Date: 2014-07-18 19:12+0000\n"
244+"PO-Revision-Date: 2014-07-18 19:12+0000\n"
245+"Last-Translator: <>\n"
246+"Language-Team: \n"
247+"MIME-Version: 1.0\n"
248+"Content-Type: text/plain; charset=UTF-8\n"
249+"Content-Transfer-Encoding: \n"
250+"Plural-Forms: \n"
251
252=== added file 'sale_order_copy_line/i18n/es_VE.po'
253--- sale_order_copy_line/i18n/es_VE.po 1970-01-01 00:00:00 +0000
254+++ sale_order_copy_line/i18n/es_VE.po 2014-07-19 00:18:31 +0000
255@@ -0,0 +1,16 @@
256+# Translation of OpenERP Server.
257+# This file contains the translation of the following modules:
258+# * sale_order_copy_line
259+#
260+msgid ""
261+msgstr ""
262+"Project-Id-Version: OpenERP Server 7.0\n"
263+"Report-Msgid-Bugs-To: \n"
264+"POT-Creation-Date: 2014-07-18 19:12+0000\n"
265+"PO-Revision-Date: 2014-07-18 19:12+0000\n"
266+"Last-Translator: <>\n"
267+"Language-Team: \n"
268+"MIME-Version: 1.0\n"
269+"Content-Type: text/plain; charset=UTF-8\n"
270+"Content-Transfer-Encoding: \n"
271+"Plural-Forms: \n"
272
273=== added directory 'sale_order_copy_line/model'
274=== added file 'sale_order_copy_line/model/__init__.py'
275--- sale_order_copy_line/model/__init__.py 1970-01-01 00:00:00 +0000
276+++ sale_order_copy_line/model/__init__.py 2014-07-19 00:18:31 +0000
277@@ -0,0 +1,26 @@
278+# -*- encoding: utf-8 -*-
279+#
280+# Module Writen to OpenERP, Open Source Management Solution
281+#
282+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
283+# All Rights Reserved.
284+# info Vauxoo (info@vauxoo.com)
285+#
286+# Coded by: Jorge Angel Naranjo Rogel (jorge_nr@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 sale_order_line
304
305=== added file 'sale_order_copy_line/model/sale_order_line.py'
306--- sale_order_copy_line/model/sale_order_line.py 1970-01-01 00:00:00 +0000
307+++ sale_order_copy_line/model/sale_order_line.py 2014-07-19 00:18:31 +0000
308@@ -0,0 +1,52 @@
309+##############################################################################
310+#
311+# OpenERP, Open Source Management Solution
312+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
313+#
314+
315+#
316+# This program is free software: you can redistribute it and/or modify
317+# it under the terms of the GNU General Public License as published by
318+# the Free Software Foundation, either version 3 of the License, or
319+# (at your option) any later version.
320+#
321+# This program is distributed in the hope that it will be useful,
322+# but WITHOUT ANY WARRANTY; without even the implied warranty of
323+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
324+# GNU General Public License for more details.
325+#
326+# You should have received a copy of the GNU General Public License
327+# along with this program. If not, see <http://www.gnu.org/licenses/>.
328+#
329+##############################################################################
330+
331+from openerp.osv import fields, osv
332+from openerp.tools.translate import _
333+
334+import time
335+import unicodedata
336+
337+
338+class sale_order_line(osv.Model):
339+
340+ _inherit = 'sale.order.line'
341+
342+ def sale_order_line_copy(self, cr, uid, ids, context=None):
343+ data = self.copy_data(cr,uid,ids[0],context=context)
344+ sale_order_obj = self.pool.get('sale.order')
345+ data_sale_order = sale_order_obj.browse(cr, uid, data.get('order_id'))
346+
347+ if data_sale_order.state == 'draft':
348+ sale_order_id = self.create(cr, uid ,data , context=context)
349+ return {
350+ 'type': 'ir.actions.act_window',
351+ 'name': _('Sales Order'),
352+ 'res_model': 'sale.order',
353+ 'res_id': data.get('order_id'),
354+ 'view_type': 'form',
355+ 'view_mode': 'form',
356+ 'target': 'current',
357+ 'nodestroy': True,}
358+ else:
359+ raise osv.except_osv(_('Error!'), _("This sale order is not in draft state"))
360+
361
362=== added directory 'sale_order_copy_line/security'
363=== added file 'sale_order_copy_line/security/sale_order_line_copy_group.xml'
364--- sale_order_copy_line/security/sale_order_line_copy_group.xml 1970-01-01 00:00:00 +0000
365+++ sale_order_copy_line/security/sale_order_line_copy_group.xml 2014-07-19 00:18:31 +0000
366@@ -0,0 +1,11 @@
367+<?xml version="1.0" encoding="utf-8"?>
368+<openerp>
369+ <data noupdate="1">
370+
371+ <record id="group_sale_order_line_copy" model="res.groups">
372+ <field name="name">Sale Order Line Copy</field>
373+ <field name="comment">Show button for copy line in sale order</field>
374+ </record>
375+
376+ </data>
377+</openerp>
378
379=== added directory 'sale_order_copy_line/test'
380=== added file 'sale_order_copy_line/test/sale_order_copy_line_test.yml'
381--- sale_order_copy_line/test/sale_order_copy_line_test.yml 1970-01-01 00:00:00 +0000
382+++ sale_order_copy_line/test/sale_order_copy_line_test.yml 2014-07-19 00:18:31 +0000
383@@ -0,0 +1,38 @@
384+-
385+ Test yaml for copy line of sale order when state is draft
386+-
387+ Duplicate line
388+-
389+ !python {model: sale.order.line}: |
390+ import logging
391+ from openerp import tools
392+ import traceback
393+ from tools.misc import mute_logger
394+ _logger = logging.getLogger("sale.order.copy.line")
395+
396+ try:
397+ with mute_logger("sale.order.copy.line"):
398+ self.sale_order_line_copy(cr, uid, [ref('sale_order_copy_line.sale_order_copy_line_1')], context=context)
399+ _logger.info("Copy with success")
400+ except Exception, e:
401+ error = tools.ustr( traceback.format_exc() )
402+ _logger.info("This sale order is not in draft state")
403+-
404+ Test yaml for copy line of sale order when state is confirm
405+-
406+ Duplicate line
407+-
408+ !python {model: sale.order.line}: |
409+ import logging
410+ from openerp import tools
411+ import traceback
412+ from tools.misc import mute_logger
413+ _logger = logging.getLogger("sale.order.copy.line")
414+
415+ try:
416+ with mute_logger("sale.order.copy.line"):
417+ self.sale_order_line_copy(cr, uid, [ref('sale_order_copy_line.sale_order_copy_line_4')], context=context)
418+ _logger.info("Copy with success")
419+ except Exception, e:
420+ error = tools.ustr( traceback.format_exc() )
421+ _logger.info("This sale order is not in draft state")
422\ No newline at end of file
423
424=== added directory 'sale_order_copy_line/view'
425=== added file 'sale_order_copy_line/view/sale_order_line_copy.xml'
426--- sale_order_copy_line/view/sale_order_line_copy.xml 1970-01-01 00:00:00 +0000
427+++ sale_order_copy_line/view/sale_order_line_copy.xml 2014-07-19 00:18:31 +0000
428@@ -0,0 +1,15 @@
429+<?xml version="1.0" encoding="utf-8"?>
430+<openerp>
431+ <data>
432+ <record model="ir.ui.view" id="sale_order_line_copy_form_view">
433+ <field name="name">sale.order.copy.line.form</field>
434+ <field name="model">sale.order</field>
435+ <field name="inherit_id" ref="sale.view_order_form"/>
436+ <field name="arch" type="xml">
437+ <xpath expr="//field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='price_subtotal']" position="after">
438+ <button name="sale_order_line_copy" class="oe_edit_only" attrs="{'invisible':[('state','!=','draft')]}" type="object" icon="STOCK_COPY" groups="sale_order_copy_line.group_sale_order_line_copy" help="Copy this line in sale order"/>
439+ </xpath>
440+ </field>
441+ </record>
442+ </data>
443+</openerp>