Merge lp:~dr.dran/domsense-agilebg-addons/adding_product_pack into lp:domsense-agilebg-addons/6.1

Proposed by Franco Tampieri
Status: Superseded
Proposed branch: lp:~dr.dran/domsense-agilebg-addons/adding_product_pack
Merge into: lp:domsense-agilebg-addons/6.1
Diff against target: 1494 lines (+1431/-0)
12 files modified
product_pack/AUTHORS.txt (+3/-0)
product_pack/__init__.py (+23/-0)
product_pack/__openerp__.py (+46/-0)
product_pack/i18n/ca.po (+163/-0)
product_pack/i18n/de.po (+145/-0)
product_pack/i18n/es.po (+164/-0)
product_pack/i18n/it.po (+164/-0)
product_pack/i18n/nan_product_pack.pot (+137/-0)
product_pack/i18n/pt.po (+149/-0)
product_pack/pack.py (+384/-0)
product_pack/pack_view.xml (+50/-0)
product_pack/security/ir.model.access.csv (+3/-0)
To merge this branch: bzr merge lp:~dr.dran/domsense-agilebg-addons/adding_product_pack
Reviewer Review Type Date Requested Status
Lorenzo Battistini Needs Fixing
Review via email: mp+125024@code.launchpad.net

This proposal has been superseded by a proposal from 2012-09-19.

Description of the change

Added the product_pack modules, that will provide the same functionality of the original nan_product_pack to the sale and the purchase orders

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) wrote :

__init__.py has encoding: latin-1 and GPL license instead of AGPL.
In module author I see 'NaN·tic'.

review: Needs Fixing
244. By Franco Tampieri

