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

Proposed by Ronald Portier (Therp)
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp
Proposed branch: lp://staging/~therp-nl/openerp-product-attributes/7.0_lp1272282_fixed_price
Merge into: lp://staging/~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://staging/~therp-nl/openerp-product-attributes/7.0_lp1272282_fixed_price
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Needs Information
Yannick Vaucher @ Camptocamp Disapprove
Lionel Sausin - Initiatives/Numérigraphe (community) functionnal and code Approve
Pedro Manuel Baeza Needs Fixing
Leonardo Pistone Abstain
Ronald Portier (Therp) (community) Needs Resubmitting
Review via email: mp+203348@code.staging.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.
Revision history for this message
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)
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

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.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

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

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

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
Revision history for this message
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)

[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)

[FIX] Wrong layout in fixed pricelist version view.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

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: Needs Resubmitting
Revision history for this message
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
Revision history for this message
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
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

@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?

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

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)
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

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.

Revision history for this message
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.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

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
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

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
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

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)

[FIX] Wrong layout in fixed pricelist version view.

232. By Ronald Portier (Therp)

[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)

[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
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches