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 | # -*- encoding: utf-8 -*- |
6 | ############################################################################## |
7 | # |
8 | -# OpenERP, Open Source Management Solution |
9 | +# OpenERP, Open Source Management Solution |
10 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
11 | -# $Id$ |
12 | +# Copyright (C) 2010-2013 Akretion (http://www.akretion.com) |
13 | # |
14 | # This program is free software: you can redistribute it and/or modify |
15 | # it under the terms of the GNU General Public License as published by |
16 | @@ -22,5 +22,3 @@ |
17 | |
18 | import product_variant |
19 | |
20 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
21 | - |
22 | |
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 | # -*- encoding: utf-8 -*- |
28 | ############################################################################## |
29 | # |
30 | -# OpenERP, Open Source Management Solution |
31 | +# OpenERP, Open Source Management Solution |
32 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
33 | -# $Id$ |
34 | +# Copyright (C) 2010-2013 Akretion (http://www.akretion.com) |
35 | # |
36 | # This program is free software: you can redistribute it and/or modify |
37 | # it under the terms of the GNU General Public License as published by |
38 | @@ -20,10 +20,12 @@ |
39 | # |
40 | ############################################################################## |
41 | { |
42 | - "name" : "Products with multi-level variants", |
43 | + "name" : "Product Variant Multi", |
44 | "version" : "1.0", |
45 | - "author" : "Tiny, Akretion", |
46 | - "category" : "Generic Modules/Inventory Control", |
47 | + "author" : "OpenERP SA, Akretion", |
48 | + "category" : "Sales Management", |
49 | + "license": "AGPL-3", |
50 | + "summary": "Products with multi-dimension variants", |
51 | "description":""" |
52 | Multi-axial varianted product support for OpenERP |
53 | ================================================= |
54 | @@ -57,19 +59,15 @@ |
55 | transparent as OpenERP modules try to get their properties like name from product.product |
56 | and only from product.template if not found on product.product. But at least you |
57 | will have been warned. |
58 | - |
59 | -The dependence to the stock module is weak, it's only there to be able to put the |
60 | -variant menu in the warehouse management sub-menu (sigh!). |
61 | """, |
62 | - "depends" : ["product", "stock"], |
63 | - "init_xml" : [], |
64 | - "demo_xml" : ["demo_data.xml"], |
65 | - "update_xml" : [ |
66 | + "depends" : ["product"], |
67 | + "demo" : ["demo_data.xml"], |
68 | + "data" : [ |
69 | "security/ir.model.access.csv", |
70 | "product_view.xml", |
71 | ], |
72 | + "application": True, |
73 | "active": False, |
74 | - "installable": True |
75 | + "installable": True, |
76 | } |
77 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
78 | |
79 | |
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 | # |
85 | # OpenERP, Open Source Management Solution |
86 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
87 | -# Copyright (C) 2010-2011 Akretion (www.akretion.com). All Rights Reserved |
88 | +# Copyright (C) 2010-2013 Akretion (www.akretion.com). All Rights Reserved |
89 | # @author Sebatien Beau <sebastien.beau@akretion.com> |
90 | # @author Raphaël Valyi <raphael.valyi@akretion.com> |
91 | # @author Alexis de Lattre <alexis.delattre@akretion.com> |
92 | @@ -24,11 +24,11 @@ |
93 | # |
94 | ############################################################################## |
95 | |
96 | -from osv import fields, osv |
97 | -import decimal_precision as dp |
98 | +from openerp.osv import fields, osv, orm |
99 | +import openerp.addons.decimal_precision as dp |
100 | # Lib to eval python code with security |
101 | -from tools.safe_eval import safe_eval |
102 | -from tools.translate import _ |
103 | +from openerp.tools.safe_eval import safe_eval |
104 | +from openerp.tools.translate import _ |
105 | |
106 | import logging |
107 | _logger = logging.getLogger(__name__) |
108 | @@ -36,22 +36,22 @@ |
109 | # |
110 | # Dimensions Definition |
111 | # |
112 | -class product_variant_dimension_type(osv.osv): |
113 | +class product_variant_dimension_type(osv.Model): |
114 | _name = "product.variant.dimension.type" |
115 | _description = "Dimension Type" |
116 | |
117 | _columns = { |
118 | 'description': fields.char('Description', size=64, translate=True), |
119 | - 'name' : fields.char('Dimension', size=64, required=True), |
120 | - 'sequence' : fields.integer('Sequence', help="The product 'variants' code will use this to order the dimension values"), |
121 | - 'option_ids' : fields.one2many('product.variant.dimension.option', 'dimension_id', 'Dimension Options'), |
122 | + 'name': fields.char('Dimension Type Name', size=64, required=True), |
123 | + 'sequence': fields.integer('Sequence', help="The product 'variants' code will use this to order the dimension values"), |
124 | + 'option_ids': fields.one2many('product.variant.dimension.option', 'dimension_id', 'Dimension Options'), |
125 | 'product_tmpl_id': fields.many2many('product.template', 'product_template_dimension_rel', 'dimension_id', 'template_id', 'Product Template'), |
126 | 'allow_custom_value': fields.boolean('Allow Custom Value', help="If true, custom values can be entered in the product configurator"), |
127 | 'mandatory_dimension': fields.boolean('Mandatory Dimension', help="If false, variant products will be created with and without this dimension"), |
128 | } |
129 | |
130 | _defaults = { |
131 | - 'mandatory_dimension': lambda * a: 1, |
132 | + 'mandatory_dimension': 1, |
133 | } |
134 | |
135 | _order = "sequence, name" |
136 | @@ -64,7 +64,7 @@ |
137 | product_variant_dimension_type() |
138 | |
139 | |
140 | -class product_variant_dimension_option(osv.osv): |
141 | +class product_variant_dimension_option(osv.Model): |
142 | _name = "product.variant.dimension.option" |
143 | _description = "Dimension Option" |
144 | |
145 | @@ -72,18 +72,18 @@ |
146 | return self.pool.get('product.variant.dimension.value').search(cr, uid, [('dimension_id', 'in', ids)], context=context) |
147 | |
148 | _columns = { |
149 | - 'name' : fields.char('Name', size=64, required=True), |
150 | - 'code' : fields.char('Code', size=64), |
151 | - 'sequence' : fields.integer('Sequence'), |
152 | - 'dimension_id' : fields.many2one('product.variant.dimension.type', 'Dimension Type', ondelete='cascade'), |
153 | + 'name': fields.char('Dimension Option Name', size=64, required=True), |
154 | + 'code': fields.char('Code', size=64), |
155 | + 'sequence': fields.integer('Sequence'), |
156 | + 'dimension_id': fields.many2one('product.variant.dimension.type', 'Dimension Type', ondelete='cascade'), |
157 | } |
158 | |
159 | - _order = "dimension_id, sequence, to_number(name, '')" |
160 | + _order = "dimension_id, sequence, name" |
161 | |
162 | product_variant_dimension_option() |
163 | |
164 | |
165 | -class product_variant_dimension_value(osv.osv): |
166 | +class product_variant_dimension_value(osv.Model): |
167 | _name = "product.variant.dimension.value" |
168 | _description = "Dimension Value" |
169 | |
170 | @@ -91,7 +91,7 @@ |
171 | for value in self.browse(cr, uid, ids, context=context): |
172 | if value.product_ids: |
173 | product_list = '\n - ' + '\n - '.join([product.name for product in value.product_ids]) |
174 | - 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))) |
175 | + 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 | return super(product_variant_dimension_value, self).unlink(cr, uid, ids, context) |
177 | |
178 | def _get_values_from_types(self, cr, uid, ids, context=None): |
179 | @@ -102,7 +102,7 @@ |
180 | |
181 | _columns = { |
182 | 'option_id' : fields.many2one('product.variant.dimension.option', 'Option', required=True), |
183 | - 'name': fields.related('option_id', 'name', type='char', relation='product.variant.dimension.option', string="Dimension value", readonly=True), |
184 | + 'name': fields.related('option_id', 'name', type='char', relation='product.variant.dimension.option', string="Dimension Value", readonly=True), |
185 | 'sequence' : fields.integer('Sequence'), |
186 | 'price_extra' : fields.float('Sale Price Extra', digits_compute=dp.get_precision('Sale Price')), |
187 | 'price_margin' : fields.float('Sale Price Margin', digits_compute=dp.get_precision('Sale Price')), |
188 | @@ -117,11 +117,11 @@ |
189 | 'product.variant.dimension.type': (_get_values_from_types, ['sequence'], 10), |
190 | }), |
191 | 'product_ids': fields.many2many('product.product', 'product_product_dimension_rel', 'dimension_id', 'product_id', 'Variant', readonly=True), |
192 | - 'active' : fields.boolean('Active?', help="If false, this value will be not use anymore for generating variant"), |
193 | + 'active' : fields.boolean('Active', help="If false, this value will not be used anymore to generate variants."), |
194 | } |
195 | |
196 | _defaults = { |
197 | - 'active': lambda * a: 1, |
198 | + 'active': True, |
199 | } |
200 | |
201 | _sql_constraints = [ ('opt_dim_tmpl_uniq', 'UNIQUE(option_id, dimension_id, product_tmpl_id)', |
202 | @@ -132,9 +132,11 @@ |
203 | product_variant_dimension_value() |
204 | |
205 | |
206 | -class product_template(osv.osv): |
207 | +class product_template(osv.Model): |
208 | _inherit = "product.template" |
209 | |
210 | + _order = "name" |
211 | + |
212 | _columns = { |
213 | 'name': fields.char('Name', size=128, translate=True, select=True), |
214 | '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 | '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 | 'variant_model_name_separator':fields.char('Variant Model Name Separator', size=64, help='Add a separator between the elements of the variant name'), |
218 | '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'), |
219 | - 'is_multi_variants' : fields.boolean('Is Multi Variants?'), |
220 | + 'is_multi_variants' : fields.boolean('Is Multi Variants'), |
221 | 'variant_track_production' : fields.boolean('Track Production Lots on variants ?'), |
222 | 'variant_track_incoming' : fields.boolean('Track Incoming Lots on variants ?'), |
223 | 'variant_track_outgoing' : fields.boolean('Track Outgoing Lots on variants ?'), |
224 | @@ -152,9 +154,9 @@ |
225 | } |
226 | |
227 | _defaults = { |
228 | - 'variant_model_name': lambda * a: '[_o.dimension_id.name_] - [_o.option_id.name_]', |
229 | - 'variant_model_name_separator': lambda * a: ' - ', |
230 | - 'is_multi_variants' : lambda * a: False, |
231 | + 'variant_model_name': '[_o.dimension_id.name_] - [_o.option_id.name_]', |
232 | + 'variant_model_name_separator': ' - ', |
233 | + 'is_multi_variants' : False, |
234 | 'code_generator' : "[_'-'.join([x.option_id.name for x in o.dimension_value_ids] or ['CONF'])_]", |
235 | } |
236 | |
237 | @@ -291,7 +293,7 @@ |
238 | product_template() |
239 | |
240 | |
241 | -class product_product(osv.osv): |
242 | +class product_product(osv.Model): |
243 | _inherit = "product.product" |
244 | |
245 | def init(self, cr): |
246 | @@ -352,15 +354,15 @@ |
247 | new_default_code = self.generate_product_code(cr, uid, product, product.product_tmpl_id.code_generator, context=context) |
248 | current_values = { |
249 | 'default_code': product.default_code, |
250 | - 'track_production': product.track_production, |
251 | - 'track_outgoing': product.track_outgoing, |
252 | - 'track_incoming': product.track_incoming, |
253 | +# 'track_production': product.track_production, |
254 | +# 'track_outgoing': product.track_outgoing, |
255 | +# 'track_incoming': product.track_incoming, |
256 | } |
257 | new_values = { |
258 | 'default_code': new_default_code, |
259 | - 'track_production': product.product_tmpl_id.variant_track_production, |
260 | - 'track_outgoing': product.product_tmpl_id.variant_track_outgoing, |
261 | - 'track_incoming': product.product_tmpl_id.variant_track_incoming, |
262 | +# 'track_production': product.product_tmpl_id.variant_track_production, |
263 | +# 'track_outgoing': product.product_tmpl_id.variant_track_outgoing, |
264 | +# 'track_incoming': product.product_tmpl_id.variant_track_incoming, |
265 | } |
266 | if new_values != current_values: |
267 | self.write(cr, uid, [product.id], new_values, context=context) |
268 | @@ -407,7 +409,7 @@ |
269 | buffer.append(value.dimension_id) |
270 | unique_set = set(buffer) |
271 | if len(unique_set) != len(buffer): |
272 | - raise osv.except_osv(_('Constraint error :'), _("On product '%s', there are several dimension values for the same dimension type.") % product.name) |
273 | + raise orm.except_orm(_('Constraint error :'), _("On product '%s', there are several dimension values for the same dimension type.") % product.name) |
274 | return True |
275 | |
276 | 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 | #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 | #indeed some field of the template have to be overwrited like weight, name, weight_net, volume. |
280 | #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 |
281 | - 'total_weight': fields.function(_product_compute_weight_volume, method=True, type='float', string='Gross weight', help="The gross weight in Kg.", multi='weight_volume'), |
282 | - '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'), |
283 | - 'total_volume': fields.function(_product_compute_weight_volume, method=True, type='float', string='Volume', help="The volume in m3.", multi='weight_volume'), |
284 | + '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 | + '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 | + 'total_volume': fields.function(_product_compute_weight_volume, method=True, type='float', string='Total Volume', help="The volume in m3.", multi='weight_volume'), |
287 | 'additional_weight': fields.float('Additional Gross weight', help="The additional gross weight in Kg."), |
288 | 'additional_weight_net': fields.float('Additional Net weight', help="The additional net weight in Kg."), |
289 | 'additional_volume': fields.float('Additional Volume', help="The additional volume in Kg."), |
290 | |
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 @@ |
295 | -<?xml version="1.0" ?> |
296 | +<?xml version="1.0" encoding="utf-8"?> |
297 | <openerp> |
298 | <data> |
299 | |
300 | @@ -10,35 +10,27 @@ |
301 | --> |
302 | |
303 | |
304 | - <record id="product_variant" model="ir.actions.act_window"> |
305 | - <field name="name">Product Variants</field> |
306 | - <field name="res_model">product.product</field> |
307 | - <field name="view_type">form</field> |
308 | - <field name="view_mode">tree,form</field> |
309 | - </record> |
310 | - |
311 | - <record id="product_template" model="ir.actions.act_window"> |
312 | - <field name="name">Product Templates</field> |
313 | - <field name="res_model">product.template</field> |
314 | - <field name="view_type">form</field> |
315 | - <field name="domain">[('is_multi_variants','=',True)]</field> |
316 | - <field name="view_mode">tree,form</field> |
317 | - </record> |
318 | - |
319 | - <menuitem action="product_template" id="menu_template" parent="stock.menu_stock_product" /> |
320 | - |
321 | - <menuitem action="product_variant" id="menu_variant" parent="stock.menu_stock_product" /> |
322 | - |
323 | - <menuitem name="Variant dimensions" id="menu_variant_dimension" parent="stock.menu_product_in_config_stock" /> |
324 | - |
325 | - <!-- Views from Dimension option --> |
326 | + <menuitem name="Variant Dimensions" id="menu_variant_dimension" parent="product.prod_config_main" /> |
327 | + |
328 | + |
329 | + <!-- DIMENSION OPTION --> |
330 | + <record id="product_variant_multi_dimension_option_seach" model="ir.ui.view"> |
331 | + <field name="name">product.variant.multi.dimension.option.search</field> |
332 | + <field name="model">product.variant.dimension.option</field> |
333 | + <field name="arch" type="xml"> |
334 | + <search string="Dimension Options Search"> |
335 | + <field name="name"/> |
336 | + <field name="dimension_id"/> |
337 | + </search> |
338 | + </field> |
339 | + </record> |
340 | + |
341 | <record id="product_variant_multi_dimension_option_tree" model="ir.ui.view"> |
342 | <field name="name">product.variant.multi.dimension.option.tree</field> |
343 | <field name="model">product.variant.dimension.option</field> |
344 | - <field name="type">tree</field> |
345 | <field name="arch" type="xml"> |
346 | - <tree string="Dimension Options"> |
347 | - <field name="dimension_id" invisible="not context.get('dimension_value_main_view', False)" /> |
348 | + <tree string="Dimension Options" editable="top"> |
349 | + <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" /> |
350 | <field name="name" /> |
351 | <field name="sequence" /> |
352 | <field name="code" /> |
353 | @@ -49,40 +41,47 @@ |
354 | <record id="product_variant_multi_dimension_option_form" model="ir.ui.view"> |
355 | <field name="name">product.variant.multi.dimension.option.form</field> |
356 | <field name="model">product.variant.dimension.option</field> |
357 | - <field name="type">form</field> |
358 | <field name="arch" type="xml"> |
359 | <form string="Dimension Options"> |
360 | - <field name="dimension_id" select="1" invisible="not context.get('dimension_option_main_view', False)" /> |
361 | + <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" /> |
362 | <newline /> |
363 | <field name="sequence" /> |
364 | - <field name="name" select="1" /> |
365 | + <field name="name" /> |
366 | <field name="code" /> |
367 | </form> |
368 | </field> |
369 | </record> |
370 | |
371 | - <!-- Default action for Dimension option --> |
372 | - <record id="action_dimension_option" model="ir.actions.act_window"> |
373 | - <field name="name">Dimension Options</field> |
374 | - <field name="res_model">product.variant.dimension.option</field> |
375 | + <record id="action_dimension_option" model="ir.actions.act_window"> |
376 | + <field name="name">Dimension Options</field> |
377 | + <field name="res_model">product.variant.dimension.option</field> |
378 | <field name="view_type">form</field> |
379 | - <field name="view_mode">tree,form</field> |
380 | + <field name="view_mode">tree,form</field> |
381 | <field name="context">{'dimension_option_main_view': True}</field> |
382 | - </record> |
383 | - |
384 | - <!-- Menu entry for Dimension values --> |
385 | - <menuitem id="menu_variant_dimension_option" icon="STOCK_JUSTIFY_FILL" parent="menu_variant_dimension" action="action_dimension_option" /> |
386 | - |
387 | - |
388 | - |
389 | - <!-- Views from Dimension values --> |
390 | + </record> |
391 | + |
392 | + <menuitem id="menu_variant_dimension_option" parent="menu_variant_dimension" action="action_dimension_option" /> |
393 | + |
394 | + |
395 | + <!-- DIMENSION VALUES --> |
396 | + <record id="product_variant_multi_dimension_value_search" model="ir.ui.view"> |
397 | + <field name="name">product.variant.multi.dimension.value.search</field> |
398 | + <field name="model">product.variant.dimension.value</field> |
399 | + <field name="arch" type="xml"> |
400 | + <search string="Dimension Values Search"> |
401 | + <field name="product_tmpl_id"/> |
402 | + <field name="option_id"/> |
403 | + </search> |
404 | + </field> |
405 | + </record> |
406 | + |
407 | + |
408 | <record id="product_variant_multi_dimension_value_tree" model="ir.ui.view"> |
409 | <field name="name">product.variant.multi.dimension.value.tree</field> |
410 | <field name="model">product.variant.dimension.value</field> |
411 | - <field name="type">tree</field> |
412 | <field name="arch" type="xml"> |
413 | - <tree string="Dimension values" editable="top"> |
414 | - <field name="product_tmpl_id" select="1" invisible="not context.get('dimension_value_main_view', False)" /> |
415 | + <tree string="Dimension Values" editable="top"> |
416 | + <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" /> |
417 | <field name="active" /> |
418 | <field name="dimension_id" /> |
419 | <field name="option_id" /> |
420 | @@ -96,91 +95,98 @@ |
421 | <record id="product_variant_multi_dimension_value_form" model="ir.ui.view"> |
422 | <field name="name">product.variant.multi.dimension.value.form</field> |
423 | <field name="model">product.variant.dimension.value</field> |
424 | - <field name="type">form</field> |
425 | <field name="arch" type="xml"> |
426 | - <form string="Dimension values"> |
427 | - <field name="product_tmpl_id" select="1" invisible="not context.get('dimension_value_main_view', False)" /> |
428 | + <form string="Dimension Values"> |
429 | + <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" /> |
430 | <field name="active" /> |
431 | <field name="dimension_id" /> |
432 | <newline /> |
433 | - <field name="option_id" select="1" /> |
434 | + <field name="option_id" /> |
435 | <field name="sequence" /> |
436 | - <field name="cost_price_extra" select="2" /> |
437 | - <field name="price_extra" select="2" /> |
438 | - <field name="price_margin" select="2" /> |
439 | + <field name="cost_price_extra" /> |
440 | + <field name="price_extra" /> |
441 | + <field name="price_margin" /> |
442 | </form> |
443 | </field> |
444 | </record> |
445 | |
446 | - <!-- Default action for Dimension values --> |
447 | - <record id="action_dimension_value" model="ir.actions.act_window"> |
448 | - <field name="name">Dimension values</field> |
449 | - <field name="res_model">product.variant.dimension.value</field> |
450 | + <record id="action_dimension_value" model="ir.actions.act_window"> |
451 | + <field name="name">Dimension values</field> |
452 | + <field name="res_model">product.variant.dimension.value</field> |
453 | <field name="view_type">form</field> |
454 | - <field name="view_mode">tree,form</field> |
455 | + <field name="view_mode">tree,form</field> |
456 | <field name="context">{'dimension_value_main_view': True}</field> |
457 | - </record> |
458 | - |
459 | - <!-- Views for Dimension types --> |
460 | - <record id="product_variant_multi_dimension_type_tree" model="ir.ui.view"> |
461 | - <field name="name">product.variant.multi.dimension.type.tree</field> |
462 | - <field name="model">product.variant.dimension.type</field> |
463 | - <field name="type">tree</field> |
464 | - <field name="arch" type="xml"> |
465 | - <tree string="Dimension Types"> |
466 | - <field name="name" /> |
467 | + </record> |
468 | + |
469 | + |
470 | + <!-- DIMENSION TYPE --> |
471 | + <record id="product_variant_multi_dimension_type_search" model="ir.ui.view"> |
472 | + <field name="name">product.variant.multi.dimension.type.search</field> |
473 | + <field name="model">product.variant.dimension.type</field> |
474 | + <field name="arch" type="xml"> |
475 | + <search string="Dimension Type Search"> |
476 | + <field name="name"/> |
477 | + </search> |
478 | + </field> |
479 | + </record> |
480 | + |
481 | + <record id="product_variant_multi_dimension_type_tree" model="ir.ui.view"> |
482 | + <field name="name">product.variant.multi.dimension.type.tree</field> |
483 | + <field name="model">product.variant.dimension.type</field> |
484 | + <field name="arch" type="xml"> |
485 | + <tree string="Dimension Types"> |
486 | + <field name="name" /> |
487 | <field name="description" /> |
488 | - </tree> |
489 | - </field> |
490 | - </record> |
491 | - |
492 | - <record id="product_variant_multi_dimension_type_form" model="ir.ui.view"> |
493 | - <field name="name">product.variant.multi.dimension.type.form</field> |
494 | - <field name="model">product.variant.dimension.type</field> |
495 | - <field name="type">form</field> |
496 | - <field name="arch" type="xml"> |
497 | - <form string="Dimension Types"> |
498 | - <field name="name" select="1" /> |
499 | - <field name="description" select="2" /> |
500 | - <field name="sequence" /> |
501 | - <field name="allow_custom_value" select="2" /> |
502 | - <field name="mandatory_dimension" select="2" /> |
503 | - <field name="option_ids" nolabel="1" colspan="4" > |
504 | - <tree editable="bottom" string="Dimension Options"> |
505 | - <field name="name" /> |
506 | - <field name="code" /> |
507 | - <field name="sequence" invisible="1"/> |
508 | - </tree> |
509 | - </field> |
510 | - </form> |
511 | - </field> |
512 | - </record> |
513 | - |
514 | - |
515 | - <!-- Default action for Dimension types --> |
516 | - <record id="action_dimension_type" model="ir.actions.act_window"> |
517 | - <field name="name">Dimension types</field> |
518 | - <field name="res_model">product.variant.dimension.type</field> |
519 | + </tree> |
520 | + </field> |
521 | + </record> |
522 | + |
523 | + <record id="product_variant_multi_dimension_type_form" model="ir.ui.view"> |
524 | + <field name="name">product.variant.multi.dimension.type.form</field> |
525 | + <field name="model">product.variant.dimension.type</field> |
526 | + <field name="arch" type="xml"> |
527 | + <form string="Dimension Types" version="7.0"> |
528 | + <sheet> |
529 | + <div class="oe_title"> |
530 | + <label for="name" string="Dimension Type Name" class="oe_edit_only"/> |
531 | + <h1> |
532 | + <field name="name" /> |
533 | + </h1> |
534 | + </div> |
535 | + <group> |
536 | + <field name="description" /> |
537 | + <field name="sequence" /> |
538 | + <field name="allow_custom_value" /> |
539 | + <field name="mandatory_dimension" /> |
540 | + <field name="option_ids" nolabel="1" colspan="4"/> |
541 | + </group> |
542 | + </sheet> |
543 | + </form> |
544 | + </field> |
545 | + </record> |
546 | + |
547 | + |
548 | + <record id="action_dimension_type" model="ir.actions.act_window"> |
549 | + <field name="name">Dimension Types</field> |
550 | + <field name="res_model">product.variant.dimension.type</field> |
551 | <field name="view_type">form</field> |
552 | - <field name="view_mode">tree,form</field> |
553 | + <field name="view_mode">tree,form</field> |
554 | <field name="context">{'dimension_type_main_view': True}</field> |
555 | - </record> |
556 | - |
557 | - <!-- Menu entry for dimension types --> |
558 | - <menuitem id="menu_variant_dimension_types" icon="STOCK_JUSTIFY_FILL" parent="menu_variant_dimension" action="action_dimension_type" /> |
559 | - |
560 | - |
561 | - |
562 | + </record> |
563 | + |
564 | + <menuitem id="menu_variant_dimension_types" parent="menu_variant_dimension" action="action_dimension_type" /> |
565 | + |
566 | + |
567 | + <!-- PRODUCT TEMPLATE --> |
568 | |
569 | <!-- 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 | |
571 | - <!--TODO add a wizard to add the option--> |
572 | - <!--<button name="add_some_option" string="Add " type="object" colspan="2"/>--> |
573 | +<!--TODO add a wizard to add the option--> |
574 | +<!--<button name="add_some_option" string="Add " type="object" colspan="2"/>--> |
575 | |
576 | <record id="product_search_form_view_template" model="ir.ui.view"> |
577 | <field name="name">product.search.form.template</field> |
578 | <field name="model">product.template</field> |
579 | - <field name="type">search</field> |
580 | <field name="arch" type="xml"> |
581 | <search string="Product Template"> |
582 | <field name="name"/> |
583 | @@ -188,55 +194,62 @@ |
584 | </field> |
585 | </record> |
586 | |
587 | - |
588 | <record id="product_variant_multi_product_template_form_view" model="ir.ui.view"> |
589 | <field name="name">product.variant.multi.product.template.form</field> |
590 | <field name="model">product.template</field> |
591 | - <field name="type">form</field> |
592 | <field name="inherit_id" ref="product.product_template_form_view" /> |
593 | <field name="arch" type="xml"> |
594 | - <data> |
595 | - <field name="name" position="after"> |
596 | + <xpath expr="//field[@name='categ_id']/.." position="after"> |
597 | + <group> |
598 | <field name="is_multi_variants"/> |
599 | - </field> |
600 | - |
601 | - <xpath expr="/form/notebook" position="inside"> |
602 | - <page string="Variants"> |
603 | - <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
604 | - <field name="dimension_type_ids" nolabel="1" colspan="4" /> |
605 | - <button name="add_all_option" string="Add All Option" type="object" colspan="2"/> |
606 | - <field name="value_ids" nolabel="1" colspan="4" /> |
607 | - </group> |
608 | - <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
609 | - <field name="variant_model_name" colspan="4"/> |
610 | - <field name="variant_model_name_separator" colspan="4"/> |
611 | - <field name="code_generator" colspan="4"/> |
612 | - <field name="variant_track_production" colspan="4"/> |
613 | - <field name="variant_track_incoming" colspan="4"/> |
614 | - <field name="variant_track_outgoing" colspan="4"/> |
615 | - <field name="do_not_generate_new_variant" colspan="4"/> |
616 | - <field name="do_not_update_variant" colspan="4"/> |
617 | - <button name="button_generate_variants" string="Generate / Update variants ->" type="object" colspan="4"/> |
618 | - </group> |
619 | - <field name="variant_ids" string="Variants" nolabel="1" colspan="1"> |
620 | - <tree string="Variants"> |
621 | - <field name="code" /> |
622 | - <field name="name" /> |
623 | - <field name="variants" string="Dimension Values" /> |
624 | - </tree> |
625 | - </field> |
626 | - </page> |
627 | - </xpath> |
628 | - </data> |
629 | + </group> |
630 | + </xpath> |
631 | + <xpath expr="//form/notebook" position="inside"> |
632 | + <page string="Variants"> |
633 | + <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
634 | + <field name="dimension_type_ids" nolabel="1" colspan="4" /> |
635 | + <button name="add_all_option" string="Add All Options" type="object" colspan="2"/> |
636 | + <field name="value_ids" nolabel="1" colspan="4" /> |
637 | + <field name="variant_model_name" colspan="4"/> |
638 | + <field name="variant_model_name_separator" colspan="4"/> |
639 | + <field name="code_generator" colspan="4"/> |
640 | + <field name="variant_track_production" colspan="4"/> |
641 | + <field name="variant_track_incoming" colspan="4"/> |
642 | + <field name="variant_track_outgoing" colspan="4"/> |
643 | + <field name="do_not_generate_new_variant" colspan="4"/> |
644 | + <field name="do_not_update_variant" colspan="4"/> |
645 | + <button name="button_generate_variants" string="Generate / Update Variants" type="object" colspan="4"/> |
646 | + </group> |
647 | + <field name="variant_ids" string="Variants" nolabel="1" colspan="1"> |
648 | + <tree string="Variants"> |
649 | + <field name="code" /> |
650 | + <field name="name" /> |
651 | + <field name="variants" string="Dimension Values" /> |
652 | + </tree> |
653 | + </field> |
654 | + </page> |
655 | + </xpath> |
656 | </field> |
657 | </record> |
658 | - |
659 | + |
660 | + <record id="product_template" model="ir.actions.act_window"> |
661 | + <field name="name">Product Templates</field> |
662 | + <field name="res_model">product.template</field> |
663 | + <field name="view_type">form</field> |
664 | + <field name="domain">[('is_multi_variants','=',True)]</field> |
665 | + <field name="view_mode">tree,form</field> |
666 | + </record> |
667 | + |
668 | + <menuitem action="product_template" id="menu_template" parent="product.prod_config_main" /> |
669 | + |
670 | + |
671 | + <!-- PRODUCT VARIANTS --> |
672 | + |
673 | <!-- 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 | |
675 | <record id="product_search_form_view_variants" model="ir.ui.view"> |
676 | <field name="name">product.search.form.variants</field> |
677 | <field name="model">product.product</field> |
678 | - <field name="type">search</field> |
679 | <field name="inherit_id" ref="product.product_search_form_view"/> |
680 | <field name="arch" type="xml"> |
681 | <field name="categ_id" position="after"> |
682 | @@ -249,40 +262,46 @@ |
683 | <record id="product_variant_form_view" model="ir.ui.view"> |
684 | <field name="name">product.variant.form</field> |
685 | <field name="model">product.product</field> |
686 | - <field name="type">form</field> |
687 | <field name="arch" type="xml"> |
688 | - <form string="Product Variant"> |
689 | - <field name="name" select="1" required="1"/> |
690 | - <field name="product_tmpl_id" select="1"/> |
691 | - <field name="variants" select="1"/> |
692 | - <field name="default_code" select="1"/> |
693 | - <field name="active" select="1"/> |
694 | - <newline /> |
695 | - <notebook colspan="4"> |
696 | - <page string="Dimensions"> |
697 | - <separator string="Dimension Values" colspan="4"/> |
698 | - <field name="dimension_value_ids" context="{'product_tmpl_id':product_tmpl_id}" nolabel="1" colspan="4"/> |
699 | - </page> |
700 | - <page string="Price"> |
701 | - <field name="list_price" string="Template Sale Price" readonly="1"/> |
702 | - <field name="price_margin" select="1"/> |
703 | - <field name="price_extra" select="1"/> |
704 | - <field name="cost_price_extra"/> |
705 | - </page> |
706 | - <page string="Lots"> |
707 | - <field name="track_production" /> |
708 | - <field name="track_incoming" /> |
709 | - <field name="track_outgoing" /> |
710 | - </page> |
711 | - </notebook> |
712 | + <form string="Product Variant" version="7.0"> |
713 | + <sheet> |
714 | + <div class="oe_title"> |
715 | + <label for="name"/> |
716 | + <h1> |
717 | + <field name="name" required="1"/> |
718 | + </h1> |
719 | + <label for="product_tmpl_id"/> |
720 | + <h2> |
721 | + <field name="product_tmpl_id" /> |
722 | + </h2> |
723 | + </div> |
724 | + <group> |
725 | + <field name="variants" /> |
726 | + <field name="default_code" /> |
727 | + <field name="active" /> |
728 | + </group> |
729 | + <notebook colspan="4"> |
730 | + <page string="Dimensions"> |
731 | + <separator string="Dimension Values" colspan="4"/> |
732 | + <field name="dimension_value_ids" context="{'product_tmpl_id':product_tmpl_id}" nolabel="1" colspan="4"/> |
733 | + </page> |
734 | + <page string="Prices"> |
735 | + <group> |
736 | + <field name="list_price" string="Template Sale Price" readonly="1"/> |
737 | + <field name="price_margin" /> |
738 | + <field name="price_extra" /> |
739 | + <field name="cost_price_extra"/> |
740 | + </group> |
741 | + </page> |
742 | + </notebook> |
743 | + </sheet> |
744 | </form> |
745 | </field> |
746 | </record> |
747 | - |
748 | + |
749 | <record id="product_variant_tree_view" model="ir.ui.view"> |
750 | <field name="name">product.variant.tree</field> |
751 | <field name="model">product.product</field> |
752 | - <field name="type">tree</field> |
753 | <field name="arch" type="xml"> |
754 | <tree string="Product Variant"> |
755 | <field name="default_code"/> |
756 | @@ -294,7 +313,14 @@ |
757 | </tree> |
758 | </field> |
759 | </record> |
760 | - |
761 | + |
762 | + <record id="product_variant" model="ir.actions.act_window"> |
763 | + <field name="name">Product Variants</field> |
764 | + <field name="res_model">product.product</field> |
765 | + <field name="view_type">form</field> |
766 | + <field name="view_mode">tree,form</field> |
767 | + </record> |
768 | + |
769 | <record id="action_variant_tree" model="ir.actions.act_window.view"> |
770 | <field name="sequence" eval="10" /> |
771 | <field name="view_mode">tree</field> |
772 | @@ -309,48 +335,47 @@ |
773 | <field name="view_id" ref="product_variant_form_view" /> |
774 | </record> |
775 | |
776 | + <menuitem action="product_variant" id="menu_variant" parent="product.prod_config_main" /> |
777 | + |
778 | <record id="product_normal_variant_form_view" model="ir.ui.view"> |
779 | <field name="name">product.normal.variant.form</field> |
780 | <field name="model">product.product</field> |
781 | - <field name="type">form</field> |
782 | <field name="inherit_id" ref="product.product_normal_form_view" /> |
783 | <field name="arch" type="xml"> |
784 | - <data> |
785 | - <field name="name" position="attributes"> |
786 | - <attribute name="required">1</attribute> |
787 | - </field> |
788 | - <field name="standard_price" position="replace"> |
789 | - <group name='cost_prices' colspan="2" col="4"> |
790 | - <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/> |
791 | - <field name="cost_price_extra" groups="product.group_product_variant"/> |
792 | - </group> |
793 | - </field> |
794 | - <group col="2" colspan="2" groups="base.group_extended" position="replace"> |
795 | - <group colspan="2" col="6" name="weight" groups="base.group_extended"> |
796 | - <field name="is_multi_variants" invisible="1"/> |
797 | - <group colspan="2" col="2"> |
798 | - <separator string="Template Weights" colspan="2"/> |
799 | - <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/> |
800 | - <field digits="(14, 3)" name="weight" attrs="{'readonly':[('type','=','service')]}"/> |
801 | - <field digits="(14, 3)" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
802 | - </group> |
803 | - <group colspan="2" col="2" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
804 | - <separator string="Variant Weights" colspan="2"/> |
805 | - <field digits="(14, 3)" name="additional_volume" attrs="{'readonly':[('type','=','service')]}"/> |
806 | - <field digits="(14, 3)" name="additional_weight" attrs="{'readonly':[('type','=','service')]}"/> |
807 | - <field digits="(14, 3)" name="additional_weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
808 | - </group> |
809 | - <group colspan="2" col="2" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
810 | - <separator string="Total Weights" colspan="2"/> |
811 | - <field digits="(14, 3)" name="total_volume"/> |
812 | - <field digits="(14, 3)" name="total_weight"/> |
813 | - <field digits="(14, 3)" name="total_weight_net"/> |
814 | - </group> |
815 | - </group> |
816 | - </group> |
817 | - </data> |
818 | + <field name="name" position="attributes"> |
819 | + <attribute name="required">1</attribute> |
820 | + </field> |
821 | + <div name="options" position="inside"> |
822 | + <field name="is_multi_variants" readonly="1"/> |
823 | + <label for="is_multi_variants" /> |
824 | + </div> |
825 | + <field name="standard_price" position="replace"> |
826 | + <group name='cost_prices' colspan="2" col="4"> |
827 | + <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/> |
828 | + <field name="cost_price_extra" groups="product.group_product_variant"/> |
829 | + </group> |
830 | + </field> |
831 | + <group name="Weights" position="replace"> |
832 | + <group colspan="4" col="6" name="Weights" groups="product.group_stock_packaging"> |
833 | + <group name="template_weights" string="Template Weights"> |
834 | + <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/> |
835 | + <field name="weight" attrs="{'readonly':[('type','=','service')]}"/> |
836 | + <field name="weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
837 | + </group> |
838 | + <group name="variant_weights" string="Variant Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
839 | + <field digits="(14, 3)" name="additional_volume" attrs="{'readonly':[('type','=','service')]}"/> |
840 | + <field name="additional_weight" attrs="{'readonly':[('type','=','service')]}"/> |
841 | + <field name="additional_weight_net" attrs="{'readonly':[('type','=','service')]}"/> |
842 | + </group> |
843 | + <group name="total_weights" string="Total Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}"> |
844 | + <field digits="(14, 3)" name="total_volume"/> |
845 | + <field name="total_weight"/> |
846 | + <field name="total_weight_net"/> |
847 | + </group> |
848 | + </group> |
849 | + </group> |
850 | </field> |
851 | - </record> |
852 | - |
853 | + </record> |
854 | + |
855 | </data> |
856 | </openerp> |
857 | |
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 | "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 | "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 | "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 | -"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 | -"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 | -"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).