[Fix] Fixed wrong encoding in __init__.py

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_pack'
2=== added file 'product_pack/AUTHORS.txt'
3--- product_pack/AUTHORS.txt 1970-01-01 00:00:00 +0000
4+++ product_pack/AUTHORS.txt 2012-09-19 06:37:17 +0000
5@@ -0,0 +1,3 @@
6+Albert Cervera i Areny <albert@nan-tic.com>
7+Franco Tampieri <franco.tampieri@agilebg.com>
8+
9
10=== added file 'product_pack/__init__.py'
11--- product_pack/__init__.py 1970-01-01 00:00:00 +0000
12+++ product_pack/__init__.py 2012-09-19 06:37:17 +0000
13@@ -0,0 +1,23 @@
14+# -*- coding: utf-8 -*-
15+##################################################################################
16+#
17+# Copyright (c) 2009 Angel Alvarez - NaN (http://www.nan-tic.com)
18+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
19+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
20+# All Rights Reserved
21+#
22+# This program is free software: you can redistribute it and/or modify
23+# it under the terms of the GNU Affero General Public License as published
24+# by the Free Software Foundation, either version 3 of the License, or
25+# (at your option) any later version.
26+#
27+# This program is distributed in the hope that it will be useful,
28+# but WITHOUT ANY WARRANTY; without even the implied warranty of
29+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+# GNU General Public License for more details.
31+#
32+# You should have received a copy of the GNU Affero General Public License
33+# along with this program. If not, see <http://www.gnu.org/licenses/>.
34+#
35+##################################################################################
36+import pack
37
38=== added file 'product_pack/__openerp__.py'
39--- product_pack/__openerp__.py 1970-01-01 00:00:00 +0000
40+++ product_pack/__openerp__.py 2012-09-19 06:37:17 +0000
41@@ -0,0 +1,46 @@
42+# -*- coding: utf-8 -*-
43+##################################################################################
44+#
45+# Copyright (c) 2009 Angel Alvarez - NaN (http://www.nan-tic.com)
46+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
47+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
48+# All Rights Reserved
49+#
50+# This program is free software: you can redistribute it and/or modify
51+# it under the terms of the GNU Affero General Public License as published
52+# by the Free Software Foundation, either version 3 of the License, or
53+# (at your option) any later version.
54+#
55+# This program is distributed in the hope that it will be useful,
56+# but WITHOUT ANY WARRANTY; without even the implied warranty of
57+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+# GNU General Public License for more details.
59+#
60+# You should have received a copy of the GNU Affero General Public License
61+# along with this program. If not, see <http://www.gnu.org/licenses/>.
62+#
63+##################################################################################
64+{
65+ "name" : "Product Pack",
66+ "version" : "0.2",
67+ "description" : """
68+Based on the NAN_product_pack this module allows configuring products as a collection of other products.
69+If such a product is added in a sale order or a purchase order, all the products of the pack will be added
70+automatically (when storing the order) as children of the pack product.
71+""",
72+ "author" : "Agile Business Group & Domsense & NaN·tic",
73+ "website" : "http://www.agilebg.com",
74+ "depends" : [
75+ 'sale',
76+ 'purchase',
77+ ],
78+ "category" : "Warehouse Management",
79+ "init_xml" : [],
80+ "demo_xml" : [],
81+ "update_xml" : [
82+ 'security/ir.model.access.csv',
83+ 'pack_view.xml'
84+ ],
85+ "active": False,
86+ "installable": True
87+}
88
89=== added directory 'product_pack/i18n'
90=== added file 'product_pack/i18n/ca.po'
91--- product_pack/i18n/ca.po 1970-01-01 00:00:00 +0000
92+++ product_pack/i18n/ca.po 2012-09-19 06:37:17 +0000
93@@ -0,0 +1,163 @@
94+# Translation of OpenERP Server.
95+# This file contains the translation of the following modules:
96+# * nan_product_pack
97+#
98+msgid ""
99+msgstr ""
100+"Project-Id-Version: OpenERP Server 5.0.6\n"
101+"Report-Msgid-Bugs-To: support@openerp.com\n"
102+"POT-Creation-Date: 2011-01-15 11:45+0000\n"
103+"PO-Revision-Date: 2011-02-15 15:15+0000\n"
104+"Last-Translator: Jordi Esteve (Zikzakmedia) <jesteve@zikzakmedia.com>\n"
105+"Language-Team: \n"
106+"MIME-Version: 1.0\n"
107+"Content-Type: text/plain; charset=UTF-8\n"
108+"Content-Transfer-Encoding: 8bit\n"
109+"X-Launchpad-Export-Date: 2012-04-05 04:56+0000\n"
110+"X-Generator: Launchpad (build 15060)\n"
111+
112+#. module: nan_product_pack
113+#: constraint:ir.model:0
114+msgid ""
115+"The Object name must start with x_ and not contain any special character !"
116+msgstr ""
117+"El nom de l'objecte ha de començar amb x_ i no contenir cap caràcter "
118+"especial!"
119+
120+#. module: nan_product_pack
121+#: help:product.product,stock_depends:0
122+msgid "Mark if pack stock is calcualted from component stock"
123+msgstr ""
124+"Marqueu aquest camp si l'estoc del paquet es calcula a partir de l'estoc "
125+"dels components."
126+
127+#. module: nan_product_pack
128+#: field:sale.order.line,pack_child_line_ids:0
129+msgid "Lines in pack"
130+msgstr "Línies en el paquet"
131+
132+#. module: nan_product_pack
133+#: help:sale.order.line,pack_depth:0
134+msgid "Depth of the product if it is part of a pack."
135+msgstr "Profunditat del producte si forma part d'un paquet."
136+
137+#. module: nan_product_pack
138+#: field:product.pack.line,product_id:0
139+msgid "Product"
140+msgstr "Producte"
141+
142+#. module: nan_product_pack
143+#: view:product.pack.line:0
144+msgid "Pack Product Lines"
145+msgstr "Línies del paquet de productes"
146+
147+#. module: nan_product_pack
148+#: view:product.product:0
149+msgid ""
150+"If you add products in the 'Pack Products' field, all those products will be "
151+"added automatically when a new quotation or order is created."
152+msgstr ""
153+"Si afegiu productes en el camp \"Paquet de productes\", tots els productes "
154+"s'afegiran automàticament quan creeu un nou pressupost o comanda."
155+
156+#. module: nan_product_pack
157+#: model:ir.module.module,description:nan_product_pack.module_meta_information
158+msgid ""
159+"\n"
160+"Allows configuring products as a collection of other products. If such a "
161+"product is added in a sale order, all the products of the pack will be added "
162+"automatically (when storing the order) as children of the pack product.\n"
163+"\n"
164+"The module has been made compatible with nan_external_prices and containts "
165+"code to specifically handle when the module is available but they're still "
166+"independent and there are no dependencies between them.\n"
167+" "
168+msgstr ""
169+"\n"
170+"Permet configurar els productes com col·leccions d'altres productes. Si "
171+"s'afegeix un producte d'aquest tipus en una comanda de venda, tots els "
172+"productes del paquet s'afegiran automàticament (quan es guardi la comanda) "
173+"com a fills del producte principal.\n"
174+"\n"
175+"Aquest mòdul és compatible amb nan_external_prices i conté codi per "
176+"funcionar quan està instal·lat encara que ambdós són encara independents i "
177+"no hi ha dependències entre ells.\n"
178+" "
179+
180+#. module: nan_product_pack
181+#: view:product.product:0
182+#: field:sale.order.line,pack_parent_line_id:0
183+msgid "Pack"
184+msgstr "Paquet"
185+
186+#. module: nan_product_pack
187+#: model:ir.model,name:nan_product_pack.model_product_pack_line
188+msgid "product.pack.line"
189+msgstr "producte.paquet.línea"
190+
191+#. module: nan_product_pack
192+#: constraint:ir.ui.view:0
193+msgid "Invalid XML for View Architecture!"
194+msgstr "XML no vàlid per a la definició de la vista!"
195+
196+#. module: nan_product_pack
197+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
198+msgid "Product Pack"
199+msgstr "Paquet de productes"
200+
201+#. module: nan_product_pack
202+#: field:product.product,stock_depends:0
203+msgid "Stock depends of components"
204+msgstr "Estoc depen dels components"
205+
206+#. module: nan_product_pack
207+#: help:sale.order.line,pack_parent_line_id:0
208+msgid "The pack that contains this product."
209+msgstr "El paquet que conté aquest producte."
210+
211+#. module: nan_product_pack
212+#: field:sale.order.line,pack_depth:0
213+msgid "Depth"
214+msgstr "Profunditat"
215+
216+#. module: nan_product_pack
217+#: help:product.product,pack_fixed_price:0
218+msgid ""
219+"Mark this field if the public price of the pack should be fixed. Do not mark "
220+"it if the price should be calculated from the sum of the prices of the "
221+"products in the pack."
222+msgstr ""
223+"Marqueu aquest camp si el preu de venda del paquet ha de ser fix. No ho "
224+"marqueu si el preu s'ha de calcular a partir de la suma dels preus dels "
225+"productes del paquet."
226+
227+#. module: nan_product_pack
228+#: field:product.pack.line,quantity:0
229+msgid "Quantity"
230+msgstr "Quantitat"
231+
232+#. module: nan_product_pack
233+#: view:product.product:0
234+#: field:product.product,pack_line_ids:0
235+msgid "Pack Products"
236+msgstr "Productes del paquet"
237+
238+#. module: nan_product_pack
239+#: field:product.pack.line,parent_product_id:0
240+msgid "Parent Product"
241+msgstr "Producte pare"
242+
243+#. module: nan_product_pack
244+#: field:product.product,pack_fixed_price:0
245+msgid "Pack has fixed price"
246+msgstr "El paquet té un preu fix"
247+
248+#. module: nan_product_pack
249+#: view:product.pack.line:0
250+msgid "Pack Product Line"
251+msgstr "Línia de paquet de productes"
252+
253+#. module: nan_product_pack
254+#: help:product.product,pack_line_ids:0
255+msgid "List of products that are part of this pack."
256+msgstr "Llista de productes que formen part del paquet."
257
258=== added file 'product_pack/i18n/de.po'
259--- product_pack/i18n/de.po 1970-01-01 00:00:00 +0000
260+++ product_pack/i18n/de.po 2012-09-19 06:37:17 +0000
261@@ -0,0 +1,145 @@
262+# German translation for openobject-addons
263+# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
264+# This file is distributed under the same license as the openobject-addons package.
265+# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
266+#
267+msgid ""
268+msgstr ""
269+"Project-Id-Version: openobject-addons\n"
270+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
271+"POT-Creation-Date: 2011-01-15 11:45+0000\n"
272+"PO-Revision-Date: 2011-02-15 15:15+0000\n"
273+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
274+"Language-Team: German <de@li.org>\n"
275+"MIME-Version: 1.0\n"
276+"Content-Type: text/plain; charset=UTF-8\n"
277+"Content-Transfer-Encoding: 8bit\n"
278+"X-Launchpad-Export-Date: 2012-04-05 04:56+0000\n"
279+"X-Generator: Launchpad (build 15060)\n"
280+
281+#. module: nan_product_pack
282+#: constraint:ir.model:0
283+msgid ""
284+"The Object name must start with x_ and not contain any special character !"
285+msgstr ""
286+
287+#. module: nan_product_pack
288+#: help:product.product,stock_depends:0
289+msgid "Mark if pack stock is calcualted from component stock"
290+msgstr ""
291+
292+#. module: nan_product_pack
293+#: field:sale.order.line,pack_child_line_ids:0
294+msgid "Lines in pack"
295+msgstr ""
296+
297+#. module: nan_product_pack
298+#: help:sale.order.line,pack_depth:0
299+msgid "Depth of the product if it is part of a pack."
300+msgstr ""
301+
302+#. module: nan_product_pack
303+#: field:product.pack.line,product_id:0
304+msgid "Product"
305+msgstr ""
306+
307+#. module: nan_product_pack
308+#: view:product.pack.line:0
309+msgid "Pack Product Lines"
310+msgstr ""
311+
312+#. module: nan_product_pack
313+#: view:product.product:0
314+msgid ""
315+"If you add products in the 'Pack Products' field, all those products will be "
316+"added automatically when a new quotation or order is created."
317+msgstr ""
318+
319+#. module: nan_product_pack
320+#: model:ir.module.module,description:nan_product_pack.module_meta_information
321+msgid ""
322+"\n"
323+"Allows configuring products as a collection of other products. If such a "
324+"product is added in a sale order, all the products of the pack will be added "
325+"automatically (when storing the order) as children of the pack product.\n"
326+"\n"
327+"The module has been made compatible with nan_external_prices and containts "
328+"code to specifically handle when the module is available but they're still "
329+"independent and there are no dependencies between them.\n"
330+" "
331+msgstr ""
332+
333+#. module: nan_product_pack
334+#: view:product.product:0
335+#: field:sale.order.line,pack_parent_line_id:0
336+msgid "Pack"
337+msgstr ""
338+
339+#. module: nan_product_pack
340+#: model:ir.model,name:nan_product_pack.model_product_pack_line
341+msgid "product.pack.line"
342+msgstr ""
343+
344+#. module: nan_product_pack
345+#: constraint:ir.ui.view:0
346+msgid "Invalid XML for View Architecture!"
347+msgstr ""
348+
349+#. module: nan_product_pack
350+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
351+msgid "Product Pack"
352+msgstr ""
353+
354+#. module: nan_product_pack
355+#: field:product.product,stock_depends:0
356+msgid "Stock depends of components"
357+msgstr ""
358+
359+#. module: nan_product_pack
360+#: help:sale.order.line,pack_parent_line_id:0
361+msgid "The pack that contains this product."
362+msgstr ""
363+
364+#. module: nan_product_pack
365+#: field:sale.order.line,pack_depth:0
366+msgid "Depth"
367+msgstr ""
368+
369+#. module: nan_product_pack
370+#: help:product.product,pack_fixed_price:0
371+msgid ""
372+"Mark this field if the public price of the pack should be fixed. Do not mark "
373+"it if the price should be calculated from the sum of the prices of the "
374+"products in the pack."
375+msgstr ""
376+
377+#. module: nan_product_pack
378+#: field:product.pack.line,quantity:0
379+msgid "Quantity"
380+msgstr ""
381+
382+#. module: nan_product_pack
383+#: view:product.product:0
384+#: field:product.product,pack_line_ids:0
385+msgid "Pack Products"
386+msgstr ""
387+
388+#. module: nan_product_pack
389+#: field:product.pack.line,parent_product_id:0
390+msgid "Parent Product"
391+msgstr ""
392+
393+#. module: nan_product_pack
394+#: field:product.product,pack_fixed_price:0
395+msgid "Pack has fixed price"
396+msgstr ""
397+
398+#. module: nan_product_pack
399+#: view:product.pack.line:0
400+msgid "Pack Product Line"
401+msgstr ""
402+
403+#. module: nan_product_pack
404+#: help:product.product,pack_line_ids:0
405+msgid "List of products that are part of this pack."
406+msgstr ""
407
408=== added file 'product_pack/i18n/es.po'
409--- product_pack/i18n/es.po 1970-01-01 00:00:00 +0000
410+++ product_pack/i18n/es.po 2012-09-19 06:37:17 +0000
411@@ -0,0 +1,164 @@
412+# Translation of OpenERP Server.
413+# This file contains the translation of the following modules:
414+# * nan_product_pack
415+#
416+# Albert Cervera i Areny <albert@nan-tic.com>, 2009.
417+msgid ""
418+msgstr ""
419+"Project-Id-Version: OpenERP Server 5.0.6\n"
420+"Report-Msgid-Bugs-To: support@openerp.com\n"
421+"POT-Creation-Date: 2011-01-15 11:45+0000\n"
422+"PO-Revision-Date: 2011-02-15 15:15+0000\n"
423+"Last-Translator: Jordi Esteve (Zikzakmedia) <jesteve@zikzakmedia.com>\n"
424+"Language-Team: Catalan <kde-i18n-ca@kde.org>\n"
425+"MIME-Version: 1.0\n"
426+"Content-Type: text/plain; charset=UTF-8\n"
427+"Content-Transfer-Encoding: 8bit\n"
428+"X-Launchpad-Export-Date: 2012-04-05 04:56+0000\n"
429+"X-Generator: Launchpad (build 15060)\n"
430+
431+#. module: nan_product_pack
432+#: constraint:ir.model:0
433+msgid ""
434+"The Object name must start with x_ and not contain any special character !"
435+msgstr ""
436+"¡El nombre del objeto debe empezar con x_ y no contener ningún carácter "
437+"especial!"
438+
439+#. module: nan_product_pack
440+#: help:product.product,stock_depends:0
441+msgid "Mark if pack stock is calcualted from component stock"
442+msgstr ""
443+"Marque este campo si el stock del pack se calcula a partir del stock de los "
444+"componentes."
445+
446+#. module: nan_product_pack
447+#: field:sale.order.line,pack_child_line_ids:0
448+msgid "Lines in pack"
449+msgstr "Líneas en el pack"
450+
451+#. module: nan_product_pack
452+#: help:sale.order.line,pack_depth:0
453+msgid "Depth of the product if it is part of a pack."
454+msgstr "Profundidad del producto si forma parte de un pack."
455+
456+#. module: nan_product_pack
457+#: field:product.pack.line,product_id:0
458+msgid "Product"
459+msgstr "Producto"
460+
461+#. module: nan_product_pack
462+#: view:product.pack.line:0
463+msgid "Pack Product Lines"
464+msgstr "Líneas del pack de productos"
465+
466+#. module: nan_product_pack
467+#: view:product.product:0
468+msgid ""
469+"If you add products in the 'Pack Products' field, all those products will be "
470+"added automatically when a new quotation or order is created."
471+msgstr ""
472+"Si añade productos en el campo \"Pack de productos\", todos los productos se "
473+"añadirán automáticamente cuando cree un nuevo presupuesto o pedido."
474+
475+#. module: nan_product_pack
476+#: model:ir.module.module,description:nan_product_pack.module_meta_information
477+msgid ""
478+"\n"
479+"Allows configuring products as a collection of other products. If such a "
480+"product is added in a sale order, all the products of the pack will be added "
481+"automatically (when storing the order) as children of the pack product.\n"
482+"\n"
483+"The module has been made compatible with nan_external_prices and containts "
484+"code to specifically handle when the module is available but they're still "
485+"independent and there are no dependencies between them.\n"
486+" "
487+msgstr ""
488+"\n"
489+"Permite configurar los productos como colecciones de otros productos. Si se "
490+"añade un producto de este tipo en un pedido de venta, todos los productos "
491+"del pack se añadirán automáticamente (cuando se guarde el pedido) como hijos "
492+"del producto principal.\n"
493+"\n"
494+"Este módulo es compatible con nan_external_prices y contiene código para "
495+"funcionar cuando está instalado aunque ambos son todavía independientes y no "
496+"hay dependencias entre ellos.\n"
497+" "
498+
499+#. module: nan_product_pack
500+#: view:product.product:0
501+#: field:sale.order.line,pack_parent_line_id:0
502+msgid "Pack"
503+msgstr "Pack"
504+
505+#. module: nan_product_pack
506+#: model:ir.model,name:nan_product_pack.model_product_pack_line
507+msgid "product.pack.line"
508+msgstr "producto.pack.línea"
509+
510+#. module: nan_product_pack
511+#: constraint:ir.ui.view:0
512+msgid "Invalid XML for View Architecture!"
513+msgstr "¡XML no válido para la definición de la vista!"
514+
515+#. module: nan_product_pack
516+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
517+msgid "Product Pack"
518+msgstr "Pack de productos"
519+
520+#. module: nan_product_pack
521+#: field:product.product,stock_depends:0
522+msgid "Stock depends of components"
523+msgstr "Stock depende de los componentes"
524+
525+#. module: nan_product_pack
526+#: help:sale.order.line,pack_parent_line_id:0
527+msgid "The pack that contains this product."
528+msgstr "El pack que contiene este producto."
529+
530+#. module: nan_product_pack
531+#: field:sale.order.line,pack_depth:0
532+msgid "Depth"
533+msgstr "Profundidad"
534+
535+#. module: nan_product_pack
536+#: help:product.product,pack_fixed_price:0
537+msgid ""
538+"Mark this field if the public price of the pack should be fixed. Do not mark "
539+"it if the price should be calculated from the sum of the prices of the "
540+"products in the pack."
541+msgstr ""
542+"Marque este campo si el precio de venta del pack tiene que ser fijo. No lo "
543+"marque si el precio se tiene que calcular a partir de la suma de los precios "
544+"de los productos del pack."
545+
546+#. module: nan_product_pack
547+#: field:product.pack.line,quantity:0
548+msgid "Quantity"
549+msgstr "Cantidad"
550+
551+#. module: nan_product_pack
552+#: view:product.product:0
553+#: field:product.product,pack_line_ids:0
554+msgid "Pack Products"
555+msgstr "Productos del pack"
556+
557+#. module: nan_product_pack
558+#: field:product.pack.line,parent_product_id:0
559+msgid "Parent Product"
560+msgstr "Producto padre"
561+
562+#. module: nan_product_pack
563+#: field:product.product,pack_fixed_price:0
564+msgid "Pack has fixed price"
565+msgstr "El pack tiene un precio fijo"
566+
567+#. module: nan_product_pack
568+#: view:product.pack.line:0
569+msgid "Pack Product Line"
570+msgstr "Línea de pack de productos"
571+
572+#. module: nan_product_pack
573+#: help:product.product,pack_line_ids:0
574+msgid "List of products that are part of this pack."
575+msgstr "Lista de productos que forman parte del pack."
576
577=== added file 'product_pack/i18n/it.po'
578--- product_pack/i18n/it.po 1970-01-01 00:00:00 +0000
579+++ product_pack/i18n/it.po 2012-09-19 06:37:17 +0000
580@@ -0,0 +1,164 @@
581+# Italian translation for openobject-addons
582+# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
583+# This file is distributed under the same license as the openobject-addons package.
584+# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
585+#
586+msgid ""
587+msgstr ""
588+"Project-Id-Version: openobject-addons\n"
589+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
590+"POT-Creation-Date: 2011-01-15 11:45+0000\n"
591+"PO-Revision-Date: 2011-05-04 08:52+0000\n"
592+"Last-Translator: Lorenzo Battistini - Agile BG - Domsense "
593+"<lorenzo.battistini@agilebg.com>\n"
594+"Language-Team: Italian <it@li.org>\n"
595+"MIME-Version: 1.0\n"
596+"Content-Type: text/plain; charset=UTF-8\n"
597+"Content-Transfer-Encoding: 8bit\n"
598+"X-Launchpad-Export-Date: 2012-04-05 04:56+0000\n"
599+"X-Generator: Launchpad (build 15060)\n"
600+
601+#. module: nan_product_pack
602+#: constraint:ir.model:0
603+msgid ""
604+"The Object name must start with x_ and not contain any special character !"
605+msgstr ""
606+"Il nome dell'oggetto deve iniziare con x_ e non deve contenere alcun "
607+"carattere speciale !"
608+
609+#. module: nan_product_pack
610+#: help:product.product,stock_depends:0
611+msgid "Mark if pack stock is calcualted from component stock"
612+msgstr ""
613+"Selezionare se la giacenza del kit è calcolata sulla base della giacenza dei "
614+"componenti"
615+
616+#. module: nan_product_pack
617+#: field:sale.order.line,pack_child_line_ids:0
618+msgid "Lines in pack"
619+msgstr "Righe nel kit"
620+
621+#. module: nan_product_pack
622+#: help:sale.order.line,pack_depth:0
623+msgid "Depth of the product if it is part of a pack."
624+msgstr "Profondità del prodotto se è parte di un kit"
625+
626+#. module: nan_product_pack
627+#: field:product.pack.line,product_id:0
628+msgid "Product"
629+msgstr "Prodotto"
630+
631+#. module: nan_product_pack
632+#: view:product.pack.line:0
633+msgid "Pack Product Lines"
634+msgstr "Righe Kit"
635+
636+#. module: nan_product_pack
637+#: view:product.product:0
638+msgid ""
639+"If you add products in the 'Pack Products' field, all those products will be "
640+"added automatically when a new quotation or order is created."
641+msgstr ""
642+"Se si aggiungono prodotti nel campo 'Prodotti Kit', tutti quei prodotti "
643+"saranno automaticamente aggiunti alla creazione di un preventivo o ordine."
644+
645+#. module: nan_product_pack
646+#: model:ir.module.module,description:nan_product_pack.module_meta_information
647+msgid ""
648+"\n"
649+"Allows configuring products as a collection of other products. If such a "
650+"product is added in a sale order, all the products of the pack will be added "
651+"automatically (when storing the order) as children of the pack product.\n"
652+"\n"
653+"The module has been made compatible with nan_external_prices and containts "
654+"code to specifically handle when the module is available but they're still "
655+"independent and there are no dependencies between them.\n"
656+" "
657+msgstr ""
658+"\n"
659+"Permette di configurare prosotti come collezioni di altri prodotti. Se uno "
660+"di questi prodotti viene aggiunto ad un ordine di vendita, tutti i prodotti "
661+"nel kit saranno aggiunti automaticamente (al salvataggio dell'ordine) come "
662+"figli del prodotto kit.\n"
663+"\n"
664+"Il modulo è stato reso compatibile con nan_external_prices e contiene il "
665+"codice per gestire entrambi i moduli pur mantenendoli indipendenti.\n"
666+" "
667+
668+#. module: nan_product_pack
669+#: view:product.product:0
670+#: field:sale.order.line,pack_parent_line_id:0
671+msgid "Pack"
672+msgstr "Kit"
673+
674+#. module: nan_product_pack
675+#: model:ir.model,name:nan_product_pack.model_product_pack_line
676+msgid "product.pack.line"
677+msgstr "product.pack.line"
678+
679+#. module: nan_product_pack
680+#: constraint:ir.ui.view:0
681+msgid "Invalid XML for View Architecture!"
682+msgstr "XML non valido per l'architettura della vista"
683+
684+#. module: nan_product_pack
685+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
686+msgid "Product Pack"
687+msgstr "Kit prodotto"
688+
689+#. module: nan_product_pack
690+#: field:product.product,stock_depends:0
691+msgid "Stock depends of components"
692+msgstr "La giacenza si basa sui componenti"
693+
694+#. module: nan_product_pack
695+#: help:sale.order.line,pack_parent_line_id:0
696+msgid "The pack that contains this product."
697+msgstr "Il kit che contiene questo prodotto."
698+
699+#. module: nan_product_pack
700+#: field:sale.order.line,pack_depth:0
701+msgid "Depth"
702+msgstr "Profondità"
703+
704+#. module: nan_product_pack
705+#: help:product.product,pack_fixed_price:0
706+msgid ""
707+"Mark this field if the public price of the pack should be fixed. Do not mark "
708+"it if the price should be calculated from the sum of the prices of the "
709+"products in the pack."
710+msgstr ""
711+"Selezionare questo campo se il prezzo pubblico del kit debba essere fisso. "
712+"Non selezionarlo se il prezzo debba essere calcolato sulla base dei prezzi "
713+"dei prodotti nel kit."
714+
715+#. module: nan_product_pack
716+#: field:product.pack.line,quantity:0
717+msgid "Quantity"
718+msgstr "Quantità"
719+
720+#. module: nan_product_pack
721+#: view:product.product:0
722+#: field:product.product,pack_line_ids:0
723+msgid "Pack Products"
724+msgstr "Prodotti kit"
725+
726+#. module: nan_product_pack
727+#: field:product.pack.line,parent_product_id:0
728+msgid "Parent Product"
729+msgstr "Prodotto genitore"
730+
731+#. module: nan_product_pack
732+#: field:product.product,pack_fixed_price:0
733+msgid "Pack has fixed price"
734+msgstr "Il kit ha prezzo fisso"
735+
736+#. module: nan_product_pack
737+#: view:product.pack.line:0
738+msgid "Pack Product Line"
739+msgstr "Riga prodotto kit"
740+
741+#. module: nan_product_pack
742+#: help:product.product,pack_line_ids:0
743+msgid "List of products that are part of this pack."
744+msgstr "Lista dei prodotti che sono parte di questo kit."
745
746=== added file 'product_pack/i18n/nan_product_pack.pot'
747--- product_pack/i18n/nan_product_pack.pot 1970-01-01 00:00:00 +0000
748+++ product_pack/i18n/nan_product_pack.pot 2012-09-19 06:37:17 +0000
749@@ -0,0 +1,137 @@
750+# Translation of OpenERP Server.
751+# This file contains the translation of the following modules:
752+# * nan_product_pack
753+#
754+msgid ""
755+msgstr ""
756+"Project-Id-Version: OpenERP Server 5.0.15\n"
757+"Report-Msgid-Bugs-To: support@openerp.com\n"
758+"POT-Creation-Date: 2011-01-15 11:45:01+0000\n"
759+"PO-Revision-Date: 2011-01-15 11:45:01+0000\n"
760+"Last-Translator: <>\n"
761+"Language-Team: \n"
762+"MIME-Version: 1.0\n"
763+"Content-Type: text/plain; charset=UTF-8\n"
764+"Content-Transfer-Encoding: \n"
765+"Plural-Forms: \n"
766+
767+#. module: nan_product_pack
768+#: constraint:ir.model:0
769+msgid "The Object name must start with x_ and not contain any special character !"
770+msgstr "The Object name must start with x_ and not contain any special character !"
771+
772+#. module: nan_product_pack
773+#: help:product.product,stock_depends:0
774+msgid "Mark if pack stock is calcualted from component stock"
775+msgstr "Mark if pack stock is calcualted from component stock"
776+
777+#. module: nan_product_pack
778+#: field:sale.order.line,pack_child_line_ids:0
779+msgid "Lines in pack"
780+msgstr "Lines in pack"
781+
782+#. module: nan_product_pack
783+#: help:sale.order.line,pack_depth:0
784+msgid "Depth of the product if it is part of a pack."
785+msgstr "Depth of the product if it is part of a pack."
786+
787+#. module: nan_product_pack
788+#: field:product.pack.line,product_id:0
789+msgid "Product"
790+msgstr "Product"
791+
792+#. module: nan_product_pack
793+#: view:product.pack.line:0
794+msgid "Pack Product Lines"
795+msgstr "Pack Product Lines"
796+
797+#. module: nan_product_pack
798+#: view:product.product:0
799+msgid "If you add products in the 'Pack Products' field, all those products will be added automatically when a new quotation or order is created."
800+msgstr "If you add products in the 'Pack Products' field, all those products will be added automatically when a new quotation or order is created."
801+
802+#. module: nan_product_pack
803+#: model:ir.module.module,description:nan_product_pack.module_meta_information
804+msgid "\n"
805+"Allows configuring products as a collection of other products. If such a product is added in a sale order, all the products of the pack will be added automatically (when storing the order) as children of the pack product.\n"
806+"\n"
807+"The module has been made compatible with nan_external_prices and containts code to specifically handle when the module is available but they're still independent and there are no dependencies between them.\n"
808+" "
809+msgstr "\n"
810+"Allows configuring products as a collection of other products. If such a product is added in a sale order, all the products of the pack will be added automatically (when storing the order) as children of the pack product.\n"
811+"\n"
812+"The module has been made compatible with nan_external_prices and containts code to specifically handle when the module is available but they're still independent and there are no dependencies between them.\n"
813+" "
814+
815+#. module: nan_product_pack
816+#: view:product.product:0
817+#: field:sale.order.line,pack_parent_line_id:0
818+msgid "Pack"
819+msgstr "Pack"
820+
821+#. module: nan_product_pack
822+#: model:ir.model,name:nan_product_pack.model_product_pack_line
823+msgid "product.pack.line"
824+msgstr "product.pack.line"
825+
826+#. module: nan_product_pack
827+#: constraint:ir.ui.view:0
828+msgid "Invalid XML for View Architecture!"
829+msgstr "Invalid XML for View Architecture!"
830+
831+#. module: nan_product_pack
832+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
833+msgid "Product Pack"
834+msgstr "Product Pack"
835+
836+#. module: nan_product_pack
837+#: field:product.product,stock_depends:0
838+msgid "Stock depends of components"
839+msgstr "Stock depends of components"
840+
841+#. module: nan_product_pack
842+#: help:sale.order.line,pack_parent_line_id:0
843+msgid "The pack that contains this product."
844+msgstr "The pack that contains this product."
845+
846+#. module: nan_product_pack
847+#: field:sale.order.line,pack_depth:0
848+msgid "Depth"
849+msgstr "Depth"
850+
851+#. module: nan_product_pack
852+#: help:product.product,pack_fixed_price:0
853+msgid "Mark this field if the public price of the pack should be fixed. Do not mark it if the price should be calculated from the sum of the prices of the products in the pack."
854+msgstr "Mark this field if the public price of the pack should be fixed. Do not mark it if the price should be calculated from the sum of the prices of the products in the pack."
855+
856+#. module: nan_product_pack
857+#: field:product.pack.line,quantity:0
858+msgid "Quantity"
859+msgstr "Quantity"
860+
861+#. module: nan_product_pack
862+#: view:product.product:0
863+#: field:product.product,pack_line_ids:0
864+msgid "Pack Products"
865+msgstr "Pack Products"
866+
867+#. module: nan_product_pack
868+#: field:product.pack.line,parent_product_id:0
869+msgid "Parent Product"
870+msgstr "Parent Product"
871+
872+#. module: nan_product_pack
873+#: field:product.product,pack_fixed_price:0
874+msgid "Pack has fixed price"
875+msgstr "Pack has fixed price"
876+
877+#. module: nan_product_pack
878+#: view:product.pack.line:0
879+msgid "Pack Product Line"
880+msgstr "Pack Product Line"
881+
882+#. module: nan_product_pack
883+#: help:product.product,pack_line_ids:0
884+msgid "List of products that are part of this pack."
885+msgstr "List of products that are part of this pack."
886+
887
888=== added file 'product_pack/i18n/pt.po'
889--- product_pack/i18n/pt.po 1970-01-01 00:00:00 +0000
890+++ product_pack/i18n/pt.po 2012-09-19 06:37:17 +0000
891@@ -0,0 +1,149 @@
892+# Portuguese translation for openobject-addons
893+# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
894+# This file is distributed under the same license as the openobject-addons package.
895+# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
896+#
897+msgid ""
898+msgstr ""
899+"Project-Id-Version: openobject-addons\n"
900+"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
901+"POT-Creation-Date: 2011-01-15 11:45+0000\n"
902+"PO-Revision-Date: 2011-02-15 15:15+0000\n"
903+"Last-Translator: Luniz <luniz52@hotmail.com>\n"
904+"Language-Team: Portuguese <pt@li.org>\n"
905+"MIME-Version: 1.0\n"
906+"Content-Type: text/plain; charset=UTF-8\n"
907+"Content-Transfer-Encoding: 8bit\n"
908+"X-Launchpad-Export-Date: 2012-04-05 04:56+0000\n"
909+"X-Generator: Launchpad (build 15060)\n"
910+
911+#. module: nan_product_pack
912+#: constraint:ir.model:0
913+msgid ""
914+"The Object name must start with x_ and not contain any special character !"
915+msgstr ""
916+"O nome do Objecto deve começar com x_ e não pode conter nenhum caracter "
917+"especial !"
918+
919+#. module: nan_product_pack
920+#: help:product.product,stock_depends:0
921+msgid "Mark if pack stock is calcualted from component stock"
922+msgstr ""
923+
924+#. module: nan_product_pack
925+#: field:sale.order.line,pack_child_line_ids:0
926+msgid "Lines in pack"
927+msgstr "Linhas em embalagens"
928+
929+#. module: nan_product_pack
930+#: help:sale.order.line,pack_depth:0
931+msgid "Depth of the product if it is part of a pack."
932+msgstr "Profundidade do produto se ele faz parte da embalagem."
933+
934+#. module: nan_product_pack
935+#: field:product.pack.line,product_id:0
936+msgid "Product"
937+msgstr "Produto"
938+
939+#. module: nan_product_pack
940+#: view:product.pack.line:0
941+msgid "Pack Product Lines"
942+msgstr "Linhas de Embalagem de Produto"
943+
944+#. module: nan_product_pack
945+#: view:product.product:0
946+msgid ""
947+"If you add products in the 'Pack Products' field, all those products will be "
948+"added automatically when a new quotation or order is created."
949+msgstr ""
950+"Se adicionar o produto no campo \"Embalagem de Produtos ', todos os produtos "
951+"serão adicionados automaticamente quando uma nova ordem de cotação é criado."
952+
953+#. module: nan_product_pack
954+#: model:ir.module.module,description:nan_product_pack.module_meta_information
955+msgid ""
956+"\n"
957+"Allows configuring products as a collection of other products. If such a "
958+"product is added in a sale order, all the products of the pack will be added "
959+"automatically (when storing the order) as children of the pack product.\n"
960+"\n"
961+"The module has been made compatible with nan_external_prices and containts "
962+"code to specifically handle when the module is available but they're still "
963+"independent and there are no dependencies between them.\n"
964+" "
965+msgstr ""
966+
967+#. module: nan_product_pack
968+#: view:product.product:0
969+#: field:sale.order.line,pack_parent_line_id:0
970+msgid "Pack"
971+msgstr "Embalagem"
972+
973+#. module: nan_product_pack
974+#: model:ir.model,name:nan_product_pack.model_product_pack_line
975+msgid "product.pack.line"
976+msgstr "product.pack.line"
977+
978+#. module: nan_product_pack
979+#: constraint:ir.ui.view:0
980+msgid "Invalid XML for View Architecture!"
981+msgstr "XML Inválido para a Aquitectura de Vista!"
982+
983+#. module: nan_product_pack
984+#: model:ir.module.module,shortdesc:nan_product_pack.module_meta_information
985+msgid "Product Pack"
986+msgstr "Embalagem de Produto"
987+
988+#. module: nan_product_pack
989+#: field:product.product,stock_depends:0
990+msgid "Stock depends of components"
991+msgstr ""
992+
993+#. module: nan_product_pack
994+#: help:sale.order.line,pack_parent_line_id:0
995+msgid "The pack that contains this product."
996+msgstr "A embalagem que contém esse produto."
997+
998+#. module: nan_product_pack
999+#: field:sale.order.line,pack_depth:0
1000+msgid "Depth"
1001+msgstr "Profundidade"
1002+
1003+#. module: nan_product_pack
1004+#: help:product.product,pack_fixed_price:0
1005+msgid ""
1006+"Mark this field if the public price of the pack should be fixed. Do not mark "
1007+"it if the price should be calculated from the sum of the prices of the "
1008+"products in the pack."
1009+msgstr ""
1010+
1011+#. module: nan_product_pack
1012+#: field:product.pack.line,quantity:0
1013+msgid "Quantity"
1014+msgstr "Quantidade"
1015+
1016+#. module: nan_product_pack
1017+#: view:product.product:0
1018+#: field:product.product,pack_line_ids:0
1019+msgid "Pack Products"
1020+msgstr "Embalagem de Produtos"
1021+
1022+#. module: nan_product_pack
1023+#: field:product.pack.line,parent_product_id:0
1024+msgid "Parent Product"
1025+msgstr "Produto Ascendente"
1026+
1027+#. module: nan_product_pack
1028+#: field:product.product,pack_fixed_price:0
1029+msgid "Pack has fixed price"
1030+msgstr "A Embalagem tem preço fixado"
1031+
1032+#. module: nan_product_pack
1033+#: view:product.pack.line:0
1034+msgid "Pack Product Line"
1035+msgstr "Linha de Embalagem de Produto"
1036+
1037+#. module: nan_product_pack
1038+#: help:product.product,pack_line_ids:0
1039+msgid "List of products that are part of this pack."
1040+msgstr "Lista dos produtos que fazem parte desta embalagem."
1041
1042=== added file 'product_pack/pack.py'
1043--- product_pack/pack.py 1970-01-01 00:00:00 +0000
1044+++ product_pack/pack.py 2012-09-19 06:37:17 +0000
1045@@ -0,0 +1,384 @@
1046+# -*- coding: utf-8 -*-
1047+##################################################################################
1048+#
1049+# Copyright (c) 2009 Angel Alvarez - NaN (http://www.nan-tic.com)
1050+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
1051+# Copyright (C) 2012 Domsense srl (<http://www.domsense.com>)
1052+# All Rights Reserved
1053+#
1054+# This program is free software: you can redistribute it and/or modify
1055+# it under the terms of the GNU Affero General Public License as published
1056+# by the Free Software Foundation, either version 3 of the License, or
1057+# (at your option) any later version.
1058+#
1059+# This program is distributed in the hope that it will be useful,
1060+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1061+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1062+# GNU General Public License for more details.
1063+#
1064+# You should have received a copy of the GNU Affero General Public License
1065+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1066+#
1067+##################################################################################
1068+
1069+import math
1070+from osv import fields,osv
1071+
1072+class product_pack( osv.osv ):
1073+ _name = 'product.pack.line'
1074+ _rec_name = 'product_id'
1075+ _columns = {
1076+ 'parent_product_id': fields.many2one( 'product.product', 'Parent Product', ondelete='cascade', required=True ),
1077+ 'quantity': fields.float( 'Quantity', required=True ),
1078+ 'product_id': fields.many2one( 'product.product', 'Product', required=True ),
1079+ }
1080+
1081+class product_product( osv.osv ):
1082+ _inherit = 'product.product'
1083+ _columns = {
1084+ 'stock_depends': fields.boolean( 'Stock depends of components', help='Mark if pack stock is calcualted from component stock' ),
1085+ 'pack_fixed_price': fields.boolean( 'Pack has fixed price', help='Mark this field if the public price of the pack should be fixed. Do not mark it if the price should be calculated from the sum of the prices of the products in the pack.' ),
1086+ 'pack_line_ids': fields.one2many( 'product.pack.line','parent_product_id', 'Pack Products', help='List of products that are part of this pack.' ),
1087+ }
1088+
1089+ def get_product_available( self, cr, uid, ids, context=None ):
1090+ """ Calulate stock for packs, return maximum stock that lets complete pack """
1091+ result={}
1092+ for product in self.browse( cr, uid, ids, context=context ):
1093+ stock = super( product_product, self ).get_product_available( cr, uid, [ product.id ], context=context )
1094+
1095+ # Check if product stock depends on it's subproducts stock.
1096+ if not product.stock_depends:
1097+ result[ product.id ] = stock[ product.id ]
1098+ continue
1099+
1100+ first_subproduct = True
1101+ pack_stock = 0
1102+
1103+ # Check if the pack has subproducts
1104+ if product.pack_line_ids:
1105+
1106+ # Take the stock/virtual stock of all subproducts
1107+ subproducts_stock = self.get_product_available( cr, uid, [ line.product_id.id for line in product.pack_line_ids ], context=context )
1108+
1109+ # Go over all subproducts, take quantity needed for the pack and its available stock
1110+ for subproduct in product.pack_line_ids:
1111+
1112+ # if subproduct is a service don't calculate the stock
1113+ if subproduct.product_id.type == 'service':
1114+ continue
1115+ if first_subproduct:
1116+ subproduct_quantity = subproduct.quantity
1117+ subproduct_stock = subproducts_stock[ subproduct.product_id.id ]
1118+ if subproduct_quantity == 0:
1119+ continue
1120+
1121+ # Calculate real stock for current pack from the subproduct stock and needed quantity
1122+ pack_stock = math.floor( subproduct_stock / subproduct_quantity )
1123+ first_subproduct = False
1124+ continue
1125+
1126+ # Take the info of the next subproduct
1127+ subproduct_quantity_next = subproduct.quantity
1128+ subproduct_stock_next = subproducts_stock[ subproduct.product_id.id ]
1129+ if subproduct_quantity_next == 0 or subproduct_quantity_next == 0.0:
1130+ continue
1131+ pack_stock_next = math.floor( subproduct_stock_next / subproduct_quantity_next )
1132+
1133+ # compare the stock of a subproduct and the next subproduct
1134+ if pack_stock_next < pack_stock:
1135+ pack_stock = pack_stock_next
1136+
1137+ # result is the minimum stock of all subproducts
1138+ result[ product.id ] = pack_stock
1139+ else:
1140+ result[ product.id ] = stock[ product.id ]
1141+ return result
1142+
1143+class sale_order_line(osv.osv):
1144+ _inherit = 'sale.order.line'
1145+ _columns = {
1146+ 'pack_depth': fields.integer('Depth', required=True, help='Depth of the product if it is part of a pack.'),
1147+ 'pack_parent_line_id': fields.many2one('sale.order.line', 'Pack', help='The pack that contains this product.'),
1148+ 'pack_child_line_ids': fields.one2many('sale.order.line', 'pack_parent_line_id', 'Lines in pack', help=''),
1149+ }
1150+ _defaults = {
1151+ 'pack_depth': lambda *a: 0,
1152+ }
1153+
1154+class sale_order(osv.osv):
1155+ _inherit = 'sale.order'
1156+
1157+ def create(self, cr, uid, vals, context=None):
1158+ result = super(sale_order,self).create(cr, uid, vals, context)
1159+ self.expand_packs(cr, uid, [result], context)
1160+ return result
1161+
1162+ def write(self, cr, uid, ids, vals, context=None):
1163+ result = super(sale_order,self).write(cr, uid, ids, vals, context)
1164+ self.expand_packs(cr, uid, ids, context)
1165+ return result
1166+
1167+ def expand_packs(self, cr, uid, ids, context={}, depth=1):
1168+ if type(ids) in [int, long]:
1169+ ids = [ids]
1170+ if depth == 10:
1171+ return
1172+ updated_orders = []
1173+ for order in self.browse(cr, uid, ids, context):
1174+
1175+ fiscal_position = order.fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, order.fiscal_position.id, context) or False
1176+
1177+ # The reorder variable is used to ensure lines of the same pack go right after their parent.
1178+ # What the algorithm does is check if the previous item had children. As children items
1179+ # must go right after the parent if the line we're evaluating doesn't have a parent it
1180+ # means it's a new item (and probably has the default 10 sequence number - unless the
1181+ # appropiate c2c_sale_sequence module is installed). In this case we mark the item for
1182+ # reordering and evaluate the next one. Note that as the item is not evaluated and it might
1183+ # have to be expanded it's put on the queue for another iteration (it's simple and works well).
1184+ # Once the next item has been evaluated the sequence of the item marked for reordering is updated
1185+ # with the next value.
1186+ sequence = -1
1187+ reorder = []
1188+ last_had_children = False
1189+ for line in order.order_line:
1190+ if last_had_children and not line.pack_parent_line_id:
1191+ reorder.append( line.id )
1192+ if line.product_id.pack_line_ids and not order.id in updated_orders:
1193+ updated_orders.append( order.id )
1194+ continue
1195+
1196+ sequence += 1
1197+
1198+ if sequence > line.sequence:
1199+ self.pool.get('sale.order.line').write(cr, uid, [line.id], {
1200+ 'sequence': sequence,
1201+ }, context)
1202+ else:
1203+ sequence = line.sequence
1204+
1205+ if line.state != 'draft':
1206+ continue
1207+ if not line.product_id:
1208+ continue
1209+
1210+ # If pack was already expanded (in another create/write operation or in
1211+ # a previous iteration) don't do it again.
1212+ if line.pack_child_line_ids:
1213+ last_had_children = True
1214+ continue
1215+ last_had_children = False
1216+
1217+ for subline in line.product_id.pack_line_ids:
1218+ sequence += 1
1219+
1220+ subproduct = subline.product_id
1221+ quantity = subline.quantity * line.product_uom_qty
1222+
1223+ if line.product_id.pack_fixed_price:
1224+ price = 0.0
1225+ discount = 0.0
1226+ else:
1227+ pricelist = order.pricelist_id.id
1228+ price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
1229+ subproduct.id, quantity, order.partner_id.id, {
1230+ 'uom': subproduct.uom_id.id,
1231+ 'date': order.date_order,
1232+ })[pricelist]
1233+ discount = line.discount
1234+
1235+ # Obtain product name in partner's language
1236+ ctx = {'lang': order.partner_id.lang}
1237+ subproduct_name = self.pool.get('product.product').browse(cr, uid, subproduct.id, ctx).name
1238+
1239+ tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fiscal_position, subproduct.taxes_id)
1240+
1241+ if subproduct.uos_id:
1242+ uos_id = subproduct.uos_id.id
1243+ uos_qty = quantity * subproduct.uos_coeff
1244+ else:
1245+ uos_id = False
1246+ uos_qty = quantity
1247+
1248+ vals = {
1249+ 'order_id': order.id,
1250+ 'name': '%s%s' % ('> '* (line.pack_depth+1), subproduct_name),
1251+ 'sequence': sequence,
1252+ 'delay': subproduct.sale_delay or 0.0,
1253+ 'product_id': subproduct.id,
1254+ 'procurement_id': line.procurement_id and line.procurement_id.id or False,
1255+ 'price_unit': price,
1256+ 'tax_id': [(6,0,tax_ids)],
1257+ 'type': subproduct.procure_method,
1258+ 'property_ids': [(6,0,[])],
1259+ 'address_allotment_id': False,
1260+ 'product_uom_qty': quantity,
1261+ 'product_uom': subproduct.uom_id.id,
1262+ 'product_uos_qty': uos_qty,
1263+ 'product_uos': uos_id,
1264+ 'product_packaging': False,
1265+ 'move_ids': [(6,0,[])],
1266+ 'discount': discount,
1267+ 'number_packages': False,
1268+ 'notes': False,
1269+ 'th_weight': False,
1270+ 'state': 'draft',
1271+ 'pack_parent_line_id': line.id,
1272+ 'pack_depth': line.pack_depth + 1,
1273+ }
1274+
1275+ # It's a control for the case that the nan_external_prices was installed with the product pack
1276+ if 'prices_used' in line:
1277+ vals[ 'prices_used' ] = line.prices_used
1278+
1279+ self.pool.get('sale.order.line').create(cr, uid, vals, context)
1280+ if not order.id in updated_orders:
1281+ updated_orders.append( order.id )
1282+
1283+ for id in reorder:
1284+ sequence += 1
1285+ self.pool.get('sale.order.line').write(cr, uid, [id], {
1286+ 'sequence': sequence,
1287+ }, context)
1288+
1289+ if updated_orders:
1290+
1291+ # Try to expand again all those orders that had a pack in this iteration.
1292+ # This way we support packs inside other packs.
1293+ self.expand_packs(cr, uid, ids, context, depth+1)
1294+ return
1295+
1296+class purchase_order_line(osv.osv):
1297+ _inherit = 'purchase.order.line'
1298+ _columns = {
1299+ 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of purchase order lines."),
1300+ 'pack_depth': fields.integer('Depth', required=True, help='Depth of the product if it is part of a pack.'),
1301+ 'pack_parent_line_id': fields.many2one('purchase.order.line', 'Pack', help='The pack that contains this product.'),
1302+ 'pack_child_line_ids': fields.one2many('purchase.order.line', 'pack_parent_line_id', 'Lines in pack', help=''),
1303+ }
1304+ _defaults = {
1305+ 'pack_depth': lambda *a: 0,
1306+ }
1307+
1308+class purchase_order(osv.osv):
1309+ _inherit = 'purchase.order'
1310+
1311+ def create(self, cr, uid, vals, context=None):
1312+ result = super(purchase_order,self).create(cr, uid, vals, context)
1313+ self.expand_packs(cr, uid, [result], context)
1314+ return result
1315+
1316+ def write(self, cr, uid, ids, vals, context=None):
1317+ result = super(purchase_order,self).write(cr, uid, ids, vals, context)
1318+ self.expand_packs(cr, uid, ids, context)
1319+ return result
1320+
1321+ def expand_packs(self, cr, uid, ids, context={}, depth=1):
1322+ if type(ids) in [int, long]:
1323+ ids = [ids]
1324+ if depth == 10:
1325+ return
1326+ updated_orders = []
1327+ for order in self.browse(cr, uid, ids, context):
1328+
1329+ fiscal_position = order.fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, order.fiscal_position.id, context) or False
1330+
1331+ # The reorder variable is used to ensure lines of the same pack go right after their parent.
1332+ # What the algorithm does is check if the previous item had children. As children items
1333+ # must go right after the parent if the line we're evaluating doesn't have a parent it
1334+ # means it's a new item (and probably has the default 10 sequence number - unless the
1335+ # appropiate c2c_sale_sequence module is installed). In this case we mark the item for
1336+ # reordering and evaluate the next one. Note that as the item is not evaluated and it might
1337+ # have to be expanded it's put on the queue for another iteration (it's simple and works well).
1338+ # Once the next item has been evaluated the sequence of the item marked for reordering is updated
1339+ # with the next value.
1340+ sequence = -1
1341+ reorder = []
1342+ last_had_children = False
1343+ for line in order.order_line:
1344+ if last_had_children and not line.pack_parent_line_id:
1345+ reorder.append( line.id )
1346+ if line.product_id.pack_line_ids and not order.id in updated_orders:
1347+ updated_orders.append( order.id )
1348+ continue
1349+
1350+ sequence += 1
1351+
1352+ if sequence > line.sequence:
1353+ self.pool.get('purchase.order.line').write(cr, uid, [line.id], {
1354+ 'sequence': sequence,
1355+ }, context)
1356+ else:
1357+ sequence = line.sequence
1358+
1359+ if line.state != 'draft':
1360+ continue
1361+ if not line.product_id:
1362+ continue
1363+
1364+ # If pack was already expanded (in another create/write operation or in
1365+ # a previous iteration) don't do it again.
1366+ if line.pack_child_line_ids:
1367+ last_had_children = True
1368+ continue
1369+ last_had_children = False
1370+
1371+ for subline in line.product_id.pack_line_ids:
1372+ sequence += 1
1373+
1374+ subproduct = subline.product_id
1375+ quantity = subline.quantity * line.product_qty
1376+
1377+ if line.product_id.pack_fixed_price:
1378+ price = 0.0
1379+ else:
1380+ pricelist = order.pricelist_id.id
1381+ price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
1382+ subproduct.id, quantity, order.partner_id.id, {
1383+ 'uom': subproduct.uom_id.id,
1384+ 'date': order.date_order,
1385+ })[pricelist]
1386+
1387+ # Obtain product name in partner's language
1388+ ctx = {'lang': order.partner_id.lang}
1389+ subproduct_name = self.pool.get('product.product').browse(cr, uid, subproduct.id, ctx).name
1390+
1391+ tax_ids = self.pool.get('account.fiscal.position').map_tax(cr, uid, fiscal_position, subproduct.taxes_id)
1392+
1393+ vals = {
1394+ 'order_id': order.id,
1395+ 'name': '%s%s' % ('> '* (line.pack_depth+1), subproduct_name),
1396+ 'date_planned': line.date_planned or 0.0,
1397+ 'sequence': sequence,
1398+ 'product_id': subproduct.id,
1399+ 'price_unit': price,
1400+ 'taxes_id': [(6,0,tax_ids)],
1401+ 'product_qty': quantity,
1402+ 'product_uom': subproduct.uom_id.id,
1403+ 'move_ids': [(6,0,[])],
1404+ 'notes': False,
1405+ 'state': 'draft',
1406+ 'pack_parent_line_id': line.id,
1407+ 'pack_depth': line.pack_depth + 1,
1408+ }
1409+
1410+ # It's a control for the case that the nan_external_prices was installed with the product pack
1411+ if 'prices_used' in line:
1412+ vals[ 'prices_used' ] = line.prices_used
1413+
1414+ self.pool.get('purchase.order.line').create(cr, uid, vals, context)
1415+ if not order.id in updated_orders:
1416+ updated_orders.append( order.id )
1417+
1418+ for id in reorder:
1419+ sequence += 1
1420+ self.pool.get('purchase.order.line').write(cr, uid, [id], {
1421+ 'sequence': sequence,
1422+ }, context)
1423+
1424+ if updated_orders:
1425+
1426+ # Try to expand again all those orders that had a pack in this iteration.
1427+ # This way we support packs inside other packs.
1428+ self.expand_packs(cr, uid, ids, context, depth+1)
1429+ return
1430\ No newline at end of file
1431
1432=== added file 'product_pack/pack_view.xml'
1433--- product_pack/pack_view.xml 1970-01-01 00:00:00 +0000
1434+++ product_pack/pack_view.xml 2012-09-19 06:37:17 +0000
1435@@ -0,0 +1,50 @@
1436+<?xml version="1.0" encoding="utf-8"?>
1437+<openerp>
1438+<data>
1439+
1440+ <!-- Product view modification -->
1441+ <record model="ir.ui.view" id="nan_product_pack_form">
1442+ <field name="name">product.product.pack.form</field>
1443+ <field name="model">product.product</field>
1444+ <field name="type">form</field>
1445+ <field name="inherit_id" ref="product.product_normal_form_view" />
1446+ <field name="arch" type="xml">
1447+ <notebook position="inside">
1448+ <page string="Pack">
1449+ <label string="If you add products in the 'Pack Products' field, all those products will be added automatically when a new quotation or order is created." colspan="4"/>
1450+ <field name="stock_depends"/>
1451+ <field name="pack_fixed_price"/>
1452+ <label string=""/>
1453+ <separator string="Pack Products" colspan="4"/>
1454+ <field name="pack_line_ids" colspan="4" nolabel="1"/>
1455+ </page>
1456+ </notebook>
1457+ </field>
1458+ </record>
1459+
1460+ <!-- product.pack.line -->
1461+ <record model="ir.ui.view" id="product_pack_line_form">
1462+ <field name="name">product.pack.line.form</field>
1463+ <field name="model">product.pack.line</field>
1464+ <field name="type">form</field>
1465+ <field name="arch" type="xml">
1466+ <form string="Pack Product Line">
1467+ <field name="quantity"/>
1468+ <field name="product_id"/>
1469+ </form>
1470+ </field>
1471+ </record>
1472+ <record model="ir.ui.view" id="product_pack_line_tree">
1473+ <field name="name">product.pack.line.tree</field>
1474+ <field name="model">product.pack.line</field>
1475+ <field name="type">tree</field>
1476+ <field name="arch" type="xml">
1477+ <tree string="Pack Product Lines">
1478+ <field name="quantity"/>
1479+ <field name="product_id"/>
1480+ </tree>
1481+ </field>
1482+ </record>
1483+</data>
1484+</openerp>
1485+
1486
1487=== added directory 'product_pack/security'
1488=== added file 'product_pack/security/ir.model.access.csv'
1489--- product_pack/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
1490+++ product_pack/security/ir.model.access.csv 2012-09-19 06:37:17 +0000
1491@@ -0,0 +1,3 @@
1492+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1493+"access_product_pack_line_manager","product.pack.line manager","model_product_pack_line","base.group_sale_manager",1,1,1,1
1494+"access_product_pack_line_mployee","product.pack.line employee","model_product_pack_line","base.group_user",1,0,0,0

Subscribers

People subscribed via source and target branches

to status/vote changes: