Merge lp:~akretion-team/openerp-product-variant/migr-v7-wip into lp:openerp-product-variant/trunk
- migr-v7-wip
- Merge into extraction-70
Status: | Merged |
---|---|
Merged at revision: | 194 |
Proposed branch: | lp:~akretion-team/openerp-product-variant/migr-v7-wip |
Merge into: | lp:openerp-product-variant/trunk |
Diff against target: |
867 lines (+288/-268) 5 files modified
product_variant_multi/__init__.py (+2/-4) product_variant_multi/__openerp__.py (+12/-14) product_variant_multi/product_variant.py (+39/-37) product_variant_multi/product_view.xml (+235/-210) product_variant_multi/security/ir.model.access.csv (+0/-3) |
To merge this branch: | bzr merge lp:~akretion-team/openerp-product-variant/migr-v7-wip |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Raphaël Valyi - http://www.akretion.com | Disapprove | ||
Review via email: mp+148852@code.launchpad.net |
Commit message
Description of the change
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : | # |
- 196. By Raphaël Valyi - http://www.akretion.com
-
[MIGR][
product_ variant_ multi] disabled order criteria that seems to lock the server on OpenERP 7.0, disabled stock module specific things that would break the variant generation (this should be cleaned up and may be a stock variant module may be created); enabled the value_ids field again as it works
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : | # |
Hum much better now: we have nearly all the features working again!
I isolated what would lock the server (and the browser javascript engine!): it was an ordering condition to help keep numeric option ordered. I disabled that condition for now (may be something would need to be done to enable it again).
Also I disabled some stock specific things (though not 100% cleanly yet) that would break the variant generation without the stock module.
My view is that installing variants shouldn't harm OpenERP modularity: so if really needed some stock variant module should be built to generate the stock properties of the variants properly.
For now I suggest analysing a bit better which fields are only found on the stock module and cleaning them systematically from the code and the interface. This systematic cleanup is yet to be done.
- 197. By Alexis de Lattre
-
Continue porting to OpenERP v7
Some code clean-up and usability enhancements
Includes some of the changes proposed by agustin
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote : | # |
I propose to accept Anybox's merge instead https:/
at least they got more review and said they were using it in production. On my side, was only a prototype (not sure on yours Aflexis). It's just to bad we double worked on that one.
Eventually we can later analysis if there are more fixes from this commit http://
Preview Diff
1 | === modified file 'product_variant_multi/__init__.py' | |||
2 | --- product_variant_multi/__init__.py 2011-02-01 17:08:05 +0000 | |||
3 | +++ product_variant_multi/__init__.py 2013-04-04 09:34:23 +0000 | |||
4 | @@ -1,9 +1,9 @@ | |||
5 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
6 | 2 | ############################################################################## | 2 | ############################################################################## |
7 | 3 | # | 3 | # |
9 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
10 | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
12 | 6 | # $Id$ | 6 | # Copyright (C) 2010-2013 Akretion (http://www.akretion.com) |
13 | 7 | # | 7 | # |
14 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
15 | 9 | # it under the terms of the GNU General Public License as published by | 9 | # it under the terms of the GNU General Public License as published by |
16 | @@ -22,5 +22,3 @@ | |||
17 | 22 | 22 | ||
18 | 23 | import product_variant | 23 | import product_variant |
19 | 24 | 24 | ||
20 | 25 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
21 | 26 | |||
22 | 27 | 25 | ||
23 | === modified file 'product_variant_multi/__openerp__.py' | |||
24 | --- product_variant_multi/__openerp__.py 2012-02-14 04:15:54 +0000 | |||
25 | +++ product_variant_multi/__openerp__.py 2013-04-04 09:34:23 +0000 | |||
26 | @@ -1,9 +1,9 @@ | |||
27 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
28 | 2 | ############################################################################## | 2 | ############################################################################## |
29 | 3 | # | 3 | # |
31 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
32 | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
34 | 6 | # $Id$ | 6 | # Copyright (C) 2010-2013 Akretion (http://www.akretion.com) |
35 | 7 | # | 7 | # |
36 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
37 | 9 | # it under the terms of the GNU General Public License as published by | 9 | # it under the terms of the GNU General Public License as published by |
38 | @@ -20,10 +20,12 @@ | |||
39 | 20 | # | 20 | # |
40 | 21 | ############################################################################## | 21 | ############################################################################## |
41 | 22 | { | 22 | { |
43 | 23 | "name" : "Products with multi-level variants", | 23 | "name" : "Product Variant Multi", |
44 | 24 | "version" : "1.0", | 24 | "version" : "1.0", |
47 | 25 | "author" : "Tiny, Akretion", | 25 | "author" : "OpenERP SA, Akretion", |
48 | 26 | "category" : "Generic Modules/Inventory Control", | 26 | "category" : "Sales Management", |
49 | 27 | "license": "AGPL-3", | ||
50 | 28 | "summary": "Products with multi-dimension variants", | ||
51 | 27 | "description":""" | 29 | "description":""" |
52 | 28 | Multi-axial varianted product support for OpenERP | 30 | Multi-axial varianted product support for OpenERP |
53 | 29 | ================================================= | 31 | ================================================= |
54 | @@ -57,19 +59,15 @@ | |||
55 | 57 | transparent as OpenERP modules try to get their properties like name from product.product | 59 | transparent as OpenERP modules try to get their properties like name from product.product |
56 | 58 | and only from product.template if not found on product.product. But at least you | 60 | and only from product.template if not found on product.product. But at least you |
57 | 59 | will have been warned. | 61 | will have been warned. |
58 | 60 | |||
59 | 61 | The dependence to the stock module is weak, it's only there to be able to put the | ||
60 | 62 | variant menu in the warehouse management sub-menu (sigh!). | ||
61 | 63 | """, | 62 | """, |
66 | 64 | "depends" : ["product", "stock"], | 63 | "depends" : ["product"], |
67 | 65 | "init_xml" : [], | 64 | "demo" : ["demo_data.xml"], |
68 | 66 | "demo_xml" : ["demo_data.xml"], | 65 | "data" : [ |
65 | 67 | "update_xml" : [ | ||
69 | 68 | "security/ir.model.access.csv", | 66 | "security/ir.model.access.csv", |
70 | 69 | "product_view.xml", | 67 | "product_view.xml", |
71 | 70 | ], | 68 | ], |
72 | 69 | "application": True, | ||
73 | 71 | "active": False, | 70 | "active": False, |
75 | 72 | "installable": True | 71 | "installable": True, |
76 | 73 | } | 72 | } |
77 | 74 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
78 | 75 | 73 | ||
79 | 76 | 74 | ||
80 | === modified file 'product_variant_multi/product_variant.py' | |||
81 | --- product_variant_multi/product_variant.py 2012-10-16 11:52:59 +0000 | |||
82 | +++ product_variant_multi/product_variant.py 2013-04-04 09:34:23 +0000 | |||
83 | @@ -3,7 +3,7 @@ | |||
84 | 3 | # | 3 | # |
85 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
86 | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
88 | 6 | # Copyright (C) 2010-2011 Akretion (www.akretion.com). All Rights Reserved | 6 | # Copyright (C) 2010-2013 Akretion (www.akretion.com). All Rights Reserved |
89 | 7 | # @author Sebatien Beau <sebastien.beau@akretion.com> | 7 | # @author Sebatien Beau <sebastien.beau@akretion.com> |
90 | 8 | # @author Raphaël Valyi <raphael.valyi@akretion.com> | 8 | # @author Raphaël Valyi <raphael.valyi@akretion.com> |
91 | 9 | # @author Alexis de Lattre <alexis.delattre@akretion.com> | 9 | # @author Alexis de Lattre <alexis.delattre@akretion.com> |
92 | @@ -24,11 +24,11 @@ | |||
93 | 24 | # | 24 | # |
94 | 25 | ############################################################################## | 25 | ############################################################################## |
95 | 26 | 26 | ||
98 | 27 | from osv import fields, osv | 27 | from openerp.osv import fields, osv, orm |
99 | 28 | import decimal_precision as dp | 28 | import openerp.addons.decimal_precision as dp |
100 | 29 | # Lib to eval python code with security | 29 | # Lib to eval python code with security |
103 | 30 | from tools.safe_eval import safe_eval | 30 | from openerp.tools.safe_eval import safe_eval |
104 | 31 | from tools.translate import _ | 31 | from openerp.tools.translate import _ |
105 | 32 | 32 | ||
106 | 33 | import logging | 33 | import logging |
107 | 34 | _logger = logging.getLogger(__name__) | 34 | _logger = logging.getLogger(__name__) |
108 | @@ -36,22 +36,22 @@ | |||
109 | 36 | # | 36 | # |
110 | 37 | # Dimensions Definition | 37 | # Dimensions Definition |
111 | 38 | # | 38 | # |
113 | 39 | class product_variant_dimension_type(osv.osv): | 39 | class product_variant_dimension_type(osv.Model): |
114 | 40 | _name = "product.variant.dimension.type" | 40 | _name = "product.variant.dimension.type" |
115 | 41 | _description = "Dimension Type" | 41 | _description = "Dimension Type" |
116 | 42 | 42 | ||
117 | 43 | _columns = { | 43 | _columns = { |
118 | 44 | 'description': fields.char('Description', size=64, translate=True), | 44 | 'description': fields.char('Description', size=64, translate=True), |
122 | 45 | 'name' : fields.char('Dimension', size=64, required=True), | 45 | 'name': fields.char('Dimension Type Name', size=64, required=True), |
123 | 46 | 'sequence' : fields.integer('Sequence', help="The product 'variants' code will use this to order the dimension values"), | 46 | 'sequence': fields.integer('Sequence', help="The product 'variants' code will use this to order the dimension values"), |
124 | 47 | 'option_ids' : fields.one2many('product.variant.dimension.option', 'dimension_id', 'Dimension Options'), | 47 | 'option_ids': fields.one2many('product.variant.dimension.option', 'dimension_id', 'Dimension Options'), |
125 | 48 | 'product_tmpl_id': fields.many2many('product.template', 'product_template_dimension_rel', 'dimension_id', 'template_id', 'Product Template'), | 48 | 'product_tmpl_id': fields.many2many('product.template', 'product_template_dimension_rel', 'dimension_id', 'template_id', 'Product Template'), |
126 | 49 | 'allow_custom_value': fields.boolean('Allow Custom Value', help="If true, custom values can be entered in the product configurator"), | 49 | 'allow_custom_value': fields.boolean('Allow Custom Value', help="If true, custom values can be entered in the product configurator"), |
127 | 50 | 'mandatory_dimension': fields.boolean('Mandatory Dimension', help="If false, variant products will be created with and without this dimension"), | 50 | 'mandatory_dimension': fields.boolean('Mandatory Dimension', help="If false, variant products will be created with and without this dimension"), |
128 | 51 | } | 51 | } |
129 | 52 | 52 | ||
130 | 53 | _defaults = { | 53 | _defaults = { |
132 | 54 | 'mandatory_dimension': lambda * a: 1, | 54 | 'mandatory_dimension': 1, |
133 | 55 | } | 55 | } |
134 | 56 | 56 | ||
135 | 57 | _order = "sequence, name" | 57 | _order = "sequence, name" |
136 | @@ -64,7 +64,7 @@ | |||
137 | 64 | product_variant_dimension_type() | 64 | product_variant_dimension_type() |
138 | 65 | 65 | ||
139 | 66 | 66 | ||
141 | 67 | class product_variant_dimension_option(osv.osv): | 67 | class product_variant_dimension_option(osv.Model): |
142 | 68 | _name = "product.variant.dimension.option" | 68 | _name = "product.variant.dimension.option" |
143 | 69 | _description = "Dimension Option" | 69 | _description = "Dimension Option" |
144 | 70 | 70 | ||
145 | @@ -72,18 +72,18 @@ | |||
146 | 72 | return self.pool.get('product.variant.dimension.value').search(cr, uid, [('dimension_id', 'in', ids)], context=context) | 72 | return self.pool.get('product.variant.dimension.value').search(cr, uid, [('dimension_id', 'in', ids)], context=context) |
147 | 73 | 73 | ||
148 | 74 | _columns = { | 74 | _columns = { |
153 | 75 | 'name' : fields.char('Name', size=64, required=True), | 75 | 'name': fields.char('Dimension Option Name', size=64, required=True), |
154 | 76 | 'code' : fields.char('Code', size=64), | 76 | 'code': fields.char('Code', size=64), |
155 | 77 | 'sequence' : fields.integer('Sequence'), | 77 | 'sequence': fields.integer('Sequence'), |
156 | 78 | 'dimension_id' : fields.many2one('product.variant.dimension.type', 'Dimension Type', ondelete='cascade'), | 78 | 'dimension_id': fields.many2one('product.variant.dimension.type', 'Dimension Type', ondelete='cascade'), |
157 | 79 | } | 79 | } |
158 | 80 | 80 | ||
160 | 81 | _order = "dimension_id, sequence, to_number(name, '')" | 81 | _order = "dimension_id, sequence, name" |
161 | 82 | 82 | ||
162 | 83 | product_variant_dimension_option() | 83 | product_variant_dimension_option() |
163 | 84 | 84 | ||
164 | 85 | 85 | ||
166 | 86 | class product_variant_dimension_value(osv.osv): | 86 | class product_variant_dimension_value(osv.Model): |
167 | 87 | _name = "product.variant.dimension.value" | 87 | _name = "product.variant.dimension.value" |
168 | 88 | _description = "Dimension Value" | 88 | _description = "Dimension Value" |
169 | 89 | 89 | ||
170 | @@ -91,7 +91,7 @@ | |||
171 | 91 | for value in self.browse(cr, uid, ids, context=context): | 91 | for value in self.browse(cr, uid, ids, context=context): |
172 | 92 | if value.product_ids: | 92 | if value.product_ids: |
173 | 93 | product_list = '\n - ' + '\n - '.join([product.name for product in value.product_ids]) | 93 | product_list = '\n - ' + '\n - '.join([product.name for product in value.product_ids]) |
175 | 94 | raise osv.except_osv(_('Dimension value can not be removed'), _("The value %s is used by the products : %s \n Please remove these products before removing the value." % (value.option_id.name, product_list))) | 94 | raise orm.except_orm(_('Dimension value can not be removed'), _("The value %s is used by the products : %s \n Please remove these products before removing the value." % (value.option_id.name, product_list))) |
176 | 95 | return super(product_variant_dimension_value, self).unlink(cr, uid, ids, context) | 95 | return super(product_variant_dimension_value, self).unlink(cr, uid, ids, context) |
177 | 96 | 96 | ||
178 | 97 | def _get_values_from_types(self, cr, uid, ids, context=None): | 97 | def _get_values_from_types(self, cr, uid, ids, context=None): |
179 | @@ -102,7 +102,7 @@ | |||
180 | 102 | 102 | ||
181 | 103 | _columns = { | 103 | _columns = { |
182 | 104 | 'option_id' : fields.many2one('product.variant.dimension.option', 'Option', required=True), | 104 | 'option_id' : fields.many2one('product.variant.dimension.option', 'Option', required=True), |
184 | 105 | 'name': fields.related('option_id', 'name', type='char', relation='product.variant.dimension.option', string="Dimension value", readonly=True), | 105 | 'name': fields.related('option_id', 'name', type='char', relation='product.variant.dimension.option', string="Dimension Value", readonly=True), |
185 | 106 | 'sequence' : fields.integer('Sequence'), | 106 | 'sequence' : fields.integer('Sequence'), |
186 | 107 | 'price_extra' : fields.float('Sale Price Extra', digits_compute=dp.get_precision('Sale Price')), | 107 | 'price_extra' : fields.float('Sale Price Extra', digits_compute=dp.get_precision('Sale Price')), |
187 | 108 | 'price_margin' : fields.float('Sale Price Margin', digits_compute=dp.get_precision('Sale Price')), | 108 | 'price_margin' : fields.float('Sale Price Margin', digits_compute=dp.get_precision('Sale Price')), |
188 | @@ -117,11 +117,11 @@ | |||
189 | 117 | 'product.variant.dimension.type': (_get_values_from_types, ['sequence'], 10), | 117 | 'product.variant.dimension.type': (_get_values_from_types, ['sequence'], 10), |
190 | 118 | }), | 118 | }), |
191 | 119 | 'product_ids': fields.many2many('product.product', 'product_product_dimension_rel', 'dimension_id', 'product_id', 'Variant', readonly=True), | 119 | 'product_ids': fields.many2many('product.product', 'product_product_dimension_rel', 'dimension_id', 'product_id', 'Variant', readonly=True), |
193 | 120 | 'active' : fields.boolean('Active?', help="If false, this value will be not use anymore for generating variant"), | 120 | 'active' : fields.boolean('Active', help="If false, this value will not be used anymore to generate variants."), |
194 | 121 | } | 121 | } |
195 | 122 | 122 | ||
196 | 123 | _defaults = { | 123 | _defaults = { |
198 | 124 | 'active': lambda * a: 1, | 124 | 'active': True, |
199 | 125 | } | 125 | } |
200 | 126 | 126 | ||
201 | 127 | _sql_constraints = [ ('opt_dim_tmpl_uniq', 'UNIQUE(option_id, dimension_id, product_tmpl_id)', | 127 | _sql_constraints = [ ('opt_dim_tmpl_uniq', 'UNIQUE(option_id, dimension_id, product_tmpl_id)', |
202 | @@ -132,9 +132,11 @@ | |||
203 | 132 | product_variant_dimension_value() | 132 | product_variant_dimension_value() |
204 | 133 | 133 | ||
205 | 134 | 134 | ||
207 | 135 | class product_template(osv.osv): | 135 | class product_template(osv.Model): |
208 | 136 | _inherit = "product.template" | 136 | _inherit = "product.template" |
209 | 137 | 137 | ||
210 | 138 | _order = "name" | ||
211 | 139 | |||
212 | 138 | _columns = { | 140 | _columns = { |
213 | 139 | 'name': fields.char('Name', size=128, translate=True, select=True), | 141 | 'name': fields.char('Name', size=128, translate=True, select=True), |
214 | 140 | 'dimension_type_ids':fields.many2many('product.variant.dimension.type', 'product_template_dimension_rel', 'template_id', 'dimension_id', 'Dimension Types'), | 142 | 'dimension_type_ids':fields.many2many('product.variant.dimension.type', 'product_template_dimension_rel', 'template_id', 'dimension_id', 'Dimension Types'), |
215 | @@ -143,7 +145,7 @@ | |||
216 | 143 | 'variant_model_name':fields.char('Variant Model Name', size=64, required=True, help='[_o.dimension_id.name_] will be replaced by the name of the dimension and [_o.option_id.code_] by the code of the option. Example of Variant Model Name : "[_o.dimension_id.name_] - [_o.option_id.code_]"'), | 145 | 'variant_model_name':fields.char('Variant Model Name', size=64, required=True, help='[_o.dimension_id.name_] will be replaced by the name of the dimension and [_o.option_id.code_] by the code of the option. Example of Variant Model Name : "[_o.dimension_id.name_] - [_o.option_id.code_]"'), |
217 | 144 | 'variant_model_name_separator':fields.char('Variant Model Name Separator', size=64, help='Add a separator between the elements of the variant name'), | 146 | 'variant_model_name_separator':fields.char('Variant Model Name Separator', size=64, help='Add a separator between the elements of the variant name'), |
218 | 145 | 'code_generator' : fields.char('Code Generator', size=256, help='enter the model for the product code, all parameter between [_o.my_field_] will be replace by the product field. Example product_code model : prefix_[_o.variants_]_suffixe ==> result : prefix_2S2T_suffix'), | 147 | 'code_generator' : fields.char('Code Generator', size=256, help='enter the model for the product code, all parameter between [_o.my_field_] will be replace by the product field. Example product_code model : prefix_[_o.variants_]_suffixe ==> result : prefix_2S2T_suffix'), |
220 | 146 | 'is_multi_variants' : fields.boolean('Is Multi Variants?'), | 148 | 'is_multi_variants' : fields.boolean('Is Multi Variants'), |
221 | 147 | 'variant_track_production' : fields.boolean('Track Production Lots on variants ?'), | 149 | 'variant_track_production' : fields.boolean('Track Production Lots on variants ?'), |
222 | 148 | 'variant_track_incoming' : fields.boolean('Track Incoming Lots on variants ?'), | 150 | 'variant_track_incoming' : fields.boolean('Track Incoming Lots on variants ?'), |
223 | 149 | 'variant_track_outgoing' : fields.boolean('Track Outgoing Lots on variants ?'), | 151 | 'variant_track_outgoing' : fields.boolean('Track Outgoing Lots on variants ?'), |
224 | @@ -152,9 +154,9 @@ | |||
225 | 152 | } | 154 | } |
226 | 153 | 155 | ||
227 | 154 | _defaults = { | 156 | _defaults = { |
231 | 155 | 'variant_model_name': lambda * a: '[_o.dimension_id.name_] - [_o.option_id.name_]', | 157 | 'variant_model_name': '[_o.dimension_id.name_] - [_o.option_id.name_]', |
232 | 156 | 'variant_model_name_separator': lambda * a: ' - ', | 158 | 'variant_model_name_separator': ' - ', |
233 | 157 | 'is_multi_variants' : lambda * a: False, | 159 | 'is_multi_variants' : False, |
234 | 158 | 'code_generator' : "[_'-'.join([x.option_id.name for x in o.dimension_value_ids] or ['CONF'])_]", | 160 | 'code_generator' : "[_'-'.join([x.option_id.name for x in o.dimension_value_ids] or ['CONF'])_]", |
235 | 159 | } | 161 | } |
236 | 160 | 162 | ||
237 | @@ -291,7 +293,7 @@ | |||
238 | 291 | product_template() | 293 | product_template() |
239 | 292 | 294 | ||
240 | 293 | 295 | ||
242 | 294 | class product_product(osv.osv): | 296 | class product_product(osv.Model): |
243 | 295 | _inherit = "product.product" | 297 | _inherit = "product.product" |
244 | 296 | 298 | ||
245 | 297 | def init(self, cr): | 299 | def init(self, cr): |
246 | @@ -352,15 +354,15 @@ | |||
247 | 352 | new_default_code = self.generate_product_code(cr, uid, product, product.product_tmpl_id.code_generator, context=context) | 354 | new_default_code = self.generate_product_code(cr, uid, product, product.product_tmpl_id.code_generator, context=context) |
248 | 353 | current_values = { | 355 | current_values = { |
249 | 354 | 'default_code': product.default_code, | 356 | 'default_code': product.default_code, |
253 | 355 | 'track_production': product.track_production, | 357 | # 'track_production': product.track_production, |
254 | 356 | 'track_outgoing': product.track_outgoing, | 358 | # 'track_outgoing': product.track_outgoing, |
255 | 357 | 'track_incoming': product.track_incoming, | 359 | # 'track_incoming': product.track_incoming, |
256 | 358 | } | 360 | } |
257 | 359 | new_values = { | 361 | new_values = { |
258 | 360 | 'default_code': new_default_code, | 362 | 'default_code': new_default_code, |
262 | 361 | 'track_production': product.product_tmpl_id.variant_track_production, | 363 | # 'track_production': product.product_tmpl_id.variant_track_production, |
263 | 362 | 'track_outgoing': product.product_tmpl_id.variant_track_outgoing, | 364 | # 'track_outgoing': product.product_tmpl_id.variant_track_outgoing, |
264 | 363 | 'track_incoming': product.product_tmpl_id.variant_track_incoming, | 365 | # 'track_incoming': product.product_tmpl_id.variant_track_incoming, |
265 | 364 | } | 366 | } |
266 | 365 | if new_values != current_values: | 367 | if new_values != current_values: |
267 | 366 | self.write(cr, uid, [product.id], new_values, context=context) | 368 | self.write(cr, uid, [product.id], new_values, context=context) |
268 | @@ -407,7 +409,7 @@ | |||
269 | 407 | buffer.append(value.dimension_id) | 409 | buffer.append(value.dimension_id) |
270 | 408 | unique_set = set(buffer) | 410 | unique_set = set(buffer) |
271 | 409 | if len(unique_set) != len(buffer): | 411 | if len(unique_set) != len(buffer): |
273 | 410 | raise osv.except_osv(_('Constraint error :'), _("On product '%s', there are several dimension values for the same dimension type.") % product.name) | 412 | raise orm.except_orm(_('Constraint error :'), _("On product '%s', there are several dimension values for the same dimension type.") % product.name) |
274 | 411 | return True | 413 | return True |
275 | 412 | 414 | ||
276 | 413 | def compute_product_dimension_extra_price(self, cr, uid, product_id, product_price_extra=False, dim_price_margin=False, dim_price_extra=False, context=None): | 415 | def compute_product_dimension_extra_price(self, cr, uid, product_id, product_price_extra=False, dim_price_margin=False, dim_price_extra=False, context=None): |
277 | @@ -482,9 +484,9 @@ | |||
278 | 482 | #the way the weight are implemented are not clean at all, we should redesign the module product form the addons in order to get something correclty. | 484 | #the way the weight are implemented are not clean at all, we should redesign the module product form the addons in order to get something correclty. |
279 | 483 | #indeed some field of the template have to be overwrited like weight, name, weight_net, volume. | 485 | #indeed some field of the template have to be overwrited like weight, name, weight_net, volume. |
280 | 484 | #in order to have a consitent api we should use the same field for getting the weight, now we have to use "weight" or "total_weight" not clean at all with external syncronization | 486 | #in order to have a consitent api we should use the same field for getting the weight, now we have to use "weight" or "total_weight" not clean at all with external syncronization |
284 | 485 | 'total_weight': fields.function(_product_compute_weight_volume, method=True, type='float', string='Gross weight', help="The gross weight in Kg.", multi='weight_volume'), | 487 | 'total_weight': fields.function(_product_compute_weight_volume, method=True, type='float', string='Total Gross Weight', help="The gross weight in Kg.", multi='weight_volume'), |
285 | 486 | 'total_weight_net': fields.function(_product_compute_weight_volume, method=True, type='float', string='Net weight', help="The net weight in Kg.", multi='weight_volume'), | 488 | 'total_weight_net': fields.function(_product_compute_weight_volume, method=True, type='float', string='Total Net Weight', help="The net weight in Kg.", multi='weight_volume'), |
286 | 487 | 'total_volume': fields.function(_product_compute_weight_volume, method=True, type='float', string='Volume', help="The volume in m3.", multi='weight_volume'), | 489 | 'total_volume': fields.function(_product_compute_weight_volume, method=True, type='float', string='Total Volume', help="The volume in m3.", multi='weight_volume'), |
287 | 488 | 'additional_weight': fields.float('Additional Gross weight', help="The additional gross weight in Kg."), | 490 | 'additional_weight': fields.float('Additional Gross weight', help="The additional gross weight in Kg."), |
288 | 489 | 'additional_weight_net': fields.float('Additional Net weight', help="The additional net weight in Kg."), | 491 | 'additional_weight_net': fields.float('Additional Net weight', help="The additional net weight in Kg."), |
289 | 490 | 'additional_volume': fields.float('Additional Volume', help="The additional volume in Kg."), | 492 | 'additional_volume': fields.float('Additional Volume', help="The additional volume in Kg."), |
290 | 491 | 493 | ||
291 | === modified file 'product_variant_multi/product_view.xml' | |||
292 | --- product_variant_multi/product_view.xml 2012-10-16 14:22:32 +0000 | |||
293 | +++ product_variant_multi/product_view.xml 2013-04-04 09:34:23 +0000 | |||
294 | @@ -1,4 +1,4 @@ | |||
296 | 1 | <?xml version="1.0" ?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
297 | 2 | <openerp> | 2 | <openerp> |
298 | 3 | <data> | 3 | <data> |
299 | 4 | 4 | ||
300 | @@ -10,35 +10,27 @@ | |||
301 | 10 | --> | 10 | --> |
302 | 11 | 11 | ||
303 | 12 | 12 | ||
326 | 13 | <record id="product_variant" model="ir.actions.act_window"> | 13 | <menuitem name="Variant Dimensions" id="menu_variant_dimension" parent="product.prod_config_main" /> |
327 | 14 | <field name="name">Product Variants</field> | 14 | |
328 | 15 | <field name="res_model">product.product</field> | 15 | |
329 | 16 | <field name="view_type">form</field> | 16 | <!-- DIMENSION OPTION --> |
330 | 17 | <field name="view_mode">tree,form</field> | 17 | <record id="product_variant_multi_dimension_option_seach" model="ir.ui.view"> |
331 | 18 | </record> | 18 | <field name="name">product.variant.multi.dimension.option.search</field> |
332 | 19 | 19 | <field name="model">product.variant.dimension.option</field> | |
333 | 20 | <record id="product_template" model="ir.actions.act_window"> | 20 | <field name="arch" type="xml"> |
334 | 21 | <field name="name">Product Templates</field> | 21 | <search string="Dimension Options Search"> |
335 | 22 | <field name="res_model">product.template</field> | 22 | <field name="name"/> |
336 | 23 | <field name="view_type">form</field> | 23 | <field name="dimension_id"/> |
337 | 24 | <field name="domain">[('is_multi_variants','=',True)]</field> | 24 | </search> |
338 | 25 | <field name="view_mode">tree,form</field> | 25 | </field> |
339 | 26 | </record> | 26 | </record> |
340 | 27 | 27 | ||
319 | 28 | <menuitem action="product_template" id="menu_template" parent="stock.menu_stock_product" /> | ||
320 | 29 | |||
321 | 30 | <menuitem action="product_variant" id="menu_variant" parent="stock.menu_stock_product" /> | ||
322 | 31 | |||
323 | 32 | <menuitem name="Variant dimensions" id="menu_variant_dimension" parent="stock.menu_product_in_config_stock" /> | ||
324 | 33 | |||
325 | 34 | <!-- Views from Dimension option --> | ||
341 | 35 | <record id="product_variant_multi_dimension_option_tree" model="ir.ui.view"> | 28 | <record id="product_variant_multi_dimension_option_tree" model="ir.ui.view"> |
342 | 36 | <field name="name">product.variant.multi.dimension.option.tree</field> | 29 | <field name="name">product.variant.multi.dimension.option.tree</field> |
343 | 37 | <field name="model">product.variant.dimension.option</field> | 30 | <field name="model">product.variant.dimension.option</field> |
344 | 38 | <field name="type">tree</field> | ||
345 | 39 | <field name="arch" type="xml"> | 31 | <field name="arch" type="xml"> |
348 | 40 | <tree string="Dimension Options"> | 32 | <tree string="Dimension Options" editable="top"> |
349 | 41 | <field name="dimension_id" invisible="not context.get('dimension_value_main_view', False)" /> | 33 | <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" /> |
350 | 42 | <field name="name" /> | 34 | <field name="name" /> |
351 | 43 | <field name="sequence" /> | 35 | <field name="sequence" /> |
352 | 44 | <field name="code" /> | 36 | <field name="code" /> |
353 | @@ -49,40 +41,47 @@ | |||
354 | 49 | <record id="product_variant_multi_dimension_option_form" model="ir.ui.view"> | 41 | <record id="product_variant_multi_dimension_option_form" model="ir.ui.view"> |
355 | 50 | <field name="name">product.variant.multi.dimension.option.form</field> | 42 | <field name="name">product.variant.multi.dimension.option.form</field> |
356 | 51 | <field name="model">product.variant.dimension.option</field> | 43 | <field name="model">product.variant.dimension.option</field> |
357 | 52 | <field name="type">form</field> | ||
358 | 53 | <field name="arch" type="xml"> | 44 | <field name="arch" type="xml"> |
359 | 54 | <form string="Dimension Options"> | 45 | <form string="Dimension Options"> |
361 | 55 | <field name="dimension_id" select="1" invisible="not context.get('dimension_option_main_view', False)" /> | 46 | <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" /> |
362 | 56 | <newline /> | 47 | <newline /> |
363 | 57 | <field name="sequence" /> | 48 | <field name="sequence" /> |
365 | 58 | <field name="name" select="1" /> | 49 | <field name="name" /> |
366 | 59 | <field name="code" /> | 50 | <field name="code" /> |
367 | 60 | </form> | 51 | </form> |
368 | 61 | </field> | 52 | </field> |
369 | 62 | </record> | 53 | </record> |
370 | 63 | 54 | ||
375 | 64 | <!-- Default action for Dimension option --> | 55 | <record id="action_dimension_option" model="ir.actions.act_window"> |
376 | 65 | <record id="action_dimension_option" model="ir.actions.act_window"> | 56 | <field name="name">Dimension Options</field> |
377 | 66 | <field name="name">Dimension Options</field> | 57 | <field name="res_model">product.variant.dimension.option</field> |
374 | 67 | <field name="res_model">product.variant.dimension.option</field> | ||
378 | 68 | <field name="view_type">form</field> | 58 | <field name="view_type">form</field> |
380 | 69 | <field name="view_mode">tree,form</field> | 59 | <field name="view_mode">tree,form</field> |
381 | 70 | <field name="context">{'dimension_option_main_view': True}</field> | 60 | <field name="context">{'dimension_option_main_view': True}</field> |
390 | 71 | </record> | 61 | </record> |
391 | 72 | 62 | ||
392 | 73 | <!-- Menu entry for Dimension values --> | 63 | <menuitem id="menu_variant_dimension_option" parent="menu_variant_dimension" action="action_dimension_option" /> |
393 | 74 | <menuitem id="menu_variant_dimension_option" icon="STOCK_JUSTIFY_FILL" parent="menu_variant_dimension" action="action_dimension_option" /> | 64 | |
394 | 75 | 65 | ||
395 | 76 | 66 | <!-- DIMENSION VALUES --> | |
396 | 77 | 67 | <record id="product_variant_multi_dimension_value_search" model="ir.ui.view"> | |
397 | 78 | <!-- Views from Dimension values --> | 68 | <field name="name">product.variant.multi.dimension.value.search</field> |
398 | 69 | <field name="model">product.variant.dimension.value</field> | ||
399 | 70 | <field name="arch" type="xml"> | ||
400 | 71 | <search string="Dimension Values Search"> | ||
401 | 72 | <field name="product_tmpl_id"/> | ||
402 | 73 | <field name="option_id"/> | ||
403 | 74 | </search> | ||
404 | 75 | </field> | ||
405 | 76 | </record> | ||
406 | 77 | |||
407 | 78 | |||
408 | 79 | <record id="product_variant_multi_dimension_value_tree" model="ir.ui.view"> | 79 | <record id="product_variant_multi_dimension_value_tree" model="ir.ui.view"> |
409 | 80 | <field name="name">product.variant.multi.dimension.value.tree</field> | 80 | <field name="name">product.variant.multi.dimension.value.tree</field> |
410 | 81 | <field name="model">product.variant.dimension.value</field> | 81 | <field name="model">product.variant.dimension.value</field> |
411 | 82 | <field name="type">tree</field> | ||
412 | 83 | <field name="arch" type="xml"> | 82 | <field name="arch" type="xml"> |
415 | 84 | <tree string="Dimension values" editable="top"> | 83 | <tree string="Dimension Values" editable="top"> |
416 | 85 | <field name="product_tmpl_id" select="1" invisible="not context.get('dimension_value_main_view', False)" /> | 84 | <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" /> |
417 | 86 | <field name="active" /> | 85 | <field name="active" /> |
418 | 87 | <field name="dimension_id" /> | 86 | <field name="dimension_id" /> |
419 | 88 | <field name="option_id" /> | 87 | <field name="option_id" /> |
420 | @@ -96,91 +95,98 @@ | |||
421 | 96 | <record id="product_variant_multi_dimension_value_form" model="ir.ui.view"> | 95 | <record id="product_variant_multi_dimension_value_form" model="ir.ui.view"> |
422 | 97 | <field name="name">product.variant.multi.dimension.value.form</field> | 96 | <field name="name">product.variant.multi.dimension.value.form</field> |
423 | 98 | <field name="model">product.variant.dimension.value</field> | 97 | <field name="model">product.variant.dimension.value</field> |
424 | 99 | <field name="type">form</field> | ||
425 | 100 | <field name="arch" type="xml"> | 98 | <field name="arch" type="xml"> |
428 | 101 | <form string="Dimension values"> | 99 | <form string="Dimension Values"> |
429 | 102 | <field name="product_tmpl_id" select="1" invisible="not context.get('dimension_value_main_view', False)" /> | 100 | <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" /> |
430 | 103 | <field name="active" /> | 101 | <field name="active" /> |
431 | 104 | <field name="dimension_id" /> | 102 | <field name="dimension_id" /> |
432 | 105 | <newline /> | 103 | <newline /> |
434 | 106 | <field name="option_id" select="1" /> | 104 | <field name="option_id" /> |
435 | 107 | <field name="sequence" /> | 105 | <field name="sequence" /> |
439 | 108 | <field name="cost_price_extra" select="2" /> | 106 | <field name="cost_price_extra" /> |
440 | 109 | <field name="price_extra" select="2" /> | 107 | <field name="price_extra" /> |
441 | 110 | <field name="price_margin" select="2" /> | 108 | <field name="price_margin" /> |
442 | 111 | </form> | 109 | </form> |
443 | 112 | </field> | 110 | </field> |
444 | 113 | </record> | 111 | </record> |
445 | 114 | 112 | ||
450 | 115 | <!-- Default action for Dimension values --> | 113 | <record id="action_dimension_value" model="ir.actions.act_window"> |
451 | 116 | <record id="action_dimension_value" model="ir.actions.act_window"> | 114 | <field name="name">Dimension values</field> |
452 | 117 | <field name="name">Dimension values</field> | 115 | <field name="res_model">product.variant.dimension.value</field> |
449 | 118 | <field name="res_model">product.variant.dimension.value</field> | ||
453 | 119 | <field name="view_type">form</field> | 116 | <field name="view_type">form</field> |
455 | 120 | <field name="view_mode">tree,form</field> | 117 | <field name="view_mode">tree,form</field> |
456 | 121 | <field name="context">{'dimension_value_main_view': True}</field> | 118 | <field name="context">{'dimension_value_main_view': True}</field> |
467 | 122 | </record> | 119 | </record> |
468 | 123 | 120 | ||
469 | 124 | <!-- Views for Dimension types --> | 121 | |
470 | 125 | <record id="product_variant_multi_dimension_type_tree" model="ir.ui.view"> | 122 | <!-- DIMENSION TYPE --> |
471 | 126 | <field name="name">product.variant.multi.dimension.type.tree</field> | 123 | <record id="product_variant_multi_dimension_type_search" model="ir.ui.view"> |
472 | 127 | <field name="model">product.variant.dimension.type</field> | 124 | <field name="name">product.variant.multi.dimension.type.search</field> |
473 | 128 | <field name="type">tree</field> | 125 | <field name="model">product.variant.dimension.type</field> |
474 | 129 | <field name="arch" type="xml"> | 126 | <field name="arch" type="xml"> |
475 | 130 | <tree string="Dimension Types"> | 127 | <search string="Dimension Type Search"> |
476 | 131 | <field name="name" /> | 128 | <field name="name"/> |
477 | 129 | </search> | ||
478 | 130 | </field> | ||
479 | 131 | </record> | ||
480 | 132 | |||
481 | 133 | <record id="product_variant_multi_dimension_type_tree" model="ir.ui.view"> | ||
482 | 134 | <field name="name">product.variant.multi.dimension.type.tree</field> | ||
483 | 135 | <field name="model">product.variant.dimension.type</field> | ||
484 | 136 | <field name="arch" type="xml"> | ||
485 | 137 | <tree string="Dimension Types"> | ||
486 | 138 | <field name="name" /> | ||
487 | 132 | <field name="description" /> | 139 | <field name="description" /> |
519 | 133 | </tree> | 140 | </tree> |
520 | 134 | </field> | 141 | </field> |
521 | 135 | </record> | 142 | </record> |
522 | 136 | 143 | ||
523 | 137 | <record id="product_variant_multi_dimension_type_form" model="ir.ui.view"> | 144 | <record id="product_variant_multi_dimension_type_form" model="ir.ui.view"> |
524 | 138 | <field name="name">product.variant.multi.dimension.type.form</field> | 145 | <field name="name">product.variant.multi.dimension.type.form</field> |
525 | 139 | <field name="model">product.variant.dimension.type</field> | 146 | <field name="model">product.variant.dimension.type</field> |
526 | 140 | <field name="type">form</field> | 147 | <field name="arch" type="xml"> |
527 | 141 | <field name="arch" type="xml"> | 148 | <form string="Dimension Types" version="7.0"> |
528 | 142 | <form string="Dimension Types"> | 149 | <sheet> |
529 | 143 | <field name="name" select="1" /> | 150 | <div class="oe_title"> |
530 | 144 | <field name="description" select="2" /> | 151 | <label for="name" string="Dimension Type Name" class="oe_edit_only"/> |
531 | 145 | <field name="sequence" /> | 152 | <h1> |
532 | 146 | <field name="allow_custom_value" select="2" /> | 153 | <field name="name" /> |
533 | 147 | <field name="mandatory_dimension" select="2" /> | 154 | </h1> |
534 | 148 | <field name="option_ids" nolabel="1" colspan="4" > | 155 | </div> |
535 | 149 | <tree editable="bottom" string="Dimension Options"> | 156 | <group> |
536 | 150 | <field name="name" /> | 157 | <field name="description" /> |
537 | 151 | <field name="code" /> | 158 | <field name="sequence" /> |
538 | 152 | <field name="sequence" invisible="1"/> | 159 | <field name="allow_custom_value" /> |
539 | 153 | </tree> | 160 | <field name="mandatory_dimension" /> |
540 | 154 | </field> | 161 | <field name="option_ids" nolabel="1" colspan="4"/> |
541 | 155 | </form> | 162 | </group> |
542 | 156 | </field> | 163 | </sheet> |
543 | 157 | </record> | 164 | </form> |
544 | 158 | 165 | </field> | |
545 | 159 | 166 | </record> | |
546 | 160 | <!-- Default action for Dimension types --> | 167 | |
547 | 161 | <record id="action_dimension_type" model="ir.actions.act_window"> | 168 | |
548 | 162 | <field name="name">Dimension types</field> | 169 | <record id="action_dimension_type" model="ir.actions.act_window"> |
549 | 163 | <field name="res_model">product.variant.dimension.type</field> | 170 | <field name="name">Dimension Types</field> |
550 | 171 | <field name="res_model">product.variant.dimension.type</field> | ||
551 | 164 | <field name="view_type">form</field> | 172 | <field name="view_type">form</field> |
553 | 165 | <field name="view_mode">tree,form</field> | 173 | <field name="view_mode">tree,form</field> |
554 | 166 | <field name="context">{'dimension_type_main_view': True}</field> | 174 | <field name="context">{'dimension_type_main_view': True}</field> |
562 | 167 | </record> | 175 | </record> |
563 | 168 | 176 | ||
564 | 169 | <!-- Menu entry for dimension types --> | 177 | <menuitem id="menu_variant_dimension_types" parent="menu_variant_dimension" action="action_dimension_type" /> |
565 | 170 | <menuitem id="menu_variant_dimension_types" icon="STOCK_JUSTIFY_FILL" parent="menu_variant_dimension" action="action_dimension_type" /> | 178 | |
566 | 171 | 179 | ||
567 | 172 | 180 | <!-- PRODUCT TEMPLATE --> | |
561 | 173 | |||
568 | 174 | 181 | ||
569 | 175 | <!-- TODO remove useless view of product.template in the module product or fusion this view with the existing view in product, it's depend how the inheritage on this view will be managed by the other module--> | 182 | <!-- TODO remove useless view of product.template in the module product or fusion this view with the existing view in product, it's depend how the inheritage on this view will be managed by the other module--> |
570 | 176 | 183 | ||
573 | 177 | <!--TODO add a wizard to add the option--> | 184 | <!--TODO add a wizard to add the option--> |
574 | 178 | <!--<button name="add_some_option" string="Add " type="object" colspan="2"/>--> | 185 | <!--<button name="add_some_option" string="Add " type="object" colspan="2"/>--> |
575 | 179 | 186 | ||
576 | 180 | <record id="product_search_form_view_template" model="ir.ui.view"> | 187 | <record id="product_search_form_view_template" model="ir.ui.view"> |
577 | 181 | <field name="name">product.search.form.template</field> | 188 | <field name="name">product.search.form.template</field> |
578 | 182 | <field name="model">product.template</field> | 189 | <field name="model">product.template</field> |
579 | 183 | <field name="type">search</field> | ||
580 | 184 | <field name="arch" type="xml"> | 190 | <field name="arch" type="xml"> |
581 | 185 | <search string="Product Template"> | 191 | <search string="Product Template"> |
582 | 186 | <field name="name"/> | 192 | <field name="name"/> |
583 | @@ -188,55 +194,62 @@ | |||
584 | 188 | </field> | 194 | </field> |
585 | 189 | </record> | 195 | </record> |
586 | 190 | 196 | ||
587 | 191 | |||
588 | 192 | <record id="product_variant_multi_product_template_form_view" model="ir.ui.view"> | 197 | <record id="product_variant_multi_product_template_form_view" model="ir.ui.view"> |
589 | 193 | <field name="name">product.variant.multi.product.template.form</field> | 198 | <field name="name">product.variant.multi.product.template.form</field> |
590 | 194 | <field name="model">product.template</field> | 199 | <field name="model">product.template</field> |
591 | 195 | <field name="type">form</field> | ||
592 | 196 | <field name="inherit_id" ref="product.product_template_form_view" /> | 200 | <field name="inherit_id" ref="product.product_template_form_view" /> |
593 | 197 | <field name="arch" type="xml"> | 201 | <field name="arch" type="xml"> |
596 | 198 | <data> | 202 | <xpath expr="//field[@name='categ_id']/.." position="after"> |
597 | 199 | <field name="name" position="after"> | 203 | <group> |
598 | 200 | <field name="is_multi_variants"/> | 204 | <field name="is_multi_variants"/> |
629 | 201 | </field> | 205 | </group> |
630 | 202 | 206 | </xpath> | |
631 | 203 | <xpath expr="/form/notebook" position="inside"> | 207 | <xpath expr="//form/notebook" position="inside"> |
632 | 204 | <page string="Variants"> | 208 | <page string="Variants"> |
633 | 205 | <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> | 209 | <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
634 | 206 | <field name="dimension_type_ids" nolabel="1" colspan="4" /> | 210 | <field name="dimension_type_ids" nolabel="1" colspan="4" /> |
635 | 207 | <button name="add_all_option" string="Add All Option" type="object" colspan="2"/> | 211 | <button name="add_all_option" string="Add All Options" type="object" colspan="2"/> |
636 | 208 | <field name="value_ids" nolabel="1" colspan="4" /> | 212 | <field name="value_ids" nolabel="1" colspan="4" /> |
637 | 209 | </group> | 213 | <field name="variant_model_name" colspan="4"/> |
638 | 210 | <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> | 214 | <field name="variant_model_name_separator" colspan="4"/> |
639 | 211 | <field name="variant_model_name" colspan="4"/> | 215 | <field name="code_generator" colspan="4"/> |
640 | 212 | <field name="variant_model_name_separator" colspan="4"/> | 216 | <field name="variant_track_production" colspan="4"/> |
641 | 213 | <field name="code_generator" colspan="4"/> | 217 | <field name="variant_track_incoming" colspan="4"/> |
642 | 214 | <field name="variant_track_production" colspan="4"/> | 218 | <field name="variant_track_outgoing" colspan="4"/> |
643 | 215 | <field name="variant_track_incoming" colspan="4"/> | 219 | <field name="do_not_generate_new_variant" colspan="4"/> |
644 | 216 | <field name="variant_track_outgoing" colspan="4"/> | 220 | <field name="do_not_update_variant" colspan="4"/> |
645 | 217 | <field name="do_not_generate_new_variant" colspan="4"/> | 221 | <button name="button_generate_variants" string="Generate / Update Variants" type="object" colspan="4"/> |
646 | 218 | <field name="do_not_update_variant" colspan="4"/> | 222 | </group> |
647 | 219 | <button name="button_generate_variants" string="Generate / Update variants ->" type="object" colspan="4"/> | 223 | <field name="variant_ids" string="Variants" nolabel="1" colspan="1"> |
648 | 220 | </group> | 224 | <tree string="Variants"> |
649 | 221 | <field name="variant_ids" string="Variants" nolabel="1" colspan="1"> | 225 | <field name="code" /> |
650 | 222 | <tree string="Variants"> | 226 | <field name="name" /> |
651 | 223 | <field name="code" /> | 227 | <field name="variants" string="Dimension Values" /> |
652 | 224 | <field name="name" /> | 228 | </tree> |
653 | 225 | <field name="variants" string="Dimension Values" /> | 229 | </field> |
654 | 226 | </tree> | 230 | </page> |
655 | 227 | </field> | 231 | </xpath> |
626 | 228 | </page> | ||
627 | 229 | </xpath> | ||
628 | 230 | </data> | ||
656 | 231 | </field> | 232 | </field> |
657 | 232 | </record> | 233 | </record> |
659 | 233 | 234 | ||
660 | 235 | <record id="product_template" model="ir.actions.act_window"> | ||
661 | 236 | <field name="name">Product Templates</field> | ||
662 | 237 | <field name="res_model">product.template</field> | ||
663 | 238 | <field name="view_type">form</field> | ||
664 | 239 | <field name="domain">[('is_multi_variants','=',True)]</field> | ||
665 | 240 | <field name="view_mode">tree,form</field> | ||
666 | 241 | </record> | ||
667 | 242 | |||
668 | 243 | <menuitem action="product_template" id="menu_template" parent="product.prod_config_main" /> | ||
669 | 244 | |||
670 | 245 | |||
671 | 246 | <!-- PRODUCT VARIANTS --> | ||
672 | 247 | |||
673 | 234 | <!-- TODO remove useless view of product.product in the module product or move this correct view in product, it's depend how the heritage on this view will be managed by the other module --> | 248 | <!-- TODO remove useless view of product.product in the module product or move this correct view in product, it's depend how the heritage on this view will be managed by the other module --> |
674 | 235 | 249 | ||
675 | 236 | <record id="product_search_form_view_variants" model="ir.ui.view"> | 250 | <record id="product_search_form_view_variants" model="ir.ui.view"> |
676 | 237 | <field name="name">product.search.form.variants</field> | 251 | <field name="name">product.search.form.variants</field> |
677 | 238 | <field name="model">product.product</field> | 252 | <field name="model">product.product</field> |
678 | 239 | <field name="type">search</field> | ||
679 | 240 | <field name="inherit_id" ref="product.product_search_form_view"/> | 253 | <field name="inherit_id" ref="product.product_search_form_view"/> |
680 | 241 | <field name="arch" type="xml"> | 254 | <field name="arch" type="xml"> |
681 | 242 | <field name="categ_id" position="after"> | 255 | <field name="categ_id" position="after"> |
682 | @@ -249,40 +262,46 @@ | |||
683 | 249 | <record id="product_variant_form_view" model="ir.ui.view"> | 262 | <record id="product_variant_form_view" model="ir.ui.view"> |
684 | 250 | <field name="name">product.variant.form</field> | 263 | <field name="name">product.variant.form</field> |
685 | 251 | <field name="model">product.product</field> | 264 | <field name="model">product.product</field> |
686 | 252 | <field name="type">form</field> | ||
687 | 253 | <field name="arch" type="xml"> | 265 | <field name="arch" type="xml"> |
712 | 254 | <form string="Product Variant"> | 266 | <form string="Product Variant" version="7.0"> |
713 | 255 | <field name="name" select="1" required="1"/> | 267 | <sheet> |
714 | 256 | <field name="product_tmpl_id" select="1"/> | 268 | <div class="oe_title"> |
715 | 257 | <field name="variants" select="1"/> | 269 | <label for="name"/> |
716 | 258 | <field name="default_code" select="1"/> | 270 | <h1> |
717 | 259 | <field name="active" select="1"/> | 271 | <field name="name" required="1"/> |
718 | 260 | <newline /> | 272 | </h1> |
719 | 261 | <notebook colspan="4"> | 273 | <label for="product_tmpl_id"/> |
720 | 262 | <page string="Dimensions"> | 274 | <h2> |
721 | 263 | <separator string="Dimension Values" colspan="4"/> | 275 | <field name="product_tmpl_id" /> |
722 | 264 | <field name="dimension_value_ids" context="{'product_tmpl_id':product_tmpl_id}" nolabel="1" colspan="4"/> | 276 | </h2> |
723 | 265 | </page> | 277 | </div> |
724 | 266 | <page string="Price"> | 278 | <group> |
725 | 267 | <field name="list_price" string="Template Sale Price" readonly="1"/> | 279 | <field name="variants" /> |
726 | 268 | <field name="price_margin" select="1"/> | 280 | <field name="default_code" /> |
727 | 269 | <field name="price_extra" select="1"/> | 281 | <field name="active" /> |
728 | 270 | <field name="cost_price_extra"/> | 282 | </group> |
729 | 271 | </page> | 283 | <notebook colspan="4"> |
730 | 272 | <page string="Lots"> | 284 | <page string="Dimensions"> |
731 | 273 | <field name="track_production" /> | 285 | <separator string="Dimension Values" colspan="4"/> |
732 | 274 | <field name="track_incoming" /> | 286 | <field name="dimension_value_ids" context="{'product_tmpl_id':product_tmpl_id}" nolabel="1" colspan="4"/> |
733 | 275 | <field name="track_outgoing" /> | 287 | </page> |
734 | 276 | </page> | 288 | <page string="Prices"> |
735 | 277 | </notebook> | 289 | <group> |
736 | 290 | <field name="list_price" string="Template Sale Price" readonly="1"/> | ||
737 | 291 | <field name="price_margin" /> | ||
738 | 292 | <field name="price_extra" /> | ||
739 | 293 | <field name="cost_price_extra"/> | ||
740 | 294 | </group> | ||
741 | 295 | </page> | ||
742 | 296 | </notebook> | ||
743 | 297 | </sheet> | ||
744 | 278 | </form> | 298 | </form> |
745 | 279 | </field> | 299 | </field> |
746 | 280 | </record> | 300 | </record> |
748 | 281 | 301 | ||
749 | 282 | <record id="product_variant_tree_view" model="ir.ui.view"> | 302 | <record id="product_variant_tree_view" model="ir.ui.view"> |
750 | 283 | <field name="name">product.variant.tree</field> | 303 | <field name="name">product.variant.tree</field> |
751 | 284 | <field name="model">product.product</field> | 304 | <field name="model">product.product</field> |
752 | 285 | <field name="type">tree</field> | ||
753 | 286 | <field name="arch" type="xml"> | 305 | <field name="arch" type="xml"> |
754 | 287 | <tree string="Product Variant"> | 306 | <tree string="Product Variant"> |
755 | 288 | <field name="default_code"/> | 307 | <field name="default_code"/> |
756 | @@ -294,7 +313,14 @@ | |||
757 | 294 | </tree> | 313 | </tree> |
758 | 295 | </field> | 314 | </field> |
759 | 296 | </record> | 315 | </record> |
761 | 297 | 316 | ||
762 | 317 | <record id="product_variant" model="ir.actions.act_window"> | ||
763 | 318 | <field name="name">Product Variants</field> | ||
764 | 319 | <field name="res_model">product.product</field> | ||
765 | 320 | <field name="view_type">form</field> | ||
766 | 321 | <field name="view_mode">tree,form</field> | ||
767 | 322 | </record> | ||
768 | 323 | |||
769 | 298 | <record id="action_variant_tree" model="ir.actions.act_window.view"> | 324 | <record id="action_variant_tree" model="ir.actions.act_window.view"> |
770 | 299 | <field name="sequence" eval="10" /> | 325 | <field name="sequence" eval="10" /> |
771 | 300 | <field name="view_mode">tree</field> | 326 | <field name="view_mode">tree</field> |
772 | @@ -309,48 +335,47 @@ | |||
773 | 309 | <field name="view_id" ref="product_variant_form_view" /> | 335 | <field name="view_id" ref="product_variant_form_view" /> |
774 | 310 | </record> | 336 | </record> |
775 | 311 | 337 | ||
776 | 338 | <menuitem action="product_variant" id="menu_variant" parent="product.prod_config_main" /> | ||
777 | 339 | |||
778 | 312 | <record id="product_normal_variant_form_view" model="ir.ui.view"> | 340 | <record id="product_normal_variant_form_view" model="ir.ui.view"> |
779 | 313 | <field name="name">product.normal.variant.form</field> | 341 | <field name="name">product.normal.variant.form</field> |
780 | 314 | <field name="model">product.product</field> | 342 | <field name="model">product.product</field> |
781 | 315 | <field name="type">form</field> | ||
782 | 316 | <field name="inherit_id" ref="product.product_normal_form_view" /> | 343 | <field name="inherit_id" ref="product.product_normal_form_view" /> |
783 | 317 | <field name="arch" type="xml"> | 344 | <field name="arch" type="xml"> |
818 | 318 | <data> | 345 | <field name="name" position="attributes"> |
819 | 319 | <field name="name" position="attributes"> | 346 | <attribute name="required">1</attribute> |
820 | 320 | <attribute name="required">1</attribute> | 347 | </field> |
821 | 321 | </field> | 348 | <div name="options" position="inside"> |
822 | 322 | <field name="standard_price" position="replace"> | 349 | <field name="is_multi_variants" readonly="1"/> |
823 | 323 | <group name='cost_prices' colspan="2" col="4"> | 350 | <label for="is_multi_variants" /> |
824 | 324 | <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/> | 351 | </div> |
825 | 325 | <field name="cost_price_extra" groups="product.group_product_variant"/> | 352 | <field name="standard_price" position="replace"> |
826 | 326 | </group> | 353 | <group name='cost_prices' colspan="2" col="4"> |
827 | 327 | </field> | 354 | <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/> |
828 | 328 | <group col="2" colspan="2" groups="base.group_extended" position="replace"> | 355 | <field name="cost_price_extra" groups="product.group_product_variant"/> |
829 | 329 | <group colspan="2" col="6" name="weight" groups="base.group_extended"> | 356 | </group> |
830 | 330 | <field name="is_multi_variants" invisible="1"/> | 357 | </field> |
831 | 331 | <group colspan="2" col="2"> | 358 | <group name="Weights" position="replace"> |
832 | 332 | <separator string="Template Weights" colspan="2"/> | 359 | <group colspan="4" col="6" name="Weights" groups="product.group_stock_packaging"> |
833 | 333 | <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/> | 360 | <group name="template_weights" string="Template Weights"> |
834 | 334 | <field digits="(14, 3)" name="weight" attrs="{'readonly':[('type','=','service')]}"/> | 361 | <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/> |
835 | 335 | <field digits="(14, 3)" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/> | 362 | <field name="weight" attrs="{'readonly':[('type','=','service')]}"/> |
836 | 336 | </group> | 363 | <field name="weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
837 | 337 | <group colspan="2" col="2" attrs="{'invisible':[('is_multi_variants','=',False)]}"> | 364 | </group> |
838 | 338 | <separator string="Variant Weights" colspan="2"/> | 365 | <group name="variant_weights" string="Variant Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
839 | 339 | <field digits="(14, 3)" name="additional_volume" attrs="{'readonly':[('type','=','service')]}"/> | 366 | <field digits="(14, 3)" name="additional_volume" attrs="{'readonly':[('type','=','service')]}"/> |
840 | 340 | <field digits="(14, 3)" name="additional_weight" attrs="{'readonly':[('type','=','service')]}"/> | 367 | <field name="additional_weight" attrs="{'readonly':[('type','=','service')]}"/> |
841 | 341 | <field digits="(14, 3)" name="additional_weight_net" attrs="{'readonly':[('type','=','service')]}"/> | 368 | <field name="additional_weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
842 | 342 | </group> | 369 | </group> |
843 | 343 | <group colspan="2" col="2" attrs="{'invisible':[('is_multi_variants','=',False)]}"> | 370 | <group name="total_weights" string="Total Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
844 | 344 | <separator string="Total Weights" colspan="2"/> | 371 | <field digits="(14, 3)" name="total_volume"/> |
845 | 345 | <field digits="(14, 3)" name="total_volume"/> | 372 | <field name="total_weight"/> |
846 | 346 | <field digits="(14, 3)" name="total_weight"/> | 373 | <field name="total_weight_net"/> |
847 | 347 | <field digits="(14, 3)" name="total_weight_net"/> | 374 | </group> |
848 | 348 | </group> | 375 | </group> |
849 | 349 | </group> | 376 | </group> |
816 | 350 | </group> | ||
817 | 351 | </data> | ||
850 | 352 | </field> | 377 | </field> |
853 | 353 | </record> | 378 | </record> |
854 | 354 | 379 | ||
855 | 355 | </data> | 380 | </data> |
856 | 356 | </openerp> | 381 | </openerp> |
857 | 357 | 382 | ||
858 | === modified file 'product_variant_multi/security/ir.model.access.csv' | |||
859 | --- product_variant_multi/security/ir.model.access.csv 2012-05-16 05:08:08 +0000 | |||
860 | +++ product_variant_multi/security/ir.model.access.csv 2013-04-04 09:34:23 +0000 | |||
861 | @@ -5,6 +5,3 @@ | |||
862 | 5 | "access_product_variant_dimension_type_sale_manager","Full rights on product.variant.dimension.type for sale manager","model_product_variant_dimension_type","base.group_sale_manager",1,1,1,1 | 5 | "access_product_variant_dimension_type_sale_manager","Full rights on product.variant.dimension.type for sale manager","model_product_variant_dimension_type","base.group_sale_manager",1,1,1,1 |
863 | 6 | "access_product_variant_dimension_value_sale_manager","Full rights on product.variant.dimension.value for sale manager","model_product_variant_dimension_value","base.group_sale_manager",1,1,1,1 | 6 | "access_product_variant_dimension_value_sale_manager","Full rights on product.variant.dimension.value for sale manager","model_product_variant_dimension_value","base.group_sale_manager",1,1,1,1 |
864 | 7 | "access_product_variant_dimension_option_sale_manager","Full rights on product.variant.dimension.option for sale manager","model_product_variant_dimension_option","base.group_sale_manager",1,1,1,1 | 7 | "access_product_variant_dimension_option_sale_manager","Full rights on product.variant.dimension.option for sale manager","model_product_variant_dimension_option","base.group_sale_manager",1,1,1,1 |
865 | 8 | "access_product_variant_dimension_type_stock_manager","Full rights on product.variant.dimension.type for stock manager","model_product_variant_dimension_type","stock.group_stock_manager",1,1,1,1 | ||
866 | 9 | "access_product_variant_dimension_value_stock_manager","Full rights on product.variant.dimension.value for stock manager","model_product_variant_dimension_value","stock.group_stock_manager",1,1,1,1 | ||
867 | 10 | "access_product_variant_dimension_option_stock_manager","Full rights on product.variant.dimension.option for stock manager","model_product_variant_dimension_option","stock.group_stock_manager",1,1,1,1 |
v7.0 migration; work in progress
The XML part has been largely migrated and the dependency upon the stock module has finally been relaxed.
Sadly some strange infinite loops at the ORM level seems to occur so I disable the value_ids field in the product.template form view so far. Also adding some template dimension with a few option will also cause some infinite Python loop when saving...
The data model of the product variants is a bit complex, may be it's creating some kind of infinite recursion between the triggers of the several models involved, no idea yet. Feel free to help finish the migration or fix the OpenERP ORM bugs (there are likely).