Merge lp:~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price into lp:~product-core-editors/openerp-product-attributes/7.0
- 7.0-product_pricelist_fixed_price
- Merge into 7.0
Status: | Merged |
---|---|
Approved by: | Ronald Portier (Therp) |
Approved revision: | 232 |
Merged at revision: | 234 |
Proposed branch: | lp:~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price |
Merge into: | lp:~product-core-editors/openerp-product-attributes/7.0 |
Diff against target: |
918 lines (+197/-598) 13 files modified
product_pricelist_fixed_price/AUTHORS.txt (+0/-1) product_pricelist_fixed_price/__init__.py (+5/-9) product_pricelist_fixed_price/__openerp__.py (+29/-20) product_pricelist_fixed_price/i18n/ca.po (+0/-65) product_pricelist_fixed_price/i18n/de.po (+0/-65) product_pricelist_fixed_price/i18n/es.po (+35/-52) product_pricelist_fixed_price/i18n/it.po (+0/-64) product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot (+23/-35) product_pricelist_fixed_price/model/__init__.py (+19/-0) product_pricelist_fixed_price/model/product_pricelist_item.py (+51/-0) product_pricelist_fixed_price/pricelist.py (+0/-211) product_pricelist_fixed_price/pricelist_view.xml (+0/-76) product_pricelist_fixed_price/view/product_pricelist_item_view.xml (+35/-0) |
To merge this branch: | bzr merge lp:~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ronald Portier (Therp) (community) | Approve | ||
Yannick Vaucher @ Camptocamp | code review, no tests | Approve | |
Lorenzo Battistini (community) | code review | Approve | |
Niels Huylebroeck (community) | Approve | ||
Lionel Sausin - Initiatives/Numérigraphe (community) | Needs Information | ||
Review via email: mp+205045@code.launchpad.net |
Commit message
Description of the change
This is the module product_
This only has one drawback: if you install it when you have some pricelists created, when you go to the pricelist form, based on field will be empty for these pricelists (although the behaviour won't break).
- 231. By Pedro Manuel Baeza
-
[ADD] product_
pricelist_ fixed_price: New module for fixed prices on pricelists, rewritten from scratch with a new approach.
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote : | # |
Pedro Manuel Baeza (pedro.baeza) wrote : | # |
Hi, Lionel,
Indeed, you have to adjust all fields by XML-RPC, but that's the same flaw of all OpenERP objects (for example, on invoices, you don't get automatically filled all the account related fields when you write partner_id as if you were introducing it on web client).
You have two options:
- Fill complete dictionary with base=1, base_ext=-3, price_discount=-1 and price_surchage=
- Fill base_ext=-3 and price_surchage=
As you have seen, the "New Price = Base Price * (1 - 1) + price" trick is used.
Regards.
Marc Pierlot (mpierlot) wrote : | # |
Bonjour
Est ce que quelqu'un peu me dire ce que je dos faire pour ne plus recevoir
ces messages de Open ERP qui m embetetent merci de ne plus me les envoyer
Tcau.
2014-02-06 11:08 GMT+01:00 Pedro Manuel Baeza <email address hidden>:
> Hi, Lionel,
>
> Indeed, you have to adjust all fields by XML-RPC, but that's the same flaw
> of all OpenERP objects (for example, on invoices, you don't get
> automatically filled all the account related fields when you write
> partner_id as if you were introducing it on web client).
>
> You have two options:
>
> - Fill complete dictionary with base=1, base_ext=-3, price_discount=-1 and
> price_surchage=
> - Fill base_ext=-3 and price_surchage=
> on_change method and update dictionary with the returned value.
>
> As you have seen, the "New Price = Base Price * (1 - 1) + price" trick is
> used.
>
> Regards.
> --
>
> https:/
> Your team OpenERP Community is subscribed to branch
> lp:openerp-product-attributes.
>
> _______
> Mailing list: https:/
> Post to : <email address hidden>
> Unsubscribe : https:/
> More help : https:/
>
Niels Huylebroeck (red15) wrote : | # |
Looks very good to me, this is a clean restructuring of this module that avoids copying large chunks of openerp code to change some behaviour.
Niels Huylebroeck (red15) wrote : | # |
> What happens if on_change() is not executed (for example records are added
> through XML-RPC)? The 100% discount will not be applied will it?
It's the responsibility of the client to call on_change over XML-RPC (or whatever channel your client is currently using) to get proper behaviour. This is something OpenERP has never been shy about using it in this way (just look at all the voucher and accounting tricks they use)
Lorenzo Battistini (elbati) : | # |
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
Linked bug report
LGTM
Good work
As it was completely refactored we will need to change version in __openerp__.py to 2.0
I add Ronald Portier as reviewer so he can have a look at it. As it superseed https:/
- 232. By Pedro Manuel Baeza
-
[IMP] product_
pricelist_ fixed_price: New version and improved description.
Pedro Manuel Baeza (pedro.baeza) wrote : | # |
I have changed version number and improve the module description.
Regards.
Ronald Portier (Therp) (rportier1962) wrote : | # |
Hello,
I think it is a pity the code does not work through xml-rpc because in its present form it completely depends on the on-change event. This problem did not exist in my original proposal.
On the other hand, the way a new fixed price type is added by Pedro is quite elegant.
In my proposal there was also a special view for fixed price types. This view is definitely not needed for everyone.
I agree to proceed with merging Pedro's code.
In a later stage - as soon as I have the time - I will propose an update that will take care of xml-rpc calls. But based on Pedro's method.
I also would like to propose a separate module that will add some special views for fixed prices, complete with the functionality requested by some to set the prices from the list.
Preview Diff
1 | === removed file 'product_pricelist_fixed_price/AUTHORS.txt' |
2 | --- product_pricelist_fixed_price/AUTHORS.txt 2011-04-01 10:14:05 +0000 |
3 | +++ product_pricelist_fixed_price/AUTHORS.txt 1970-01-01 00:00:00 +0000 |
4 | @@ -1,1 +0,0 @@ |
5 | -Lorenzo Battistini <lorenzo.battistini@domsense.com> |
6 | |
7 | === modified file 'product_pricelist_fixed_price/__init__.py' |
8 | --- product_pricelist_fixed_price/__init__.py 2011-04-01 10:14:05 +0000 |
9 | +++ product_pricelist_fixed_price/__init__.py 2014-02-24 14:37:37 +0000 |
10 | @@ -1,13 +1,10 @@ |
11 | -# -*- encoding: utf-8 -*- |
12 | +# -*- coding: utf-8 -*- |
13 | ############################################################################## |
14 | # |
15 | -# OpenERP, Open Source Management Solution |
16 | -# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>). |
17 | -# |
18 | # This program is free software: you can redistribute it and/or modify |
19 | -# it under the terms of the GNU Affero General Public License as |
20 | -# published by the Free Software Foundation, either version 3 of the |
21 | -# License, or (at your option) any later version. |
22 | +# it under the terms of the GNU Affero General Public License as published |
23 | +# by the Free Software Foundation, either version 3 of the License, or |
24 | +# (at your option) any later version. |
25 | # |
26 | # This program is distributed in the hope that it will be useful, |
27 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
28 | @@ -18,5 +15,4 @@ |
29 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
30 | # |
31 | ############################################################################## |
32 | - |
33 | -import pricelist |
34 | +from . import model |
35 | |
36 | === modified file 'product_pricelist_fixed_price/__openerp__.py' |
37 | --- product_pricelist_fixed_price/__openerp__.py 2013-01-21 06:49:06 +0000 |
38 | +++ product_pricelist_fixed_price/__openerp__.py 2014-02-24 14:37:37 +0000 |
39 | @@ -1,13 +1,14 @@ |
40 | -# -*- encoding: utf-8 -*- |
41 | +# -*- coding: utf-8 -*- |
42 | ############################################################################## |
43 | # |
44 | # OpenERP, Open Source Management Solution |
45 | -# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>). |
46 | +# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) |
47 | +# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> |
48 | # |
49 | # This program is free software: you can redistribute it and/or modify |
50 | -# it under the terms of the GNU Affero General Public License as |
51 | -# published by the Free Software Foundation, either version 3 of the |
52 | -# License, or (at your option) any later version. |
53 | +# it under the terms of the GNU Affero General Public License as published |
54 | +# by the Free Software Foundation, either version 3 of the License, or |
55 | +# (at your option) any later version. |
56 | # |
57 | # This program is distributed in the hope that it will be useful, |
58 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
59 | @@ -19,20 +20,28 @@ |
60 | # |
61 | ############################################################################## |
62 | |
63 | - |
64 | { |
65 | - "name": "Price List Fixed Price", |
66 | - "version": "1.0", |
67 | - 'category': 'Generic Modules/Inventory Control', |
68 | - "depends": ["product"], |
69 | - "author": "Agile Business Group & Domsense", |
70 | - "description": """This module allows to specify a fixed price for price list rules. So, if the rule is based on 'fixed price', this price will be used without any computation""", |
71 | - 'website': 'http://www.agilebg.com', |
72 | - 'init_xml': [], |
73 | - 'update_xml': [ |
74 | - 'pricelist_view.xml', |
75 | - ], |
76 | - 'demo_xml': [], |
77 | - 'installable': False, |
78 | - 'active': False, |
79 | + "name": "Fixed price in pricelists", |
80 | + "version": "2.0", |
81 | + "author": "Serv. Tecnol. Avanzados - Pedro M. Baeza", |
82 | + "category": "Sales Management", |
83 | + "description": """ |
84 | +Fixed price on pricelist rule |
85 | +============================= |
86 | + |
87 | +Adds a new option on pricelist rules to set a fixed price. This is made using |
88 | +a trick that writes on the back 100% in the discount to the base price to get |
89 | +a zero base that will add only the price we put in the surcharge price. |
90 | + """, |
91 | + "website": "www.serviciosbaeza.com", |
92 | + "license": "AGPL-3", |
93 | + "depends": [ |
94 | + "product", |
95 | + ], |
96 | + "demo": [], |
97 | + "data": [ |
98 | + 'view/product_pricelist_item_view.xml', |
99 | + ], |
100 | + "installable": True, |
101 | + "active": False, |
102 | } |
103 | |
104 | === removed file 'product_pricelist_fixed_price/i18n/ca.po' |
105 | --- product_pricelist_fixed_price/i18n/ca.po 2012-12-05 05:42:11 +0000 |
106 | +++ product_pricelist_fixed_price/i18n/ca.po 1970-01-01 00:00:00 +0000 |
107 | @@ -1,65 +0,0 @@ |
108 | -# Catalan translation for openobject-addons |
109 | -# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012 |
110 | -# This file is distributed under the same license as the openobject-addons package. |
111 | -# FIRST AUTHOR <EMAIL@ADDRESS>, 2012. |
112 | -# |
113 | -msgid "" |
114 | -msgstr "" |
115 | -"Project-Id-Version: openobject-addons\n" |
116 | -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
117 | -"POT-Creation-Date: 2011-03-25 10:08+0000\n" |
118 | -"PO-Revision-Date: 2012-04-18 23:39+0000\n" |
119 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
120 | -"Language-Team: Catalan <ca@li.org>\n" |
121 | -"MIME-Version: 1.0\n" |
122 | -"Content-Type: text/plain; charset=UTF-8\n" |
123 | -"Content-Transfer-Encoding: 8bit\n" |
124 | -"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n" |
125 | -"X-Generator: Launchpad (build 16335)\n" |
126 | - |
127 | -#. module: product_pricelist_fixed_price |
128 | -#: view:product.pricelist.item:0 |
129 | -msgid "Max. Margin" |
130 | -msgstr "Marge mà xim" |
131 | - |
132 | -#. module: product_pricelist_fixed_price |
133 | -#: view:product.pricelist.item:0 |
134 | -msgid "Min. Margin" |
135 | -msgstr "Marge mÃnim" |
136 | - |
137 | -#. module: product_pricelist_fixed_price |
138 | -#: view:product.pricelist.item:0 |
139 | -msgid "Rounding Method" |
140 | -msgstr "Mètode arrodoniment" |
141 | - |
142 | -#. module: product_pricelist_fixed_price |
143 | -#: constraint:product.pricelist.item:0 |
144 | -msgid "" |
145 | -"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList " |
146 | -"Item!" |
147 | -msgstr "" |
148 | -"Error! No podeu assignar la tarifa principal com una altre tarifa en un " |
149 | -"element de la tarifa." |
150 | - |
151 | -#. module: product_pricelist_fixed_price |
152 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist |
153 | -msgid "Pricelist" |
154 | -msgstr "Tarifa" |
155 | - |
156 | -#. module: product_pricelist_fixed_price |
157 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:97 |
158 | -#, python-format |
159 | -msgid "Warning !" |
160 | -msgstr "Atenció!" |
161 | - |
162 | -#. module: product_pricelist_fixed_price |
163 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item |
164 | -msgid "Pricelist item" |
165 | -msgstr "Element de la tarifa" |
166 | - |
167 | -#. module: product_pricelist_fixed_price |
168 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:32 |
169 | -#: field:product.pricelist.item,fixed_price:0 |
170 | -#, python-format |
171 | -msgid "Fixed Price" |
172 | -msgstr "Preu fix" |
173 | |
174 | === removed file 'product_pricelist_fixed_price/i18n/de.po' |
175 | --- product_pricelist_fixed_price/i18n/de.po 2012-12-05 05:42:11 +0000 |
176 | +++ product_pricelist_fixed_price/i18n/de.po 1970-01-01 00:00:00 +0000 |
177 | @@ -1,65 +0,0 @@ |
178 | -# German translation for openobject-addons |
179 | -# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 |
180 | -# This file is distributed under the same license as the openobject-addons package. |
181 | -# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. |
182 | -# |
183 | -msgid "" |
184 | -msgstr "" |
185 | -"Project-Id-Version: openobject-addons\n" |
186 | -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
187 | -"POT-Creation-Date: 2011-03-25 10:08+0000\n" |
188 | -"PO-Revision-Date: 2011-05-02 07:47+0000\n" |
189 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
190 | -"Language-Team: German <de@li.org>\n" |
191 | -"MIME-Version: 1.0\n" |
192 | -"Content-Type: text/plain; charset=UTF-8\n" |
193 | -"Content-Transfer-Encoding: 8bit\n" |
194 | -"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n" |
195 | -"X-Generator: Launchpad (build 16335)\n" |
196 | - |
197 | -#. module: product_pricelist_fixed_price |
198 | -#: view:product.pricelist.item:0 |
199 | -msgid "Max. Margin" |
200 | -msgstr "Max. Spanne" |
201 | - |
202 | -#. module: product_pricelist_fixed_price |
203 | -#: view:product.pricelist.item:0 |
204 | -msgid "Min. Margin" |
205 | -msgstr "Min. Spanne" |
206 | - |
207 | -#. module: product_pricelist_fixed_price |
208 | -#: view:product.pricelist.item:0 |
209 | -msgid "Rounding Method" |
210 | -msgstr "Rundungsverfahren" |
211 | - |
212 | -#. module: product_pricelist_fixed_price |
213 | -#: constraint:product.pricelist.item:0 |
214 | -msgid "" |
215 | -"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList " |
216 | -"Item!" |
217 | -msgstr "" |
218 | -"Fehler! Sie können die Basispreisliste nicht als alternative Preisliste in " |
219 | -"einem Preislisteneintrag zuweisen." |
220 | - |
221 | -#. module: product_pricelist_fixed_price |
222 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist |
223 | -msgid "Pricelist" |
224 | -msgstr "Preisliste" |
225 | - |
226 | -#. module: product_pricelist_fixed_price |
227 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:97 |
228 | -#, python-format |
229 | -msgid "Warning !" |
230 | -msgstr "Warnung!" |
231 | - |
232 | -#. module: product_pricelist_fixed_price |
233 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item |
234 | -msgid "Pricelist item" |
235 | -msgstr "Preisliste Einzelposition" |
236 | - |
237 | -#. module: product_pricelist_fixed_price |
238 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:32 |
239 | -#: field:product.pricelist.item,fixed_price:0 |
240 | -#, python-format |
241 | -msgid "Fixed Price" |
242 | -msgstr "Festpreis" |
243 | |
244 | === modified file 'product_pricelist_fixed_price/i18n/es.po' |
245 | --- product_pricelist_fixed_price/i18n/es.po 2012-12-05 05:42:11 +0000 |
246 | +++ product_pricelist_fixed_price/i18n/es.po 2014-02-24 14:37:37 +0000 |
247 | @@ -1,65 +1,48 @@ |
248 | -# Spanish translation for openobject-addons |
249 | -# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 |
250 | -# This file is distributed under the same license as the openobject-addons package. |
251 | -# FIRST AUTHOR <EMAIL@ADDRESS>, 2011. |
252 | +# Translation of OpenERP Server. |
253 | +# This file contains the translation of the following modules: |
254 | +# * product_pricelist_fixed_price |
255 | # |
256 | msgid "" |
257 | msgstr "" |
258 | -"Project-Id-Version: openobject-addons\n" |
259 | -"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
260 | -"POT-Creation-Date: 2011-03-25 10:08+0000\n" |
261 | -"PO-Revision-Date: 2011-08-26 23:18+0000\n" |
262 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
263 | -"Language-Team: Spanish <es@li.org>\n" |
264 | +"Project-Id-Version: OpenERP Server 7.0\n" |
265 | +"Report-Msgid-Bugs-To: \n" |
266 | +"POT-Creation-Date: 2014-02-05 20:35+0000\n" |
267 | +"PO-Revision-Date: 2014-02-05 21:36+0100\n" |
268 | +"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n" |
269 | +"Language-Team: \n" |
270 | "MIME-Version: 1.0\n" |
271 | "Content-Type: text/plain; charset=UTF-8\n" |
272 | "Content-Transfer-Encoding: 8bit\n" |
273 | -"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n" |
274 | -"X-Generator: Launchpad (build 16335)\n" |
275 | - |
276 | -#. module: product_pricelist_fixed_price |
277 | -#: view:product.pricelist.item:0 |
278 | -msgid "Max. Margin" |
279 | -msgstr "Margen máximo" |
280 | - |
281 | -#. module: product_pricelist_fixed_price |
282 | -#: view:product.pricelist.item:0 |
283 | -msgid "Min. Margin" |
284 | -msgstr "Margen mÃnimo" |
285 | - |
286 | -#. module: product_pricelist_fixed_price |
287 | -#: view:product.pricelist.item:0 |
288 | -msgid "Rounding Method" |
289 | -msgstr "Método redondeo" |
290 | - |
291 | -#. module: product_pricelist_fixed_price |
292 | -#: constraint:product.pricelist.item:0 |
293 | -msgid "" |
294 | -"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList " |
295 | -"Item!" |
296 | -msgstr "" |
297 | -"¡Error! No puede asignar la tarifa principal como otra tarifa en un " |
298 | -"elemento de la tarifa." |
299 | - |
300 | -#. module: product_pricelist_fixed_price |
301 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist |
302 | -msgid "Pricelist" |
303 | -msgstr "Lista de Precios" |
304 | - |
305 | -#. module: product_pricelist_fixed_price |
306 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:97 |
307 | -#, python-format |
308 | -msgid "Warning !" |
309 | -msgstr "¡Atención!" |
310 | +"Plural-Forms: \n" |
311 | + |
312 | +#. module: product_pricelist_fixed_price |
313 | +#: view:product.pricelist.item:0 |
314 | +msgid "Base Price" |
315 | +msgstr "Precio base" |
316 | + |
317 | +#. module: product_pricelist_fixed_price |
318 | +#: help:product.pricelist.item,base_ext:0 |
319 | +msgid "Base price for computation." |
320 | +msgstr "Precio base para el cálculo." |
321 | + |
322 | +#. module: product_pricelist_fixed_price |
323 | +#: field:product.pricelist.item,base_ext:0 |
324 | +msgid "Based on" |
325 | +msgstr "Basado en" |
326 | |
327 | #. module: product_pricelist_fixed_price |
328 | #: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item |
329 | msgid "Pricelist item" |
330 | -msgstr "Elemento de la tarifa" |
331 | - |
332 | -#. module: product_pricelist_fixed_price |
333 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:32 |
334 | -#: field:product.pricelist.item,fixed_price:0 |
335 | +msgstr "Elemento de tarifa" |
336 | + |
337 | +#. module: product_pricelist_fixed_price |
338 | +#: view:product.pricelist.item:0 |
339 | +msgid "Price Computation" |
340 | +msgstr "Cálculo del precio" |
341 | + |
342 | +#. module: product_pricelist_fixed_price |
343 | +#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:32 |
344 | #, python-format |
345 | msgid "Fixed Price" |
346 | msgstr "Precio fijo" |
347 | + |
348 | |
349 | === removed file 'product_pricelist_fixed_price/i18n/it.po' |
350 | --- product_pricelist_fixed_price/i18n/it.po 2012-12-05 05:42:11 +0000 |
351 | +++ product_pricelist_fixed_price/i18n/it.po 1970-01-01 00:00:00 +0000 |
352 | @@ -1,64 +0,0 @@ |
353 | -# Translation of OpenERP Server. |
354 | -# This file contains the translation of the following modules: |
355 | -# * product_pricelist_fixed_price |
356 | -# |
357 | -msgid "" |
358 | -msgstr "" |
359 | -"Project-Id-Version: OpenERP Server 6.0.1\n" |
360 | -"Report-Msgid-Bugs-To: support@openerp.com\n" |
361 | -"POT-Creation-Date: 2011-03-25 10:08+0000\n" |
362 | -"PO-Revision-Date: 2011-03-31 12:02+0000\n" |
363 | -"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n" |
364 | -"Language-Team: \n" |
365 | -"MIME-Version: 1.0\n" |
366 | -"Content-Type: text/plain; charset=UTF-8\n" |
367 | -"Content-Transfer-Encoding: 8bit\n" |
368 | -"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n" |
369 | -"X-Generator: Launchpad (build 16335)\n" |
370 | - |
371 | -#. module: product_pricelist_fixed_price |
372 | -#: view:product.pricelist.item:0 |
373 | -msgid "Max. Margin" |
374 | -msgstr "Margine Massimo" |
375 | - |
376 | -#. module: product_pricelist_fixed_price |
377 | -#: view:product.pricelist.item:0 |
378 | -msgid "Min. Margin" |
379 | -msgstr "Margine Minimo" |
380 | - |
381 | -#. module: product_pricelist_fixed_price |
382 | -#: view:product.pricelist.item:0 |
383 | -msgid "Rounding Method" |
384 | -msgstr "Metodo Arrotondamento" |
385 | - |
386 | -#. module: product_pricelist_fixed_price |
387 | -#: constraint:product.pricelist.item:0 |
388 | -msgid "" |
389 | -"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList " |
390 | -"Item!" |
391 | -msgstr "" |
392 | -"Errore ! Non è possibile assegnare il listino principale come 'altro " |
393 | -"listino' nell'elemento di listino!" |
394 | - |
395 | -#. module: product_pricelist_fixed_price |
396 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist |
397 | -msgid "Pricelist" |
398 | -msgstr "Listino Prezzi" |
399 | - |
400 | -#. module: product_pricelist_fixed_price |
401 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:97 |
402 | -#, python-format |
403 | -msgid "Warning !" |
404 | -msgstr "attenzione !" |
405 | - |
406 | -#. module: product_pricelist_fixed_price |
407 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item |
408 | -msgid "Pricelist item" |
409 | -msgstr "Oggetto Listino" |
410 | - |
411 | -#. module: product_pricelist_fixed_price |
412 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:32 |
413 | -#: field:product.pricelist.item,fixed_price:0 |
414 | -#, python-format |
415 | -msgid "Fixed Price" |
416 | -msgstr "Prezzo fisso" |
417 | |
418 | === modified file 'product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot' |
419 | --- product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot 2011-04-01 10:14:05 +0000 |
420 | +++ product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot 2014-02-24 14:37:37 +0000 |
421 | @@ -4,46 +4,30 @@ |
422 | # |
423 | msgid "" |
424 | msgstr "" |
425 | -"Project-Id-Version: OpenERP Server 6.0.1\n" |
426 | -"Report-Msgid-Bugs-To: support@openerp.com\n" |
427 | -"POT-Creation-Date: 2011-03-25 10:08+0000\n" |
428 | -"PO-Revision-Date: 2011-03-25 10:08+0000\n" |
429 | -"Last-Translator: <>\n" |
430 | +"Project-Id-Version: OpenERP Server 7.0\n" |
431 | +"Report-Msgid-Bugs-To: \n" |
432 | +"POT-Creation-Date: 2014-02-05 20:35+0000\n" |
433 | +"PO-Revision-Date: 2014-02-05 21:35+0100\n" |
434 | +"Last-Translator: Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>\n" |
435 | "Language-Team: \n" |
436 | "MIME-Version: 1.0\n" |
437 | "Content-Type: text/plain; charset=UTF-8\n" |
438 | -"Content-Transfer-Encoding: \n" |
439 | +"Content-Transfer-Encoding: 8bit\n" |
440 | "Plural-Forms: \n" |
441 | |
442 | #. module: product_pricelist_fixed_price |
443 | #: view:product.pricelist.item:0 |
444 | -msgid "Max. Margin" |
445 | -msgstr "" |
446 | - |
447 | -#. module: product_pricelist_fixed_price |
448 | -#: view:product.pricelist.item:0 |
449 | -msgid "Min. Margin" |
450 | -msgstr "" |
451 | - |
452 | -#. module: product_pricelist_fixed_price |
453 | -#: view:product.pricelist.item:0 |
454 | -msgid "Rounding Method" |
455 | -msgstr "" |
456 | - |
457 | -#. module: product_pricelist_fixed_price |
458 | -#: constraint:product.pricelist.item:0 |
459 | -msgid "Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!" |
460 | -msgstr "" |
461 | - |
462 | -#. module: product_pricelist_fixed_price |
463 | -#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist |
464 | -msgid "Pricelist" |
465 | -msgstr "" |
466 | - |
467 | -#. module: product_pricelist_fixed_price |
468 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:97 |
469 | -#, python-format |
470 | -msgid "Warning !" |
471 | +msgid "Base Price" |
472 | +msgstr "" |
473 | + |
474 | +#. module: product_pricelist_fixed_price |
475 | +#: help:product.pricelist.item,base_ext:0 |
476 | +msgid "Base price for computation." |
477 | +msgstr "" |
478 | + |
479 | +#. module: product_pricelist_fixed_price |
480 | +#: field:product.pricelist.item,base_ext:0 |
481 | +msgid "Based on" |
482 | msgstr "" |
483 | |
484 | #. module: product_pricelist_fixed_price |
485 | @@ -52,8 +36,12 @@ |
486 | msgstr "" |
487 | |
488 | #. module: product_pricelist_fixed_price |
489 | -#: code:addons/product_pricelist_fixed_price/pricelist.py:32 |
490 | -#: field:product.pricelist.item,fixed_price:0 |
491 | +#: view:product.pricelist.item:0 |
492 | +msgid "Price Computation" |
493 | +msgstr "" |
494 | + |
495 | +#. module: product_pricelist_fixed_price |
496 | +#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:32 |
497 | #, python-format |
498 | msgid "Fixed Price" |
499 | msgstr "" |
500 | |
501 | === added directory 'product_pricelist_fixed_price/model' |
502 | === added file 'product_pricelist_fixed_price/model/__init__.py' |
503 | --- product_pricelist_fixed_price/model/__init__.py 1970-01-01 00:00:00 +0000 |
504 | +++ product_pricelist_fixed_price/model/__init__.py 2014-02-24 14:37:37 +0000 |
505 | @@ -0,0 +1,19 @@ |
506 | +# -*- coding: utf-8 -*- |
507 | +############################################################################## |
508 | +# |
509 | +# This program is free software: you can redistribute it and/or modify |
510 | +# it under the terms of the GNU Affero General Public License as published |
511 | +# by the Free Software Foundation, either version 3 of the License, or |
512 | +# (at your option) any later version. |
513 | +# |
514 | +# This program is distributed in the hope that it will be useful, |
515 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
516 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
517 | +# GNU Affero General Public License for more details. |
518 | +# |
519 | +# You should have received a copy of the GNU Affero General Public License |
520 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
521 | +# |
522 | +############################################################################## |
523 | +from . import product_pricelist_item |
524 | + |
525 | |
526 | === added file 'product_pricelist_fixed_price/model/product_pricelist_item.py' |
527 | --- product_pricelist_fixed_price/model/product_pricelist_item.py 1970-01-01 00:00:00 +0000 |
528 | +++ product_pricelist_fixed_price/model/product_pricelist_item.py 2014-02-24 14:37:37 +0000 |
529 | @@ -0,0 +1,51 @@ |
530 | +# -*- coding: utf-8 -*- |
531 | +############################################################################## |
532 | +# |
533 | +# OpenERP, Open Source Management Solution |
534 | +# Copyright (c) 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com) |
535 | +# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com> |
536 | +# |
537 | +# This program is free software: you can redistribute it and/or modify |
538 | +# it under the terms of the GNU Affero General Public License as published |
539 | +# by the Free Software Foundation, either version 3 of the License, or |
540 | +# (at your option) any later version. |
541 | +# |
542 | +# This program is distributed in the hope that it will be useful, |
543 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
544 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
545 | +# GNU Affero General Public License for more details. |
546 | +# |
547 | +# You should have received a copy of the GNU Affero General Public License |
548 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
549 | +# |
550 | +############################################################################## |
551 | +from openerp.osv import orm, fields |
552 | +from openerp.tools.translate import _ |
553 | + |
554 | + |
555 | +class product_pricelist_item(orm.Model): |
556 | + _inherit = 'product.pricelist.item' |
557 | + |
558 | + def _price_field_get_ext(self, cr, uid, context=None): |
559 | + result = super(product_pricelist_item, self)._price_field_get( |
560 | + cr, uid, context=context) |
561 | + result.append((-3, _('Fixed Price'))) |
562 | + return result |
563 | + |
564 | + _columns = { |
565 | + 'base_ext': fields.selection(_price_field_get_ext, 'Based on', |
566 | + required=True, size=-1, |
567 | + help="Base price for computation."), |
568 | + } |
569 | + _defaults = { |
570 | + 'base_ext': -1, |
571 | + } |
572 | + |
573 | + def onchange_base_ext(self, cr, uid, ids, base_ext, context=None): |
574 | + if base_ext == -3: |
575 | + # Simulate be based on first found price that allows the trick |
576 | + return { |
577 | + 'value': {'base': 1, |
578 | + 'price_discount': -1,} |
579 | + } |
580 | + return {'value': {'base': base_ext}} |
581 | |
582 | === removed file 'product_pricelist_fixed_price/pricelist.py' |
583 | --- product_pricelist_fixed_price/pricelist.py 2011-04-01 10:14:05 +0000 |
584 | +++ product_pricelist_fixed_price/pricelist.py 1970-01-01 00:00:00 +0000 |
585 | @@ -1,211 +0,0 @@ |
586 | -# -*- encoding: utf-8 -*- |
587 | -############################################################################## |
588 | -# |
589 | -# OpenERP, Open Source Management Solution |
590 | -# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>). |
591 | -# |
592 | -# This program is free software: you can redistribute it and/or modify |
593 | -# it under the terms of the GNU Affero General Public License as |
594 | -# published by the Free Software Foundation, either version 3 of the |
595 | -# License, or (at your option) any later version. |
596 | -# |
597 | -# This program is distributed in the hope that it will be useful, |
598 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
599 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
600 | -# GNU Affero General Public License for more details. |
601 | -# |
602 | -# You should have received a copy of the GNU Affero General Public License |
603 | -# along with this program. If not, see <http://www.gnu.org/licenses/>. |
604 | -# |
605 | -############################################################################## |
606 | - |
607 | -from osv import fields,osv |
608 | -from tools.translate import _ |
609 | -import decimal_precision as dp |
610 | -import time |
611 | -from product._common import rounding |
612 | - |
613 | -class product_pricelist_item(osv.osv): |
614 | - |
615 | - def _price_field_get(self, cr, uid, context=None): |
616 | - result = super(product_pricelist_item, self)._price_field_get(cr, uid, context) |
617 | - result.append((-3, _('Fixed Price'))) |
618 | - return result |
619 | - |
620 | - _inherit = "product.pricelist.item" |
621 | - |
622 | - _columns = { |
623 | - 'fixed_price': fields.float('Fixed Price', |
624 | - digits_compute= dp.get_precision('Sale Price')), |
625 | - 'base': fields.selection(_price_field_get, 'Based on', required=True, size=-1, help="The mode for computing the price for this rule."), |
626 | - } |
627 | - |
628 | -product_pricelist_item() |
629 | - |
630 | -class product_pricelist(osv.osv): |
631 | - _inherit = "product.pricelist" |
632 | - |
633 | - def price_get_multi(self, cr, uid, pricelist_ids, products_by_qty_by_partner, context=None): |
634 | - |
635 | - def _create_parent_category_list(id, lst): |
636 | - if not id: |
637 | - return [] |
638 | - parent = product_category_tree.get(id) |
639 | - if parent: |
640 | - lst.append(parent) |
641 | - return _create_parent_category_list(parent, lst) |
642 | - else: |
643 | - return lst |
644 | - # _create_parent_category_list |
645 | - |
646 | - if context is None: |
647 | - context = {} |
648 | - |
649 | - date = time.strftime('%Y-%m-%d') |
650 | - if 'date' in context: |
651 | - date = context['date'] |
652 | - |
653 | - currency_obj = self.pool.get('res.currency') |
654 | - product_obj = self.pool.get('product.product') |
655 | - product_category_obj = self.pool.get('product.category') |
656 | - product_uom_obj = self.pool.get('product.uom') |
657 | - supplierinfo_obj = self.pool.get('product.supplierinfo') |
658 | - price_type_obj = self.pool.get('product.price.type') |
659 | - product_pricelist_version_obj = self.pool.get('product.pricelist.version') |
660 | - |
661 | - # product.pricelist.version: |
662 | - if pricelist_ids: |
663 | - pricelist_version_ids = pricelist_ids |
664 | - else: |
665 | - # all pricelists: |
666 | - pricelist_version_ids = self.pool.get('product.pricelist').search(cr, uid, [], context=context) |
667 | - |
668 | - pricelist_version_ids = list(set(pricelist_version_ids)) |
669 | - plversions_search_args = [ |
670 | - ('pricelist_id', 'in', pricelist_version_ids), |
671 | - '|', |
672 | - ('date_start', '=', False), |
673 | - ('date_start', '<=', date), |
674 | - '|', |
675 | - ('date_end', '=', False), |
676 | - ('date_end', '>=', date), |
677 | - ] |
678 | - |
679 | - plversion_ids = product_pricelist_version_obj.search(cr, uid, plversions_search_args) |
680 | - if len(pricelist_version_ids) != len(plversion_ids): |
681 | - msg = "At least one pricelist has no active version !\nPlease create or activate one." |
682 | - raise osv.except_osv(_('Warning !'), _(msg)) |
683 | - |
684 | - # product.product: |
685 | - product_ids = [i[0] for i in products_by_qty_by_partner] |
686 | - #products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])]) |
687 | - products = product_obj.browse(cr, uid, product_ids, context=context) |
688 | - products_dict = dict([(item.id, item) for item in products]) |
689 | - |
690 | - # product.category: |
691 | - product_category_ids = product_category_obj.search(cr, uid, []) |
692 | - product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id']) |
693 | - product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']]) |
694 | - |
695 | - results = {} |
696 | - for product_id, qty, partner in products_by_qty_by_partner: |
697 | - for pricelist_id in pricelist_version_ids: |
698 | - price = False |
699 | - |
700 | - tmpl_id = products_dict[product_id].product_tmpl_id and products_dict[product_id].product_tmpl_id.id or False |
701 | - |
702 | - categ_id = products_dict[product_id].categ_id and products_dict[product_id].categ_id.id or False |
703 | - categ_ids = _create_parent_category_list(categ_id, [categ_id]) |
704 | - if categ_ids: |
705 | - categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))' |
706 | - else: |
707 | - categ_where = '(categ_id IS NULL)' |
708 | - |
709 | - cr.execute( |
710 | - 'SELECT i.*, pl.currency_id ' |
711 | - 'FROM product_pricelist_item AS i, ' |
712 | - 'product_pricelist_version AS v, product_pricelist AS pl ' |
713 | - 'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) ' |
714 | - 'AND (product_id IS NULL OR product_id = %s) ' |
715 | - 'AND (' + categ_where + ' OR (categ_id IS NULL)) ' |
716 | - 'AND price_version_id = %s ' |
717 | - 'AND (min_quantity IS NULL OR min_quantity <= %s) ' |
718 | - 'AND i.price_version_id = v.id AND v.pricelist_id = pl.id ' |
719 | - 'ORDER BY sequence', |
720 | - (tmpl_id, product_id, plversion_ids[0], qty)) |
721 | - res1 = cr.dictfetchall() |
722 | - uom_price_already_computed = False |
723 | - for res in res1: |
724 | - if res: |
725 | - if res['base'] == -1: |
726 | - if not res['base_pricelist_id']: |
727 | - price = 0.0 |
728 | - else: |
729 | - price_tmp = self.price_get(cr, uid, |
730 | - [res['base_pricelist_id']], product_id, |
731 | - qty, context=context)[res['base_pricelist_id']] |
732 | - ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id |
733 | - price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False) |
734 | - elif res['base'] == -2: |
735 | - # this section could be improved by moving the queries outside the loop: |
736 | - where = [] |
737 | - if partner: |
738 | - where = [('name', '=', partner) ] |
739 | - sinfo = supplierinfo_obj.search(cr, uid, |
740 | - [('product_id', '=', tmpl_id)] + where) |
741 | - price = 0.0 |
742 | - if sinfo: |
743 | - qty_in_product_uom = qty |
744 | - product_default_uom = product_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0] |
745 | - seller_uom = supplierinfo_obj.read(cr, uid, sinfo, ['product_uom'])[0]['product_uom'][0] |
746 | - if seller_uom and product_default_uom and product_default_uom != seller_uom: |
747 | - uom_price_already_computed = True |
748 | - qty_in_product_uom = product_uom_obj._compute_qty(cr, uid, product_default_uom, qty, to_uom_id=seller_uom) |
749 | - cr.execute('SELECT * ' \ |
750 | - 'FROM pricelist_partnerinfo ' \ |
751 | - 'WHERE suppinfo_id IN %s' \ |
752 | - 'AND min_quantity <= %s ' \ |
753 | - 'ORDER BY min_quantity DESC LIMIT 1', (tuple(sinfo),qty_in_product_uom,)) |
754 | - res2 = cr.dictfetchone() |
755 | - if res2: |
756 | - price = res2['price'] |
757 | - elif res['base'] == -3: |
758 | - price = res['fixed_price'] |
759 | - else: |
760 | - price_type = price_type_obj.browse(cr, uid, int(res['base'])) |
761 | - price = currency_obj.compute(cr, uid, |
762 | - price_type.currency_id.id, res['currency_id'], |
763 | - product_obj.price_get(cr, uid, [product_id], |
764 | - price_type.field,context=context)[product_id], round=False, context=context) |
765 | - |
766 | - if price: |
767 | - price_limit = price |
768 | - |
769 | - price = price * (1.0+(res['price_discount'] or 0.0)) |
770 | - price = rounding(price, res['price_round']) |
771 | - price += (res['price_surcharge'] or 0.0) |
772 | - if res['price_min_margin']: |
773 | - price = max(price, price_limit+res['price_min_margin']) |
774 | - if res['price_max_margin']: |
775 | - price = min(price, price_limit+res['price_max_margin']) |
776 | - break |
777 | - |
778 | - else: |
779 | - # False means no valid line found ! But we may not raise an |
780 | - # exception here because it breaks the search |
781 | - price = False |
782 | - |
783 | - if price: |
784 | - if 'uom' in context and not uom_price_already_computed: |
785 | - product = products_dict[product_id] |
786 | - uom = product.uos_id or product.uom_id |
787 | - price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, price, context['uom']) |
788 | - |
789 | - if results.get(product_id): |
790 | - results[product_id][pricelist_id] = price |
791 | - else: |
792 | - results[product_id] = {pricelist_id: price} |
793 | - |
794 | - return results |
795 | - |
796 | -product_pricelist() |
797 | |
798 | === removed file 'product_pricelist_fixed_price/pricelist_view.xml' |
799 | --- product_pricelist_fixed_price/pricelist_view.xml 2011-04-01 10:14:05 +0000 |
800 | +++ product_pricelist_fixed_price/pricelist_view.xml 1970-01-01 00:00:00 +0000 |
801 | @@ -1,76 +0,0 @@ |
802 | -<?xml version="1.0" encoding="UTF-8"?> |
803 | -<openerp> |
804 | - <data> |
805 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_fixed"> |
806 | - <field name="name">product.pricelist.item.form.fixed</field> |
807 | - <field name="model">product.pricelist.item</field> |
808 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
809 | - <field name="type">form</field> |
810 | - <field name="arch" type="xml"> |
811 | - <field name="price_max_margin" position="after"> |
812 | - <field name="fixed_price" colspan="3" attrs="{'readonly': [('base','!=', -3)]}"/> |
813 | - </field> |
814 | - </field> |
815 | - </record> |
816 | - |
817 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_price_discount"> |
818 | - <field name="name">product.pricelist.item.form.price_discount</field> |
819 | - <field name="model">product.pricelist.item</field> |
820 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
821 | - <field name="type">form</field> |
822 | - <field name="arch" type="xml"> |
823 | - <field name="price_discount" position="replace"> |
824 | - <field name="price_discount" nolabel="1" attrs="{'readonly': [('base','==', -3)]}"/> |
825 | - </field> |
826 | - </field> |
827 | - </record> |
828 | - |
829 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_price_surcharge"> |
830 | - <field name="name">product.pricelist.item.form.price_surcharge</field> |
831 | - <field name="model">product.pricelist.item</field> |
832 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
833 | - <field name="type">form</field> |
834 | - <field name="arch" type="xml"> |
835 | - <field name="price_surcharge" position="replace"> |
836 | - <field name="price_surcharge" nolabel="1" attrs="{'readonly': [('base','==', -3)]}"/> |
837 | - </field> |
838 | - </field> |
839 | - </record> |
840 | - |
841 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_price_round"> |
842 | - <field name="name">product.pricelist.item.form.price_round</field> |
843 | - <field name="model">product.pricelist.item</field> |
844 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
845 | - <field name="type">form</field> |
846 | - <field name="arch" type="xml"> |
847 | - <field name="price_round" position="replace"> |
848 | - <field name="price_round" string="Rounding Method" attrs="{'readonly': [('base','==', -3)]}"/> |
849 | - </field> |
850 | - </field> |
851 | - </record> |
852 | - |
853 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_price_min_margin"> |
854 | - <field name="name">product.pricelist.item.form.price_min_margin</field> |
855 | - <field name="model">product.pricelist.item</field> |
856 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
857 | - <field name="type">form</field> |
858 | - <field name="arch" type="xml"> |
859 | - <field name="price_min_margin" position="replace"> |
860 | - <field name="price_min_margin" string="Min. Margin" attrs="{'readonly': [('base','==', -3)]}"/> |
861 | - </field> |
862 | - </field> |
863 | - </record> |
864 | - |
865 | - <record model="ir.ui.view" id="product_pricelist_item_form_view_price_max_margin"> |
866 | - <field name="name">product.pricelist.item.form.price_max_margin</field> |
867 | - <field name="model">product.pricelist.item</field> |
868 | - <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
869 | - <field name="type">form</field> |
870 | - <field name="arch" type="xml"> |
871 | - <field name="price_max_margin" position="replace"> |
872 | - <field name="price_max_margin" string="Max. Margin" attrs="{'readonly': [('base','==', -3)]}"/> |
873 | - </field> |
874 | - </field> |
875 | - </record> |
876 | - </data> |
877 | -</openerp> |
878 | |
879 | === added directory 'product_pricelist_fixed_price/view' |
880 | === added file 'product_pricelist_fixed_price/view/product_pricelist_item_view.xml' |
881 | --- product_pricelist_fixed_price/view/product_pricelist_item_view.xml 1970-01-01 00:00:00 +0000 |
882 | +++ product_pricelist_fixed_price/view/product_pricelist_item_view.xml 2014-02-24 14:37:37 +0000 |
883 | @@ -0,0 +1,35 @@ |
884 | +<?xml version="1.0" encoding="utf-8"?> |
885 | +<openerp> |
886 | + <data> |
887 | + |
888 | + <record id="product_pricelist_item_fixedprice_form" model="ir.ui.view"> |
889 | + <field name="name">product.pricelist.item.fixedprice</field> |
890 | + <field name="model">product.pricelist.item</field> |
891 | + <field name="inherit_id" ref="product.product_pricelist_item_form_view"/> |
892 | + <field name="arch" type="xml"> |
893 | + <group string="Price Computation" position="attributes"> |
894 | + <attribute name="col">6</attribute> |
895 | + </group> |
896 | + <field name="base" position="attributes"> |
897 | + <attribute name="invisible">True</attribute> |
898 | + </field> |
899 | + <field name="base_pricelist_id" position="before"> |
900 | + <field name="base_ext" on_change="onchange_base_ext(base_ext)"/> |
901 | + </field> |
902 | + <label string="Base Price" position="attributes"> |
903 | + <attribute name="attrs">{'invisible': [('base_ext', '=', -3)]}</attribute> |
904 | + </label> |
905 | + <label string="* ( 1 + " position="attributes"> |
906 | + <attribute name="attrs">{'invisible': [('base_ext', '=', -3)]}</attribute> |
907 | + </label> |
908 | + <field name="price_discount" position="attributes"> |
909 | + <attribute name="attrs">{'invisible': [('base_ext', '=', -3)]}</attribute> |
910 | + </field> |
911 | + <label string=" ) + " position="attributes"> |
912 | + <attribute name="attrs">{'invisible': [('base_ext', '=', -3)]}</attribute> |
913 | + </label> |
914 | + </field> |
915 | + </record> |
916 | + |
917 | + </data> |
918 | +</openerp> |
Dear Pedro Manuel Baeza,
Thanks for your proposal, it's simpler than I expected.
Reading the code I understand that you're still using the "-100% + Price" trick, aren't you?
What happens if on_change() is not executed (for example records are added through XML-RPC)? The 100% discount will not be applied will it?
I'll test it in more depth tomorrow is I can.
Lionel.