Merge lp:~therp-nl/openerp-product-attributes/7.0_lp1272282_fixed_price into lp:~product-core-editors/openerp-product-attributes/7.0

Proposed by Ronald Portier (Therp) on 2014-01-27
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp on 2014-03-24
Proposed branch: lp:~therp-nl/openerp-product-attributes/7.0_lp1272282_fixed_price
Merge into: lp:~product-core-editors/openerp-product-attributes/7.0
Diff against target: 1642 lines (+904/-614)
17 files modified
product_pricelist_fixed_price/AUTHORS.txt (+2/-0)
product_pricelist_fixed_price/__init__.py (+1/-20)
product_pricelist_fixed_price/__openerp__.py (+11/-9)
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 (+0/-65)
product_pricelist_fixed_price/i18n/it.po (+0/-64)
product_pricelist_fixed_price/i18n/nl.po (+175/-0)
product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot (+147/-39)
product_pricelist_fixed_price/model/__init__.py (+5/-0)
product_pricelist_fixed_price/model/product_pricelist.py (+34/-0)
product_pricelist_fixed_price/model/product_pricelist_item.py (+117/-0)
product_pricelist_fixed_price/model/product_pricelist_version.py (+35/-0)
product_pricelist_fixed_price/pricelist.py (+0/-211)
product_pricelist_fixed_price/pricelist_view.xml (+0/-76)
product_pricelist_fixed_price/view/pricelist_menu.xml (+109/-0)
product_pricelist_fixed_price/view/pricelist_view.xml (+268/-0)
To merge this branch: bzr merge lp:~therp-nl/openerp-product-attributes/7.0_lp1272282_fixed_price
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Needs Information on 2014-03-21
Yannick Vaucher @ Camptocamp Disapprove on 2014-02-24
Lionel Sausin - Initiatives/Numérigraphe (community) functionnal and code Approve on 2014-02-04
Pedro Manuel Baeza Needs Fixing on 2014-02-03
Leonardo Pistone Abstain on 2014-02-03
Ronald Portier (Therp) (community) Resubmit on 2014-02-03
Review via email: mp+203348@code.launchpad.net

Description of the change

Replace original code to make it compatible with 7.0.

I used the trick to have -1 for the price discount and put the fixed price in price_surcharge.

This will create a price: (base_price * (1 + price_discount)) + price_surcharge =

(base_price * (1 -1)) + price_surcharge = price_surcharge.

Therefore OpenERP will do all its normal computations (including currency-conversions), but none of those computations needs to be modified, adopted or overruled.

To post a comment you must log in.
Leonardo Pistone (lepistone) wrote :

Thanks for your work Ronald.

The idea to apply a 100% discount to get a fixed price seems correct to me. I would request a functional review to Lorenzo to check if that covers the use case for the old module.

review: Needs Information (code review)

The 100% discount trick is what we currently do in a non-automatic sort of way, and it looks like this module is just what I expected to develop some day to make it easier.
So we're quite willing to test this, but please allow a few days before we can give a feedback.

Lorenzo Battistini (elbati) wrote :

From a functional point of view, I approve the -1 trick.

Functional: Worked for me, no problem.
I only wish it was possible to mix fixed price rules and standard ones, so we could get rules like
- product A = 1€
- product B = 3€
- other products = sale price + 10%
But this is something that we can change later, it should not block this MP.

GUI:
The form layout for the fixed price list version is slightly wrong (the number of cols must be wrong I guess).
Would you mind making the list view of pricelist lines editable? That would make it much faster to enter.

Code:
I suggest you merge the content of "model/" in a single file at the upper level directory to make consistent with the other modules.

There are spaces at the end of lots of lines, would you care to remove them please?

Can you please make the docstring for the check_*() functions more explicit that "Raise exception when error found", like maybe "Ensure the fixed prices are in fixed pricelists"?

The docstring states that "_compute_vals()" mutates the argument "vals", so I'd be more comfortable if it was called "_adapt_vals()" or something likely explicit.

In _compute_vals you don't use the context, so please remove "context = context or {}"

In write(),the context is missing from the browse() call.

The python files lack copyright comments, is that OK?

review: Needs Fixing
Pedro Manuel Baeza (pedro.baeza) wrote :

Without demeriting your work, IMHO a better approach would be to include a field calle type_extended or something similar on product.pricelist.item model that includes the other rule types and a new one called "Fixed price". On the on_change of this field, you can change original type and discount value to -1 if "Fixed price" is selected. On interface, you only need to hide corresponding fields when this type is selected, and relace the old field with this new one. I think it's simpler, don't you?

Regards.

232. By Ronald Portier (Therp) on 2014-02-03

[ENH] - Enable mixing of fixed and traditional prices in the same pricelists.
[ENH] - Add functionality for fixed prices to traditional views.
[FIX] - whitespace and convention issues.

233. By Ronald Portier (Therp) on 2014-02-03

[FIX] Wrong layout in fixed pricelist version view.

I tried to take most remarks into account. I refer to the commit messages.

Two things
- I prefer having a separate file for each model created or modified. One of the big annoyances in working with the code in OpenERP in my experience is how everything is lumped together in monster .py files. grep is our friend ofcourse. But why for example is res.partner modified somewhere after 1800 (!) lines of code in account_invoice.py? The java community has had the convention of "one class per file" for ages, and that is working out perfectly.
- I did not add an editable list view for the moment. This is just for lack of time. Might add it in the future.

review: Resubmit
Leonardo Pistone (lepistone) wrote :

Hi all,

my review was just a pointer for Lorenzo because I wanted to see his opinion on this implementation as opposed to his own. I now abstain because I didn't actually review the code.

Thanks to all for your work.

review: Abstain
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Ronald, let me then work in my solution and I'll propose it here. Until them, I'll put this on 'Needs fixing' until then.

Regards.

review: Needs Fixing

@Pedro I do not quite understand why you put 'need fixing'. As far as I understand, the module now does everything you and others asked for. OK, I make fields read-only instead of completely hiding them. But what else would you like to be different?

Dear Ronald Portier,
Thanks for your work. I tested them and functionally they look just fine.
The UI could be simpler: you could make the fields "hidden" instead of "read-only" when a pricelist lines have a fixed price.
Then the additional menu entries and views wouldn't be needed, you could remove them altogether.
Regarding the many files, usually we group them by module so you could do with a "product.py" with all things product-related. But I'd not block this MP for such a detail.
And other that that it looks just fine to me.

Pedro Manuel Baeza, I humbly think we should accept this MP, and then you can base your own branch on Ronald Portier's work. What do you think?

review: Approve (functionnal and code)

Pedro Manuel Baeza,
I think I didn't understand your counter-proposal at first, sorry.
What you're proposing may be more powerful but will be more intrusive won't it? Then it might be harder to test. Do you expect to develop advanced price list customizations beyond fixed price in the short term?
Otherwise I think we should accept this and eventually replace it with more complex code like the one you propose, when the actual need arises.

Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, I have make another MP proposing my approach for this task. Please review it and tell me if you see it more idoneous:

https://code.launchpad.net/~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price/+merge/205045

Regards.

I'll disapprove it as https://code.launchpad.net/~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price/+merge/205045 superseeds it.

Ronald would be great if you could have a look at Pedro's MP as well.

review: Disapprove

Hi Ronald,

The alternative [0] proposed by Pedro is about to be merged; it has been approved by 3 people. Can we have your opinion on that, and eventually can you close your one if you think that Pedro's proposal fit with your needs as well?

Thanks.

[0] https://code.launchpad.net/~pedro.baeza/openerp-product-attributes/7.0-product_pricelist_fixed_price/+merge/205045

review: Needs Information

Ronald having approved Pedro's proposal, I set the merge status of this proposal as rejected. Thanks to everyone for your work.

Unmerged revisions

233. By Ronald Portier (Therp) on 2014-02-03

[FIX] Wrong layout in fixed pricelist version view.

232. By Ronald Portier (Therp) on 2014-02-03

[ENH] - Enable mixing of fixed and traditional prices in the same pricelists.
[ENH] - Add functionality for fixed prices to traditional views.
[FIX] - whitespace and convention issues.

231. By Ronald Portier (Therp) on 2014-01-27

[FIX] Completely replace fixed pricelist module to make it compatible
    with OpenERP 7.0, but also have it use just standard computations.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified 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 2014-02-03 14:58:49 +0000
4@@ -1,1 +1,3 @@
5 Lorenzo Battistini <lorenzo.battistini@domsense.com>
6+Ronald Portier <ronald@therp.nl>
7+
8
9=== modified file 'product_pricelist_fixed_price/__init__.py'
10--- product_pricelist_fixed_price/__init__.py 2011-04-01 10:14:05 +0000
11+++ product_pricelist_fixed_price/__init__.py 2014-02-03 14:58:49 +0000
12@@ -1,22 +1,3 @@
13 # -*- encoding: utf-8 -*-
14-##############################################################################
15-#
16-# OpenERP, Open Source Management Solution
17-# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
18-#
19-# This program is free software: you can redistribute it and/or modify
20-# it under the terms of the GNU Affero General Public License as
21-# published by the Free Software Foundation, either version 3 of the
22-# License, or (at your option) any later version.
23-#
24-# This program is distributed in the hope that it will be useful,
25-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27-# GNU Affero General Public License for more details.
28-#
29-# You should have received a copy of the GNU Affero General Public License
30-# along with this program. If not, see <http://www.gnu.org/licenses/>.
31-#
32-##############################################################################
33+from . import model
34
35-import pricelist
36
37=== modified file 'product_pricelist_fixed_price/__openerp__.py'
38--- product_pricelist_fixed_price/__openerp__.py 2013-01-21 06:49:06 +0000
39+++ product_pricelist_fixed_price/__openerp__.py 2014-02-03 14:58:49 +0000
40@@ -3,6 +3,7 @@
41 #
42 # OpenERP, Open Source Management Solution
43 # Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
44+# 2014 Therp BV (<http://www.therp.nl>).
45 #
46 # This program is free software: you can redistribute it and/or modify
47 # it under the terms of the GNU Affero General Public License as
48@@ -19,20 +20,21 @@
49 #
50 ##############################################################################
51
52-
53 {
54 "name": "Price List Fixed Price",
55- "version": "1.0",
56+ "version": "2.0",
57 'category': 'Generic Modules/Inventory Control',
58 "depends": ["product"],
59- "author": "Agile Business Group & Domsense",
60- "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""",
61- 'website': 'http://www.agilebg.com',
62- 'init_xml': [],
63- 'update_xml': [
64- 'pricelist_view.xml',
65+ "author": "Product Addons Community",
66+ "description": """This module allows to specify a fixed price for price
67+ list rules.""",
68+ 'website': 'https://launchpad.net/openerp-product-attributes',
69+ 'data': [
70+ 'view/pricelist_view.xml',
71+ 'view/pricelist_menu.xml',
72 ],
73 'demo_xml': [],
74- 'installable': False,
75+ 'installable': True,
76 'active': False,
77 }
78+
79
80=== removed file 'product_pricelist_fixed_price/i18n/ca.po'
81--- product_pricelist_fixed_price/i18n/ca.po 2012-12-05 05:42:11 +0000
82+++ product_pricelist_fixed_price/i18n/ca.po 1970-01-01 00:00:00 +0000
83@@ -1,65 +0,0 @@
84-# Catalan translation for openobject-addons
85-# Copyright (c) 2012 Rosetta Contributors and Canonical Ltd 2012
86-# This file is distributed under the same license as the openobject-addons package.
87-# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
88-#
89-msgid ""
90-msgstr ""
91-"Project-Id-Version: openobject-addons\n"
92-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
93-"POT-Creation-Date: 2011-03-25 10:08+0000\n"
94-"PO-Revision-Date: 2012-04-18 23:39+0000\n"
95-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
96-"Language-Team: Catalan <ca@li.org>\n"
97-"MIME-Version: 1.0\n"
98-"Content-Type: text/plain; charset=UTF-8\n"
99-"Content-Transfer-Encoding: 8bit\n"
100-"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n"
101-"X-Generator: Launchpad (build 16335)\n"
102-
103-#. module: product_pricelist_fixed_price
104-#: view:product.pricelist.item:0
105-msgid "Max. Margin"
106-msgstr "Marge màxim"
107-
108-#. module: product_pricelist_fixed_price
109-#: view:product.pricelist.item:0
110-msgid "Min. Margin"
111-msgstr "Marge mínim"
112-
113-#. module: product_pricelist_fixed_price
114-#: view:product.pricelist.item:0
115-msgid "Rounding Method"
116-msgstr "Mètode arrodoniment"
117-
118-#. module: product_pricelist_fixed_price
119-#: constraint:product.pricelist.item:0
120-msgid ""
121-"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList "
122-"Item!"
123-msgstr ""
124-"Error! No podeu assignar la tarifa principal com una altre tarifa en un "
125-"element de la tarifa."
126-
127-#. module: product_pricelist_fixed_price
128-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
129-msgid "Pricelist"
130-msgstr "Tarifa"
131-
132-#. module: product_pricelist_fixed_price
133-#: code:addons/product_pricelist_fixed_price/pricelist.py:97
134-#, python-format
135-msgid "Warning !"
136-msgstr "Atenció!"
137-
138-#. module: product_pricelist_fixed_price
139-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
140-msgid "Pricelist item"
141-msgstr "Element de la tarifa"
142-
143-#. module: product_pricelist_fixed_price
144-#: code:addons/product_pricelist_fixed_price/pricelist.py:32
145-#: field:product.pricelist.item,fixed_price:0
146-#, python-format
147-msgid "Fixed Price"
148-msgstr "Preu fix"
149
150=== removed file 'product_pricelist_fixed_price/i18n/de.po'
151--- product_pricelist_fixed_price/i18n/de.po 2012-12-05 05:42:11 +0000
152+++ product_pricelist_fixed_price/i18n/de.po 1970-01-01 00:00:00 +0000
153@@ -1,65 +0,0 @@
154-# German translation for openobject-addons
155-# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
156-# This file is distributed under the same license as the openobject-addons package.
157-# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
158-#
159-msgid ""
160-msgstr ""
161-"Project-Id-Version: openobject-addons\n"
162-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
163-"POT-Creation-Date: 2011-03-25 10:08+0000\n"
164-"PO-Revision-Date: 2011-05-02 07:47+0000\n"
165-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
166-"Language-Team: German <de@li.org>\n"
167-"MIME-Version: 1.0\n"
168-"Content-Type: text/plain; charset=UTF-8\n"
169-"Content-Transfer-Encoding: 8bit\n"
170-"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n"
171-"X-Generator: Launchpad (build 16335)\n"
172-
173-#. module: product_pricelist_fixed_price
174-#: view:product.pricelist.item:0
175-msgid "Max. Margin"
176-msgstr "Max. Spanne"
177-
178-#. module: product_pricelist_fixed_price
179-#: view:product.pricelist.item:0
180-msgid "Min. Margin"
181-msgstr "Min. Spanne"
182-
183-#. module: product_pricelist_fixed_price
184-#: view:product.pricelist.item:0
185-msgid "Rounding Method"
186-msgstr "Rundungsverfahren"
187-
188-#. module: product_pricelist_fixed_price
189-#: constraint:product.pricelist.item:0
190-msgid ""
191-"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList "
192-"Item!"
193-msgstr ""
194-"Fehler! Sie können die Basispreisliste nicht als alternative Preisliste in "
195-"einem Preislisteneintrag zuweisen."
196-
197-#. module: product_pricelist_fixed_price
198-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
199-msgid "Pricelist"
200-msgstr "Preisliste"
201-
202-#. module: product_pricelist_fixed_price
203-#: code:addons/product_pricelist_fixed_price/pricelist.py:97
204-#, python-format
205-msgid "Warning !"
206-msgstr "Warnung!"
207-
208-#. module: product_pricelist_fixed_price
209-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
210-msgid "Pricelist item"
211-msgstr "Preisliste Einzelposition"
212-
213-#. module: product_pricelist_fixed_price
214-#: code:addons/product_pricelist_fixed_price/pricelist.py:32
215-#: field:product.pricelist.item,fixed_price:0
216-#, python-format
217-msgid "Fixed Price"
218-msgstr "Festpreis"
219
220=== removed file 'product_pricelist_fixed_price/i18n/es.po'
221--- product_pricelist_fixed_price/i18n/es.po 2012-12-05 05:42:11 +0000
222+++ product_pricelist_fixed_price/i18n/es.po 1970-01-01 00:00:00 +0000
223@@ -1,65 +0,0 @@
224-# Spanish translation for openobject-addons
225-# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011
226-# This file is distributed under the same license as the openobject-addons package.
227-# FIRST AUTHOR <EMAIL@ADDRESS>, 2011.
228-#
229-msgid ""
230-msgstr ""
231-"Project-Id-Version: openobject-addons\n"
232-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
233-"POT-Creation-Date: 2011-03-25 10:08+0000\n"
234-"PO-Revision-Date: 2011-08-26 23:18+0000\n"
235-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
236-"Language-Team: Spanish <es@li.org>\n"
237-"MIME-Version: 1.0\n"
238-"Content-Type: text/plain; charset=UTF-8\n"
239-"Content-Transfer-Encoding: 8bit\n"
240-"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n"
241-"X-Generator: Launchpad (build 16335)\n"
242-
243-#. module: product_pricelist_fixed_price
244-#: view:product.pricelist.item:0
245-msgid "Max. Margin"
246-msgstr "Margen máximo"
247-
248-#. module: product_pricelist_fixed_price
249-#: view:product.pricelist.item:0
250-msgid "Min. Margin"
251-msgstr "Margen mínimo"
252-
253-#. module: product_pricelist_fixed_price
254-#: view:product.pricelist.item:0
255-msgid "Rounding Method"
256-msgstr "Método redondeo"
257-
258-#. module: product_pricelist_fixed_price
259-#: constraint:product.pricelist.item:0
260-msgid ""
261-"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList "
262-"Item!"
263-msgstr ""
264-"¡Error! No puede asignar la tarifa principal como otra tarifa en un "
265-"elemento de la tarifa."
266-
267-#. module: product_pricelist_fixed_price
268-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
269-msgid "Pricelist"
270-msgstr "Lista de Precios"
271-
272-#. module: product_pricelist_fixed_price
273-#: code:addons/product_pricelist_fixed_price/pricelist.py:97
274-#, python-format
275-msgid "Warning !"
276-msgstr "¡Atención!"
277-
278-#. module: product_pricelist_fixed_price
279-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
280-msgid "Pricelist item"
281-msgstr "Elemento de la tarifa"
282-
283-#. module: product_pricelist_fixed_price
284-#: code:addons/product_pricelist_fixed_price/pricelist.py:32
285-#: field:product.pricelist.item,fixed_price:0
286-#, python-format
287-msgid "Fixed Price"
288-msgstr "Precio fijo"
289
290=== removed file 'product_pricelist_fixed_price/i18n/it.po'
291--- product_pricelist_fixed_price/i18n/it.po 2012-12-05 05:42:11 +0000
292+++ product_pricelist_fixed_price/i18n/it.po 1970-01-01 00:00:00 +0000
293@@ -1,64 +0,0 @@
294-# Translation of OpenERP Server.
295-# This file contains the translation of the following modules:
296-# * product_pricelist_fixed_price
297-#
298-msgid ""
299-msgstr ""
300-"Project-Id-Version: OpenERP Server 6.0.1\n"
301-"Report-Msgid-Bugs-To: support@openerp.com\n"
302-"POT-Creation-Date: 2011-03-25 10:08+0000\n"
303-"PO-Revision-Date: 2011-03-31 12:02+0000\n"
304-"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>\n"
305-"Language-Team: \n"
306-"MIME-Version: 1.0\n"
307-"Content-Type: text/plain; charset=UTF-8\n"
308-"Content-Transfer-Encoding: 8bit\n"
309-"X-Launchpad-Export-Date: 2012-12-05 05:42+0000\n"
310-"X-Generator: Launchpad (build 16335)\n"
311-
312-#. module: product_pricelist_fixed_price
313-#: view:product.pricelist.item:0
314-msgid "Max. Margin"
315-msgstr "Margine Massimo"
316-
317-#. module: product_pricelist_fixed_price
318-#: view:product.pricelist.item:0
319-msgid "Min. Margin"
320-msgstr "Margine Minimo"
321-
322-#. module: product_pricelist_fixed_price
323-#: view:product.pricelist.item:0
324-msgid "Rounding Method"
325-msgstr "Metodo Arrotondamento"
326-
327-#. module: product_pricelist_fixed_price
328-#: constraint:product.pricelist.item:0
329-msgid ""
330-"Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList "
331-"Item!"
332-msgstr ""
333-"Errore ! Non è possibile assegnare il listino principale come 'altro "
334-"listino' nell'elemento di listino!"
335-
336-#. module: product_pricelist_fixed_price
337-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
338-msgid "Pricelist"
339-msgstr "Listino Prezzi"
340-
341-#. module: product_pricelist_fixed_price
342-#: code:addons/product_pricelist_fixed_price/pricelist.py:97
343-#, python-format
344-msgid "Warning !"
345-msgstr "attenzione !"
346-
347-#. module: product_pricelist_fixed_price
348-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
349-msgid "Pricelist item"
350-msgstr "Oggetto Listino"
351-
352-#. module: product_pricelist_fixed_price
353-#: code:addons/product_pricelist_fixed_price/pricelist.py:32
354-#: field:product.pricelist.item,fixed_price:0
355-#, python-format
356-msgid "Fixed Price"
357-msgstr "Prezzo fisso"
358
359=== added file 'product_pricelist_fixed_price/i18n/nl.po'
360--- product_pricelist_fixed_price/i18n/nl.po 1970-01-01 00:00:00 +0000
361+++ product_pricelist_fixed_price/i18n/nl.po 2014-02-03 14:58:49 +0000
362@@ -0,0 +1,175 @@
363+# Translation of OpenERP Server.
364+# This file contains the translation of the following modules:
365+# * product_pricelist_fixed_price
366+# <ronald@therp.nl> <>, 2014.
367+#
368+msgid ""
369+msgstr ""
370+"Project-Id-Version: OpenERP Server 7.0\n"
371+"Report-Msgid-Bugs-To: \n"
372+"POT-Creation-Date: 2014-01-27 14:11+0000\n"
373+"PO-Revision-Date: 2014-01-27 15:37+0100\n"
374+"Last-Translator: <ronald@therp.nl>\n"
375+"Language-Team:\n"
376+"Language: nl_NL\n"
377+"MIME-Version: 1.0\n"
378+"Content-Type: text/plain; charset=UTF-8\n"
379+"Content-Transfer-Encoding: \n"
380+"Plural-Forms: \n"
381+"X-Generator: Gtranslator 2.91.6\n"
382+
383+#. module: product_pricelist_fixed_price
384+#: model:ir.actions.act_window,help:product_pricelist_fixed_price.product_fixedprice_version_action
385+msgid ""
386+"<p class=\"oe_view_nocontent_create\">\n"
387+" Click to add a pricelist version.\n"
388+" </p><p>\n"
389+" There can be more than one version of a pricelist, each of\n"
390+" these must be valid during a certain period of time. Some\n"
391+" examples of versions: Main Prices, 2010, 2011, Summer "
392+"Sales,\n"
393+" etc.\n"
394+" </p>\n"
395+" "
396+msgstr ""
397+"<p class=\"oe_view_nocontent_create\">\n"
398+" Klik om een prijslijst versie toe te voegen.\n"
399+" </p><p>\n"
400+" Er kan meer dan één versie van een prijslijst zijn. Ieder\n"
401+" daarvan moet een bepaalde tijd geldig zijn. Voorbeelden van\n"
402+" versies: Standaard prijzen, 2010, 2011, Zomer-uitverkoop, "
403+"etc.\n"
404+" </p>\n"
405+"..............."
406+
407+#. module: product_pricelist_fixed_price
408+#: model:ir.actions.act_window,help:product_pricelist_fixed_price.product_fixedprice_action
409+msgid ""
410+"<p class=\"oe_view_nocontent_create\">\n"
411+" Click to add a pricelist.\n"
412+" </p><p>\n"
413+" There can be more than one version of a pricelist, each of\n"
414+" these must be valid during a certain period of time. Some\n"
415+" examples of versions: Main Prices, 2010, 2011, Summer "
416+"Sales,\n"
417+" etc.\n"
418+" </p>\n"
419+" "
420+msgstr ""
421+"<p class=\"oe_view_nocontent_create\">\n"
422+" Klik om een prijslijst toe te voegen.\n"
423+" </p><p>\n"
424+" Er kan meer dan één versie van een prijslijst zijn. Ieder\n"
425+" daarvan moet een bepaalde tijd geldig zijn. Voorbeelden van\n"
426+" versies: Standaard prijzen, 2010, 2011, Zomer-uitverkoop, "
427+"etc.\n"
428+" </p>"
429+
430+#. module: product_pricelist_fixed_price
431+#: view:product.pricelist.version:0
432+msgid "Fixed Pricelist Version"
433+msgstr "Vaste prijslijst versie"
434+
435+#. module: product_pricelist_fixed_price
436+#: model:ir.actions.act_window,name:product_pricelist_fixed_price.product_fixedprice_version_action
437+#: model:ir.ui.menu,name:product_pricelist_fixed_price.product_fixedprice_version_menu
438+msgid "Fixed Pricelist versions"
439+msgstr "Vaste prijslijst versies"
440+
441+#. module: product_pricelist_fixed_price
442+#: model:ir.actions.act_window,name:product_pricelist_fixed_price.product_fixedprice_action
443+#: model:ir.ui.menu,name:product_pricelist_fixed_price.product_fixedprice_menu
444+msgid "Fixed Pricelists"
445+msgstr "Vaste prijslijsten"
446+
447+#. module: product_pricelist_fixed_price
448+#: field:product.pricelist,fixed_price:0
449+#: field:product.pricelist.item,fixed_price:0
450+#: field:product.pricelist.version,fixed_price:0
451+msgid "Fixed price"
452+msgstr "Vaste prijs"
453+
454+#. module: product_pricelist_fixed_price
455+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:80
456+#, python-format
457+msgid "Fixed price item only valid on fixed pricelist."
458+msgstr "Vaste prijs regel alleen geldig op een vaste prijslijst."
459+
460+#. module: product_pricelist_fixed_price
461+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:26
462+#, python-format
463+msgid "Fixed price version only valid on fixed pricelist."
464+msgstr "Vaste prijsversie alleen geldig voor een vaste prijslijst"
465+
466+#. module: product_pricelist_fixed_price
467+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:73
468+#, python-format
469+msgid "Fixed pricelist should have fixed price items."
470+msgstr "Vaste prijslijst moet vaste prijs regels hebben."
471+
472+#. module: product_pricelist_fixed_price
473+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:19
474+#, python-format
475+msgid "Fixed pricelist should have fixed price versions."
476+msgstr "Vaste prijslijst moet vaste prijs versies hebben."
477+
478+#. module: product_pricelist_fixed_price
479+#: view:product.pricelist.item:0
480+msgid "Price"
481+msgstr "Prijs"
482+
483+#. module: product_pricelist_fixed_price
484+#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
485+msgid "Pricelist"
486+msgstr "Prijslijst"
487+
488+#. module: product_pricelist_fixed_price
489+#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_version
490+msgid "Pricelist Version"
491+msgstr "Prijslijst versie"
492+
493+#. module: product_pricelist_fixed_price
494+#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
495+msgid "Pricelist item"
496+msgstr "Prijslijst regel"
497+
498+#. module: product_pricelist_fixed_price
499+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:85
500+#, python-format
501+msgid "Product required for fixed price item."
502+msgstr "Produkt verplicht op vaste prijs regel"
503+
504+#. module: product_pricelist_fixed_price
505+#: view:product.pricelist.item:0
506+msgid "Products Fixed Price Items"
507+msgstr "Vaste prijs regels voor producten"
508+
509+#. module: product_pricelist_fixed_price
510+#: view:product.pricelist:0
511+msgid "Products Fixed Price List"
512+msgstr "Vaste prijslijst voor produkten"
513+
514+#. module: product_pricelist_fixed_price
515+#: view:product.pricelist:0
516+msgid "Products Fixed Price Search"
517+msgstr "Zoeken in vaste prijzen voor produkten"
518+
519+#. module: product_pricelist_fixed_price
520+#: view:product.pricelist:0
521+msgid "Products Price"
522+msgstr "Produktprijzen"
523+
524+#. module: product_pricelist_fixed_price
525+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:72
526+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:79
527+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:84
528+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:18
529+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:25
530+#, python-format
531+msgid "Validation error!"
532+msgstr "Validatie fout!"
533+
534+#. module: product_pricelist_fixed_price
535+#: constraint:product.pricelist.item:0
536+msgid "invalid values for fixed price"
537+msgstr "Ongeldige waarden voor vaste prijs"
538
539=== modified file 'product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot'
540--- product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot 2011-04-01 10:14:05 +0000
541+++ product_pricelist_fixed_price/i18n/product_pricelist_fixed_price.pot 2014-02-03 14:58:49 +0000
542@@ -4,10 +4,10 @@
543 #
544 msgid ""
545 msgstr ""
546-"Project-Id-Version: OpenERP Server 6.0.1\n"
547-"Report-Msgid-Bugs-To: support@openerp.com\n"
548-"POT-Creation-Date: 2011-03-25 10:08+0000\n"
549-"PO-Revision-Date: 2011-03-25 10:08+0000\n"
550+"Project-Id-Version: OpenERP Server 7.0\n"
551+"Report-Msgid-Bugs-To: \n"
552+"POT-Creation-Date: 2014-01-27 14:11+0000\n"
553+"PO-Revision-Date: 2014-01-27 14:11+0000\n"
554 "Last-Translator: <>\n"
555 "Language-Team: \n"
556 "MIME-Version: 1.0\n"
557@@ -16,45 +16,153 @@
558 "Plural-Forms: \n"
559
560 #. module: product_pricelist_fixed_price
561-#: view:product.pricelist.item:0
562-msgid "Max. Margin"
563-msgstr ""
564-
565-#. module: product_pricelist_fixed_price
566-#: view:product.pricelist.item:0
567-msgid "Min. Margin"
568-msgstr ""
569-
570-#. module: product_pricelist_fixed_price
571-#: view:product.pricelist.item:0
572-msgid "Rounding Method"
573-msgstr ""
574-
575-#. module: product_pricelist_fixed_price
576-#: constraint:product.pricelist.item:0
577-msgid "Error ! You cannot assign the Main Pricelist as Other Pricelist in PriceList Item!"
578-msgstr ""
579+#: model:ir.actions.act_window,help:product_pricelist_fixed_price.product_fixedprice_action
580+msgid "<p class=\"oe_view_nocontent_create\">\n"
581+" Click to add a pricelist.\n"
582+" </p><p>\n"
583+" There can be more than one version of a pricelist, each of\n"
584+" these must be valid during a certain period of time. Some\n"
585+" examples of versions: Main Prices, 2010, 2011, Summer Sales,\n"
586+" etc.\n"
587+" </p>\n"
588+" "
589+msgstr "<p class=\"oe_view_nocontent_create\">\n"
590+" Click to add a pricelist.\n"
591+" </p><p>\n"
592+" There can be more than one version of a pricelist, each of\n"
593+" these must be valid during a certain period of time. Some\n"
594+" examples of versions: Main Prices, 2010, 2011, Summer Sales,\n"
595+" etc.\n"
596+" </p>\n"
597+" "
598+
599+#. module: product_pricelist_fixed_price
600+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:80
601+#, python-format
602+msgid "Fixed price item only valid on fixed pricelist."
603+msgstr "Fixed price item only valid on fixed pricelist."
604+
605+#. module: product_pricelist_fixed_price
606+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:19
607+#, python-format
608+msgid "Fixed pricelist should have fixed price versions."
609+msgstr "Fixed pricelist should have fixed price versions."
610+
611+#. module: product_pricelist_fixed_price
612+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:72
613+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:79
614+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:84
615+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:18
616+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:25
617+#, python-format
618+msgid "Validation error!"
619+msgstr "Validation error!"
620+
621+#. module: product_pricelist_fixed_price
622+#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_version
623+msgid "Pricelist Version"
624+msgstr "Pricelist Version"
625+
626+#. module: product_pricelist_fixed_price
627+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_version.py:26
628+#, python-format
629+msgid "Fixed price version only valid on fixed pricelist."
630+msgstr "Fixed price version only valid on fixed pricelist."
631+
632+#. module: product_pricelist_fixed_price
633+#: model:ir.actions.act_window,help:product_pricelist_fixed_price.product_fixedprice_version_action
634+msgid "<p class=\"oe_view_nocontent_create\">\n"
635+" Click to add a pricelist version.\n"
636+" </p><p>\n"
637+" There can be more than one version of a pricelist, each of\n"
638+" these must be valid during a certain period of time. Some\n"
639+" examples of versions: Main Prices, 2010, 2011, Summer Sales,\n"
640+" etc.\n"
641+" </p>\n"
642+" "
643+msgstr "<p class=\"oe_view_nocontent_create\">\n"
644+" Click to add a pricelist version.\n"
645+" </p><p>\n"
646+" There can be more than one version of a pricelist, each of\n"
647+" these must be valid during a certain period of time. Some\n"
648+" examples of versions: Main Prices, 2010, 2011, Summer Sales,\n"
649+" etc.\n"
650+" </p>\n"
651+" "
652+
653+#. module: product_pricelist_fixed_price
654+#: view:product.pricelist:0
655+msgid "Products Fixed Price Search"
656+msgstr "Products Fixed Price Search"
657+
658+#. module: product_pricelist_fixed_price
659+#: view:product.pricelist.version:0
660+msgid "Fixed Pricelist Version"
661+msgstr "Fixed Pricelist Version"
662+
663+#. module: product_pricelist_fixed_price
664+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:85
665+#, python-format
666+msgid "Product required for fixed price item."
667+msgstr "Product required for fixed price item."
668+
669+#. module: product_pricelist_fixed_price
670+#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
671+msgid "Pricelist item"
672+msgstr "Pricelist item"
673+
674+#. module: product_pricelist_fixed_price
675+#: view:product.pricelist.item:0
676+msgid "Products Fixed Price Items"
677+msgstr "Products Fixed Price Items"
678+
679+#. module: product_pricelist_fixed_price
680+#: view:product.pricelist:0
681+msgid "Products Price"
682+msgstr "Products Price"
683+
684+#. module: product_pricelist_fixed_price
685+#: model:ir.actions.act_window,name:product_pricelist_fixed_price.product_fixedprice_action
686+#: model:ir.ui.menu,name:product_pricelist_fixed_price.product_fixedprice_menu
687+msgid "Fixed Pricelists"
688+msgstr "Fixed Pricelists"
689+
690+#. module: product_pricelist_fixed_price
691+#: view:product.pricelist:0
692+msgid "Products Fixed Price List"
693+msgstr "Products Fixed Price List"
694
695 #. module: product_pricelist_fixed_price
696 #: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist
697 msgid "Pricelist"
698-msgstr ""
699-
700-#. module: product_pricelist_fixed_price
701-#: code:addons/product_pricelist_fixed_price/pricelist.py:97
702-#, python-format
703-msgid "Warning !"
704-msgstr ""
705-
706-#. module: product_pricelist_fixed_price
707-#: model:ir.model,name:product_pricelist_fixed_price.model_product_pricelist_item
708-msgid "Pricelist item"
709-msgstr ""
710-
711-#. module: product_pricelist_fixed_price
712-#: code:addons/product_pricelist_fixed_price/pricelist.py:32
713+msgstr "Pricelist"
714+
715+#. module: product_pricelist_fixed_price
716+#: constraint:product.pricelist.item:0
717+msgid "invalid values for fixed price"
718+msgstr "invalid values for fixed price"
719+
720+#. module: product_pricelist_fixed_price
721+#: model:ir.actions.act_window,name:product_pricelist_fixed_price.product_fixedprice_version_action
722+#: model:ir.ui.menu,name:product_pricelist_fixed_price.product_fixedprice_version_menu
723+msgid "Fixed Pricelist versions"
724+msgstr "Fixed Pricelist versions"
725+
726+#. module: product_pricelist_fixed_price
727+#: view:product.pricelist.item:0
728+msgid "Price"
729+msgstr "Price"
730+
731+#. module: product_pricelist_fixed_price
732+#: field:product.pricelist,fixed_price:0
733 #: field:product.pricelist.item,fixed_price:0
734+#: field:product.pricelist.version,fixed_price:0
735+msgid "Fixed price"
736+msgstr "Fixed price"
737+
738+#. module: product_pricelist_fixed_price
739+#: code:addons/product_pricelist_fixed_price/model/product_pricelist_item.py:73
740 #, python-format
741-msgid "Fixed Price"
742-msgstr ""
743+msgid "Fixed pricelist should have fixed price items."
744+msgstr "Fixed pricelist should have fixed price items."
745
746
747=== added directory 'product_pricelist_fixed_price/model'
748=== added file 'product_pricelist_fixed_price/model/__init__.py'
749--- product_pricelist_fixed_price/model/__init__.py 1970-01-01 00:00:00 +0000
750+++ product_pricelist_fixed_price/model/__init__.py 2014-02-03 14:58:49 +0000
751@@ -0,0 +1,5 @@
752+# -*- encoding: utf-8 -*-
753+from . import product_pricelist
754+from . import product_pricelist_version
755+from . import product_pricelist_item
756+
757
758=== added file 'product_pricelist_fixed_price/model/product_pricelist.py'
759--- product_pricelist_fixed_price/model/product_pricelist.py 1970-01-01 00:00:00 +0000
760+++ product_pricelist_fixed_price/model/product_pricelist.py 2014-02-03 14:58:49 +0000
761@@ -0,0 +1,34 @@
762+#-*- coding: utf-8 -*-
763+##############################################################################
764+#
765+# OpenERP, Open Source Management Solution
766+# Copyright (C) 2014 Therp BV (<http://www.therp.nl>).
767+#
768+# This program is free software: you can redistribute it and/or modify
769+# it under the terms of the GNU Affero General Public License as
770+# published by the Free Software Foundation, either version 3 of the
771+# License, or (at your option) any later version.
772+#
773+# This program is distributed in the hope that it will be useful,
774+# but WITHOUT ANY WARRANTY; without even the implied warranty of
775+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
776+# GNU Affero General Public License for more details.
777+#
778+# You should have received a copy of the GNU Affero General Public License
779+# along with this program. If not, see <http://www.gnu.org/licenses/>.
780+#
781+##############################################################################
782+
783+from openerp.osv import orm, fields
784+
785+
786+class ProductPricelist(orm.Model):
787+ _inherit = 'product.pricelist'
788+
789+ _columns = {
790+ 'fixed_price': fields.boolean(
791+ 'Fixed price',
792+ help='Pricelist intended for fixed prices.',
793+ ),
794+ }
795+
796
797=== added file 'product_pricelist_fixed_price/model/product_pricelist_item.py'
798--- product_pricelist_fixed_price/model/product_pricelist_item.py 1970-01-01 00:00:00 +0000
799+++ product_pricelist_fixed_price/model/product_pricelist_item.py 2014-02-03 14:58:49 +0000
800@@ -0,0 +1,117 @@
801+#-*- coding: utf-8 -*-
802+##############################################################################
803+#
804+# OpenERP, Open Source Management Solution
805+# Copyright (C) 2014 Therp BV (<http://www.therp.nl>).
806+#
807+# This program is free software: you can redistribute it and/or modify
808+# it under the terms of the GNU Affero General Public License as
809+# published by the Free Software Foundation, either version 3 of the
810+# License, or (at your option) any later version.
811+#
812+# This program is distributed in the hope that it will be useful,
813+# but WITHOUT ANY WARRANTY; without even the implied warranty of
814+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
815+# GNU Affero General Public License for more details.
816+#
817+# You should have received a copy of the GNU Affero General Public License
818+# along with this program. If not, see <http://www.gnu.org/licenses/>.
819+#
820+##############################################################################
821+
822+'''All functionality to enable fixed prices in pricelists.'''
823+
824+from openerp.osv import orm, fields
825+from openerp.tools.translate import _
826+
827+
828+class ProductPricelistItem(orm.Model):
829+ '''Inherit existing model to add functionality for fixed prices'''
830+ _inherit = 'product.pricelist.item'
831+
832+ def _modify_vals(self, cr, uid, vals, browse_obj=None, context=None):
833+ '''Ensure consistent values for fixed pricelists.
834+ The passed vals parameter is used for both input and output.'''
835+ # First determine wether a fixed price should apply
836+ fixed_price = False
837+ if browse_obj:
838+ fixed_price = browse_obj.fixed_price
839+ else:
840+ # new record
841+ fixed_price = (
842+ ('fixed_price' in vals and vals['fixed_price']) or
843+ ('default_fixed_price' in vals
844+ and vals['default_fixed_price']) or
845+ False
846+ )
847+ if not fixed_price:
848+ return
849+ # If we get here, we have a fixed price, because we need some
850+ # reference to a price in product (even though its influence will be
851+ # eliminated by our price_discount), we use the standard price
852+ model_model = self.pool.get('ir.model.data')
853+ standard_price_type = model_model.get_object_reference(
854+ cr, uid, 'product', 'standard_price')[1]
855+ vals.update({
856+ 'price_discount': -1.0,
857+ 'price_round': 0.0,
858+ 'base': standard_price_type,
859+ 'price_min_margin': 0.0,
860+ 'price_max_margin': 0.0,
861+ })
862+
863+ def create(self, cr, uid, vals, context=None):
864+ '''Make sure fixed pricelist items have consistent values'''
865+ self._modify_vals(cr, uid, vals, browse_obj=None, context=context)
866+ return super(ProductPricelistItem, self).create(
867+ cr, uid, vals, context)
868+
869+ def write(self, cr, uid, ids, vals, context=None):
870+ '''Override write method. We have to take into account that
871+ we only get one set of values, but that the change might effect
872+ multiple ids. But because the computations we do might be different
873+ depending on the current values in the database, we will setup a loop
874+ and compute and update each record separately.
875+ '''
876+ for item_id in ids:
877+ browse_records = self.browse(cr, uid, [item_id], context=context)
878+ browse_obj = browse_records[0]
879+ self._modify_vals(
880+ cr, uid, vals, browse_obj=browse_obj, context=context)
881+ super(ProductPricelistItem, self).write(
882+ cr, uid, [item_id], vals, context=context)
883+ return True
884+
885+ def onchange_fixed_price(
886+ self, cr, uid, ids, fixed_price, context=None):
887+ res = {}
888+ if fixed_price:
889+ vals = {'fixed_price': True}
890+ self._modify_vals(cr, uid, vals, context=context)
891+ res['value'] = vals
892+ return res
893+
894+ _columns = {
895+ 'fixed_price': fields.boolean('Fixed price'),
896+ }
897+
898+ def _check_fixed_price(self, cr, uid, ids):
899+ '''Ensure fixed prices always refer to a specific product.'''
900+ for this_obj in self.browse(cr, uid, ids):
901+ if not this_obj.fixed_price:
902+ return True
903+ if not this_obj.product_id:
904+ raise orm.except_orm(
905+ _('Validation error!'),
906+ _('Product required for fixed price item.')
907+ )
908+ # Values for price_discount and price_round will not be checked,
909+ # because create and write will automagically set appropiate
910+ # values.
911+ return True
912+
913+ _constraints = [
914+ (_check_fixed_price,
915+ 'invalid values for fixed price', ['fixed_price']),
916+ ]
917+
918
919=== added file 'product_pricelist_fixed_price/model/product_pricelist_version.py'
920--- product_pricelist_fixed_price/model/product_pricelist_version.py 1970-01-01 00:00:00 +0000
921+++ product_pricelist_fixed_price/model/product_pricelist_version.py 2014-02-03 14:58:49 +0000
922@@ -0,0 +1,35 @@
923+#-*- coding: utf-8 -*-
924+##############################################################################
925+#
926+# OpenERP, Open Source Management Solution
927+# Copyright (C) 2014 Therp BV (<http://www.therp.nl>).
928+#
929+# This program is free software: you can redistribute it and/or modify
930+# it under the terms of the GNU Affero General Public License as
931+# published by the Free Software Foundation, either version 3 of the
932+# License, or (at your option) any later version.
933+#
934+# This program is distributed in the hope that it will be useful,
935+# but WITHOUT ANY WARRANTY; without even the implied warranty of
936+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
937+# GNU Affero General Public License for more details.
938+#
939+# You should have received a copy of the GNU Affero General Public License
940+# along with this program. If not, see <http://www.gnu.org/licenses/>.
941+#
942+##############################################################################
943+
944+from openerp.osv import orm, fields
945+from openerp.tools.translate import _
946+
947+
948+class ProductPricelistVersion(orm.Model):
949+ _inherit = 'product.pricelist.version'
950+
951+ _columns = {
952+ 'fixed_price': fields.boolean(
953+ 'Fixed price',
954+ help='Pricelist intended for fixed prices.',
955+ ),
956+ }
957+
958
959=== removed file 'product_pricelist_fixed_price/pricelist.py'
960--- product_pricelist_fixed_price/pricelist.py 2011-04-01 10:14:05 +0000
961+++ product_pricelist_fixed_price/pricelist.py 1970-01-01 00:00:00 +0000
962@@ -1,211 +0,0 @@
963-# -*- encoding: utf-8 -*-
964-##############################################################################
965-#
966-# OpenERP, Open Source Management Solution
967-# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.com>).
968-#
969-# This program is free software: you can redistribute it and/or modify
970-# it under the terms of the GNU Affero General Public License as
971-# published by the Free Software Foundation, either version 3 of the
972-# License, or (at your option) any later version.
973-#
974-# This program is distributed in the hope that it will be useful,
975-# but WITHOUT ANY WARRANTY; without even the implied warranty of
976-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
977-# GNU Affero General Public License for more details.
978-#
979-# You should have received a copy of the GNU Affero General Public License
980-# along with this program. If not, see <http://www.gnu.org/licenses/>.
981-#
982-##############################################################################
983-
984-from osv import fields,osv
985-from tools.translate import _
986-import decimal_precision as dp
987-import time
988-from product._common import rounding
989-
990-class product_pricelist_item(osv.osv):
991-
992- def _price_field_get(self, cr, uid, context=None):
993- result = super(product_pricelist_item, self)._price_field_get(cr, uid, context)
994- result.append((-3, _('Fixed Price')))
995- return result
996-
997- _inherit = "product.pricelist.item"
998-
999- _columns = {
1000- 'fixed_price': fields.float('Fixed Price',
1001- digits_compute= dp.get_precision('Sale Price')),
1002- 'base': fields.selection(_price_field_get, 'Based on', required=True, size=-1, help="The mode for computing the price for this rule."),
1003- }
1004-
1005-product_pricelist_item()
1006-
1007-class product_pricelist(osv.osv):
1008- _inherit = "product.pricelist"
1009-
1010- def price_get_multi(self, cr, uid, pricelist_ids, products_by_qty_by_partner, context=None):
1011-
1012- def _create_parent_category_list(id, lst):
1013- if not id:
1014- return []
1015- parent = product_category_tree.get(id)
1016- if parent:
1017- lst.append(parent)
1018- return _create_parent_category_list(parent, lst)
1019- else:
1020- return lst
1021- # _create_parent_category_list
1022-
1023- if context is None:
1024- context = {}
1025-
1026- date = time.strftime('%Y-%m-%d')
1027- if 'date' in context:
1028- date = context['date']
1029-
1030- currency_obj = self.pool.get('res.currency')
1031- product_obj = self.pool.get('product.product')
1032- product_category_obj = self.pool.get('product.category')
1033- product_uom_obj = self.pool.get('product.uom')
1034- supplierinfo_obj = self.pool.get('product.supplierinfo')
1035- price_type_obj = self.pool.get('product.price.type')
1036- product_pricelist_version_obj = self.pool.get('product.pricelist.version')
1037-
1038- # product.pricelist.version:
1039- if pricelist_ids:
1040- pricelist_version_ids = pricelist_ids
1041- else:
1042- # all pricelists:
1043- pricelist_version_ids = self.pool.get('product.pricelist').search(cr, uid, [], context=context)
1044-
1045- pricelist_version_ids = list(set(pricelist_version_ids))
1046- plversions_search_args = [
1047- ('pricelist_id', 'in', pricelist_version_ids),
1048- '|',
1049- ('date_start', '=', False),
1050- ('date_start', '<=', date),
1051- '|',
1052- ('date_end', '=', False),
1053- ('date_end', '>=', date),
1054- ]
1055-
1056- plversion_ids = product_pricelist_version_obj.search(cr, uid, plversions_search_args)
1057- if len(pricelist_version_ids) != len(plversion_ids):
1058- msg = "At least one pricelist has no active version !\nPlease create or activate one."
1059- raise osv.except_osv(_('Warning !'), _(msg))
1060-
1061- # product.product:
1062- product_ids = [i[0] for i in products_by_qty_by_partner]
1063- #products = dict([(item['id'], item) for item in product_obj.read(cr, uid, product_ids, ['categ_id', 'product_tmpl_id', 'uos_id', 'uom_id'])])
1064- products = product_obj.browse(cr, uid, product_ids, context=context)
1065- products_dict = dict([(item.id, item) for item in products])
1066-
1067- # product.category:
1068- product_category_ids = product_category_obj.search(cr, uid, [])
1069- product_categories = product_category_obj.read(cr, uid, product_category_ids, ['parent_id'])
1070- product_category_tree = dict([(item['id'], item['parent_id'][0]) for item in product_categories if item['parent_id']])
1071-
1072- results = {}
1073- for product_id, qty, partner in products_by_qty_by_partner:
1074- for pricelist_id in pricelist_version_ids:
1075- price = False
1076-
1077- tmpl_id = products_dict[product_id].product_tmpl_id and products_dict[product_id].product_tmpl_id.id or False
1078-
1079- categ_id = products_dict[product_id].categ_id and products_dict[product_id].categ_id.id or False
1080- categ_ids = _create_parent_category_list(categ_id, [categ_id])
1081- if categ_ids:
1082- categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))'
1083- else:
1084- categ_where = '(categ_id IS NULL)'
1085-
1086- cr.execute(
1087- 'SELECT i.*, pl.currency_id '
1088- 'FROM product_pricelist_item AS i, '
1089- 'product_pricelist_version AS v, product_pricelist AS pl '
1090- 'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) '
1091- 'AND (product_id IS NULL OR product_id = %s) '
1092- 'AND (' + categ_where + ' OR (categ_id IS NULL)) '
1093- 'AND price_version_id = %s '
1094- 'AND (min_quantity IS NULL OR min_quantity <= %s) '
1095- 'AND i.price_version_id = v.id AND v.pricelist_id = pl.id '
1096- 'ORDER BY sequence',
1097- (tmpl_id, product_id, plversion_ids[0], qty))
1098- res1 = cr.dictfetchall()
1099- uom_price_already_computed = False
1100- for res in res1:
1101- if res:
1102- if res['base'] == -1:
1103- if not res['base_pricelist_id']:
1104- price = 0.0
1105- else:
1106- price_tmp = self.price_get(cr, uid,
1107- [res['base_pricelist_id']], product_id,
1108- qty, context=context)[res['base_pricelist_id']]
1109- ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id
1110- price = currency_obj.compute(cr, uid, ptype_src, res['currency_id'], price_tmp, round=False)
1111- elif res['base'] == -2:
1112- # this section could be improved by moving the queries outside the loop:
1113- where = []
1114- if partner:
1115- where = [('name', '=', partner) ]
1116- sinfo = supplierinfo_obj.search(cr, uid,
1117- [('product_id', '=', tmpl_id)] + where)
1118- price = 0.0
1119- if sinfo:
1120- qty_in_product_uom = qty
1121- product_default_uom = product_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
1122- seller_uom = supplierinfo_obj.read(cr, uid, sinfo, ['product_uom'])[0]['product_uom'][0]
1123- if seller_uom and product_default_uom and product_default_uom != seller_uom:
1124- uom_price_already_computed = True
1125- qty_in_product_uom = product_uom_obj._compute_qty(cr, uid, product_default_uom, qty, to_uom_id=seller_uom)
1126- cr.execute('SELECT * ' \
1127- 'FROM pricelist_partnerinfo ' \
1128- 'WHERE suppinfo_id IN %s' \
1129- 'AND min_quantity <= %s ' \
1130- 'ORDER BY min_quantity DESC LIMIT 1', (tuple(sinfo),qty_in_product_uom,))
1131- res2 = cr.dictfetchone()
1132- if res2:
1133- price = res2['price']
1134- elif res['base'] == -3:
1135- price = res['fixed_price']
1136- else:
1137- price_type = price_type_obj.browse(cr, uid, int(res['base']))
1138- price = currency_obj.compute(cr, uid,
1139- price_type.currency_id.id, res['currency_id'],
1140- product_obj.price_get(cr, uid, [product_id],
1141- price_type.field,context=context)[product_id], round=False, context=context)
1142-
1143- if price:
1144- price_limit = price
1145-
1146- price = price * (1.0+(res['price_discount'] or 0.0))
1147- price = rounding(price, res['price_round'])
1148- price += (res['price_surcharge'] or 0.0)
1149- if res['price_min_margin']:
1150- price = max(price, price_limit+res['price_min_margin'])
1151- if res['price_max_margin']:
1152- price = min(price, price_limit+res['price_max_margin'])
1153- break
1154-
1155- else:
1156- # False means no valid line found ! But we may not raise an
1157- # exception here because it breaks the search
1158- price = False
1159-
1160- if price:
1161- if 'uom' in context and not uom_price_already_computed:
1162- product = products_dict[product_id]
1163- uom = product.uos_id or product.uom_id
1164- price = self.pool.get('product.uom')._compute_price(cr, uid, uom.id, price, context['uom'])
1165-
1166- if results.get(product_id):
1167- results[product_id][pricelist_id] = price
1168- else:
1169- results[product_id] = {pricelist_id: price}
1170-
1171- return results
1172-
1173-product_pricelist()
1174
1175=== removed file 'product_pricelist_fixed_price/pricelist_view.xml'
1176--- product_pricelist_fixed_price/pricelist_view.xml 2011-04-01 10:14:05 +0000
1177+++ product_pricelist_fixed_price/pricelist_view.xml 1970-01-01 00:00:00 +0000
1178@@ -1,76 +0,0 @@
1179-<?xml version="1.0" encoding="UTF-8"?>
1180-<openerp>
1181- <data>
1182- <record model="ir.ui.view" id="product_pricelist_item_form_view_fixed">
1183- <field name="name">product.pricelist.item.form.fixed</field>
1184- <field name="model">product.pricelist.item</field>
1185- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1186- <field name="type">form</field>
1187- <field name="arch" type="xml">
1188- <field name="price_max_margin" position="after">
1189- <field name="fixed_price" colspan="3" attrs="{'readonly': [('base','!=', -3)]}"/>
1190- </field>
1191- </field>
1192- </record>
1193-
1194- <record model="ir.ui.view" id="product_pricelist_item_form_view_price_discount">
1195- <field name="name">product.pricelist.item.form.price_discount</field>
1196- <field name="model">product.pricelist.item</field>
1197- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1198- <field name="type">form</field>
1199- <field name="arch" type="xml">
1200- <field name="price_discount" position="replace">
1201- <field name="price_discount" nolabel="1" attrs="{'readonly': [('base','==', -3)]}"/>
1202- </field>
1203- </field>
1204- </record>
1205-
1206- <record model="ir.ui.view" id="product_pricelist_item_form_view_price_surcharge">
1207- <field name="name">product.pricelist.item.form.price_surcharge</field>
1208- <field name="model">product.pricelist.item</field>
1209- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1210- <field name="type">form</field>
1211- <field name="arch" type="xml">
1212- <field name="price_surcharge" position="replace">
1213- <field name="price_surcharge" nolabel="1" attrs="{'readonly': [('base','==', -3)]}"/>
1214- </field>
1215- </field>
1216- </record>
1217-
1218- <record model="ir.ui.view" id="product_pricelist_item_form_view_price_round">
1219- <field name="name">product.pricelist.item.form.price_round</field>
1220- <field name="model">product.pricelist.item</field>
1221- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1222- <field name="type">form</field>
1223- <field name="arch" type="xml">
1224- <field name="price_round" position="replace">
1225- <field name="price_round" string="Rounding Method" attrs="{'readonly': [('base','==', -3)]}"/>
1226- </field>
1227- </field>
1228- </record>
1229-
1230- <record model="ir.ui.view" id="product_pricelist_item_form_view_price_min_margin">
1231- <field name="name">product.pricelist.item.form.price_min_margin</field>
1232- <field name="model">product.pricelist.item</field>
1233- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1234- <field name="type">form</field>
1235- <field name="arch" type="xml">
1236- <field name="price_min_margin" position="replace">
1237- <field name="price_min_margin" string="Min. Margin" attrs="{'readonly': [('base','==', -3)]}"/>
1238- </field>
1239- </field>
1240- </record>
1241-
1242- <record model="ir.ui.view" id="product_pricelist_item_form_view_price_max_margin">
1243- <field name="name">product.pricelist.item.form.price_max_margin</field>
1244- <field name="model">product.pricelist.item</field>
1245- <field name="inherit_id" ref="product.product_pricelist_item_form_view"/>
1246- <field name="type">form</field>
1247- <field name="arch" type="xml">
1248- <field name="price_max_margin" position="replace">
1249- <field name="price_max_margin" string="Max. Margin" attrs="{'readonly': [('base','==', -3)]}"/>
1250- </field>
1251- </field>
1252- </record>
1253- </data>
1254-</openerp>
1255
1256=== added directory 'product_pricelist_fixed_price/view'
1257=== added file 'product_pricelist_fixed_price/view/pricelist_menu.xml'
1258--- product_pricelist_fixed_price/view/pricelist_menu.xml 1970-01-01 00:00:00 +0000
1259+++ product_pricelist_fixed_price/view/pricelist_menu.xml 2014-02-03 14:58:49 +0000
1260@@ -0,0 +1,109 @@
1261+<?xml version="1.0" encoding="utf-8"?>
1262+<openerp>
1263+ <data>
1264+
1265+ <record id="product_fixedprice_action" model="ir.actions.act_window">
1266+ <field name="name">Fixed Pricelists</field>
1267+ <field name="type">ir.actions.act_window</field>
1268+ <field name="res_model">product.pricelist</field>
1269+ <field name="view_type">form</field>
1270+ <field name="domain">[('fixed_price', '=', True)]</field>
1271+ <field name="context">{'default_fixed_price': True}</field>
1272+ <field name="view_id" ref="product_fixedprice_tree"/>
1273+ <field name="help" type="html">
1274+ <p class="oe_view_nocontent_create">
1275+ Click to add a pricelist.
1276+ </p><p>
1277+ There can be more than one version of a pricelist, each of
1278+ these must be valid during a certain period of time. Some
1279+ examples of versions: Main Prices, 2010, 2011, Summer Sales,
1280+ etc.
1281+ </p>
1282+ </field>
1283+ </record>
1284+
1285+ <record
1286+ id="product_fixedprice_action_tree"
1287+ model="ir.actions.act_window.view"
1288+ >
1289+ <field name="sequence" eval="99"/>
1290+ <field name="view_mode">tree</field>
1291+ <field name="view_id" ref="product_fixedprice_tree"/>
1292+ <field name="act_window_id" ref="product_fixedprice_action"/>
1293+ </record>
1294+
1295+ <record
1296+ id="product_fixedprice_action_form"
1297+ model="ir.actions.act_window.view"
1298+ >
1299+ <field name="sequence" eval="99"/>
1300+ <field name="view_mode">form</field>
1301+ <field name="view_id" ref="product_fixedprice_form"/>
1302+ <field name="act_window_id" ref="product_fixedprice_action"/>
1303+ </record>
1304+
1305+ <record
1306+ id="product_fixedprice_version_action"
1307+ model="ir.actions.act_window"
1308+ >
1309+ <field name="name">Fixed Pricelist versions</field>
1310+ <field name="type">ir.actions.act_window</field>
1311+ <field name="res_model">product.pricelist.version</field>
1312+ <field name="view_type">form</field>
1313+ <field name="domain">[('fixed_price', '=', True)]</field>
1314+ <field name="context">{'default_fixed_price': True}</field>
1315+ <field name="view_id" ref="product_fixedprice_version_tree"/>
1316+ <field name="help" type="html">
1317+ <p class="oe_view_nocontent_create">
1318+ Click to add a pricelist version.
1319+ </p><p>
1320+ There can be more than one version of a pricelist, each of
1321+ these must be valid during a certain period of time. Some
1322+ examples of versions: Main Prices, 2010, 2011, Summer Sales,
1323+ etc.
1324+ </p>
1325+ </field>
1326+ </record>
1327+
1328+ <record
1329+ id="product_fixedprice_version_action_tree"
1330+ model="ir.actions.act_window.view"
1331+ >
1332+ <field name="sequence" eval="99"/>
1333+ <field name="view_mode">tree</field>
1334+ <field name="view_id" ref="product_fixedprice_version_tree"/>
1335+ <field
1336+ name="act_window_id"
1337+ ref="product_fixedprice_version_action"
1338+ />
1339+ </record>
1340+
1341+ <record
1342+ id="product_fixedprice_version_action_form"
1343+ model="ir.actions.act_window.view"
1344+ >
1345+ <field name="sequence" eval="99"/>
1346+ <field name="view_mode">form</field>
1347+ <field name="view_id" ref="product_fixedprice_version_form"/>
1348+ <field
1349+ name="act_window_id"
1350+ ref="product_fixedprice_version_action"
1351+ />
1352+ </record>
1353+
1354+ <menuitem
1355+ id="product_fixedprice_menu"
1356+ action="product_fixedprice_action"
1357+ parent="product.menu_product_pricelist_main"
1358+ sequence="22"
1359+ />
1360+
1361+ <menuitem
1362+ id="product_fixedprice_version_menu"
1363+ action="product_fixedprice_version_action"
1364+ parent="product.menu_product_pricelist_main"
1365+ sequence="24"
1366+ />
1367+
1368+ </data>
1369+</openerp>
1370
1371=== added file 'product_pricelist_fixed_price/view/pricelist_view.xml'
1372--- product_pricelist_fixed_price/view/pricelist_view.xml 1970-01-01 00:00:00 +0000
1373+++ product_pricelist_fixed_price/view/pricelist_view.xml 2014-02-03 14:58:49 +0000
1374@@ -0,0 +1,268 @@
1375+<?xml version="1.0" encoding="utf-8"?>
1376+<openerp>
1377+ <data>
1378+
1379+ <!-- Basically this file contains simplified versions of the views
1380+ for pricelist items, pricelist versions and pricelists.
1381+ The views contain only the fields needed to add fixed prices.
1382+ Actually the surcharche field is used for the fixed price, while
1383+ the discount_factor is set to -1 to eliminate the role of the
1384+ base price.
1385+ For fixed prices product_id is (ofcourse?) required.
1386+ -->
1387+
1388+ <!-- Pricelist item -->
1389+
1390+ <record id="product_fixedprice_item_tree" model="ir.ui.view">
1391+ <field name="name">product.fixedprice.item.tree</field>
1392+ <field name="model">product.pricelist.item</field>
1393+ <field name="priority">99</field>
1394+ <field name="arch" type="xml">
1395+ <tree string="Products Fixed Price Items">
1396+ <field
1397+ name="name"
1398+ invisible="1"
1399+ />
1400+ <field
1401+ name="fixed_price"
1402+ />
1403+ <field name="product_id"/>
1404+ <field
1405+ name="product_tmpl_id"
1406+ groups="product.group_product_variant"
1407+ />
1408+ <field name="min_quantity"/>
1409+ <field
1410+ name="price_surcharge"
1411+ string="Price"
1412+ />
1413+ </tree>
1414+ </field>
1415+ </record>
1416+
1417+ <record id="product_fixedprice_item_form" model="ir.ui.view">
1418+ <field name="name">product.fixedprice.item.form</field>
1419+ <field name="model">product.pricelist.item</field>
1420+ <field name="priority">99</field>
1421+ <field name="arch" type="xml">
1422+ <form string="Products Fixed Price Items" version="7.0">
1423+ <field
1424+ name="name"
1425+ invisible="1"
1426+ />
1427+ <field
1428+ name="price_discount"
1429+ invisible="1"
1430+ />
1431+ <group col="4">
1432+ <field name="fixed_price" />
1433+ <field
1434+ name="product_id"
1435+ on_change="product_id_change(product_id)"
1436+ required="1"
1437+ />
1438+ <field
1439+ name="product_tmpl_id"
1440+ groups="product.group_product_variant"
1441+ />
1442+ <field
1443+ name="company_id"
1444+ groups="base.group_multi_company"
1445+ widget="selection"
1446+ />
1447+ <field name="min_quantity"/>
1448+ <field
1449+ name="price_surcharge"
1450+ string="Price"
1451+ />
1452+ </group>
1453+ </form>
1454+ </field>
1455+ </record>
1456+
1457+
1458+ <!-- Pricelist version -->
1459+
1460+ <record id="product_fixedprice_version_tree" model="ir.ui.view">
1461+ <field name="name">product.fixedprice.version.tree</field>
1462+ <field name="model">product.pricelist.version</field>
1463+ <field name="priority">99</field>
1464+ <field name="arch" type="xml">
1465+ <tree string="Fixed Pricelist Version">
1466+ <field
1467+ name="fixed_price"
1468+ invisible="1"
1469+ />
1470+ <field name="name"/>
1471+ <field name="pricelist_id"/>
1472+ <field name="date_start"/>
1473+ <field name="date_end"/>
1474+ </tree>
1475+ </field>
1476+ </record>
1477+
1478+ <record id="product_fixedprice_version_form" model="ir.ui.view">
1479+ <field name="name">product.fixedprice.version.form</field>
1480+ <field name="model">product.pricelist.version</field>
1481+ <field name="priority">99</field>
1482+ <field name="arch" type="xml">
1483+ <form string="Fixed Pricelist Version" version="7.0" >
1484+ <group col="4">
1485+ <field name="name"/>
1486+ <field name="active"/>
1487+ <field
1488+ colspan="4"
1489+ name="pricelist_id"
1490+ domain="[('fixed_price', '=', True),]"
1491+ />
1492+ <field name="date_start"/>
1493+ <field name="date_end"/>
1494+ <field
1495+ name="company_id"
1496+ groups="base.group_multi_company"
1497+ widget="selection"
1498+ />
1499+ <field name="fixed_price" />
1500+ </group>
1501+ <p></p>
1502+ <field
1503+ name="items_id"
1504+ context="{
1505+ 'form_view_ref': 'product_pricelist_fixed_price.product_fixedprice_item_form',
1506+ 'tree_view_ref': 'product_pricelist_fixed_price.product_fixedprice_item_tree',
1507+ 'default_fixed_price': True,
1508+ 'default_price_discount': -1,
1509+ }"
1510+ />
1511+ </form>
1512+ </field>
1513+ </record>
1514+
1515+
1516+ <!-- Pricelist -->
1517+
1518+ <record model="ir.ui.view" id="product_fixedprice_search">
1519+ <field name="name">product.fixedprice.search</field>
1520+ <field name="model">product.pricelist</field>
1521+ <field name="priority">99</field>
1522+ <field name="arch" type="xml">
1523+ <search string="Products Fixed Price Search">
1524+ <field name="name" string="Products Price"/>
1525+ <field name="type"/>
1526+ <field name="active" />
1527+ <field
1528+ name="currency_id"
1529+ groups="base.group_multi_currency"
1530+ />
1531+ </search>
1532+ </field>
1533+ </record>
1534+
1535+ <record id="product_fixedprice_tree" model="ir.ui.view">
1536+ <field name="name">product.fixedprice.tree</field>
1537+ <field name="model">product.pricelist</field>
1538+ <field name="priority">99</field>
1539+ <field name="arch" type="xml">
1540+ <tree string="Products Fixed Price List">
1541+ <field name="name"/>
1542+ <field name="type"/>
1543+ <field
1544+ name="currency_id"
1545+ groups="base.group_multi_currency"
1546+ />
1547+ <field name="active" />
1548+ </tree>
1549+ </field>
1550+ </record>
1551+
1552+ <record id="product_fixedprice_form" model="ir.ui.view">
1553+ <field name="name">product.fixedprice.form</field>
1554+ <field name="model">product.pricelist</field>
1555+ <field name="priority">99</field>
1556+ <field name="arch" type="xml">
1557+ <form string="Products Fixed Price List" version="7.0" >
1558+ <field name="name"/>
1559+ <group col="4">
1560+ <field name="active"/>
1561+ <field name="type"/>
1562+ <field
1563+ name="currency_id"
1564+ groups="base.group_multi_currency"
1565+ />
1566+ <field
1567+ name="company_id"
1568+ groups="base.group_multi_company"
1569+ widget="selection"
1570+ />
1571+ </group>
1572+ <p></p>
1573+ <field
1574+ name="version_id"
1575+ context="{
1576+ 'form_view_ref': 'product_pricelist_fixed_price.product_fixedprice_version_form',
1577+ 'tree_view_ref': 'product_pricelist_fixed_price.product_fixedprice_version_tree',
1578+ 'default_pricelist_id': active_id,
1579+ 'default_fixed_price': True,
1580+ }"
1581+ />
1582+ </form>
1583+ </field>
1584+ </record>
1585+
1586+ <!-- Add fixed price info to standard tree -->
1587+ <record id="pricelist_item_tree_inherit" model="ir.ui.view">
1588+ <field name="name">pricelist.item.tree.inherit</field>
1589+ <field name="model">product.pricelist.item</field>
1590+ <field
1591+ name="inherit_id"
1592+ ref="product.product_pricelist_item_tree_view"
1593+ />
1594+ <field name="arch" type="xml">
1595+ <field name="base" position="after">
1596+ <field name="fixed_price" />
1597+ <field name="price_surcharge" />
1598+ </field>
1599+ </field>
1600+ </record>
1601+
1602+ <!-- Add functionality for fixed prices also to standard form -->
1603+ <record id="pricelist_item_form_inherit" model="ir.ui.view">
1604+ <field name="name">pricelist.item.form.inherit</field>
1605+ <field name="model">product.pricelist.item</field>
1606+ <field
1607+ name="inherit_id"
1608+ ref="product.product_pricelist_item_form_view"
1609+ />
1610+ <field name="arch" type="xml">
1611+ <field name="sequence" position="after">
1612+ <field
1613+ name="fixed_price"
1614+ on_change="onchange_fixed_price(fixed_price, context)"
1615+ attrs="{'invisible':[('product_id','=',False)]}"
1616+ />
1617+ </field>
1618+ <field name="price_discount" position="attributes">
1619+ <attribute
1620+ name="attrs">{'readonly':[('fixed_price','=',True)]}
1621+ </attribute>
1622+ </field>
1623+ <field name="price_round" position="attributes">
1624+ <attribute
1625+ name="attrs">{'readonly':[('fixed_price','=',True)]}
1626+ </attribute>
1627+ </field>
1628+ <field name="price_min_margin" position="attributes">
1629+ <attribute
1630+ name="attrs">{'readonly':[('fixed_price','=',True)]}
1631+ </attribute>
1632+ </field>
1633+ <field name="price_max_margin" position="attributes">
1634+ <attribute
1635+ name="attrs">{'readonly':[('fixed_price','=',True)]}
1636+ </attribute>
1637+ </field>
1638+ </field>
1639+ </record>
1640+
1641+ </data>
1642+</openerp>

Subscribers

People subscribed via source and target branches