Merge lp://qastaging/~therp-nl/therp-backports/addons-6.1-lp754339_pricelist_on_invoice_line into lp://qastaging/therp-backports

Proposed by Ronald Portier (Therp)
Status: Merged
Merged at revision: 6713
Proposed branch: lp://qastaging/~therp-nl/therp-backports/addons-6.1-lp754339_pricelist_on_invoice_line
Merge into: lp://qastaging/therp-backports
Diff against target: 136 lines (+93/-24)
1 file modified
account/account_invoice.py (+93/-24)
To merge this branch: bzr merge lp://qastaging/~therp-nl/therp-backports/addons-6.1-lp754339_pricelist_on_invoice_line
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) Approve
Review via email: mp+157829@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2013-01-04.

Description of the change

FIX lp754339.

Use the standard mechanism for determining prices that is also used for sales and purchase orders, when creating an invoice without order.

Based on a patch by Salvi Angjeli

Rewritten using suggestions from Stefan Rijnhart

Main change is to make the interface between the product_change and the price_unit_get functions as small as possible.

Also use suffixes on variable names (_model, _obj, _id ... as conistent as possible).

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote : Posted in a previous version of this proposal

Thanks, good on the whole. Got a couple of details:

l.8-12,33,66 To avoid conflicts with the official branch, prevent changes in whitespace.

l.20-25 For the same reason do not refactor

l.95 should say 'warning=None' but it looks like you can replace the argument by an initialisation in the method itself

l.55,94 remove price argument

l.96 So many arguments to this method, I would like to see it having a docstring explaining what they are.

l.123 can say "res[field]" instead of "eval('res.' + field)", even in the case of browse records

l.101 this is actually the default date anyway for currency rates and pricelist lookups so it does not need to be in the context

l.104-109 make translatable

Overall, naming of model pools is pretty random (_obj, obj_, _model). Can you make it a bit more consistent?

Thanks,
Stefan.

review: Needs Fixing
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote : Posted in a previous version of this proposal

Oh, if you make l.104-109 translatable, you will need to pass the context.

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote : Posted in a previous version of this proposal

Did not succeed in removing all whitespace changes. Anyway, they move the code a lot to pep8.

I did add the context to the _price_unit_get method, while dropping a lot of the other parameters.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote : Posted in a previous version of this proposal

Thanks, that is already a great improvement on the original patch.

For the remaining changes in whitespace, you can simply copy the originally spaced l.9-12 from an older version of the file and undo pep8ification of l.21-25.

l.98,128: the substitution variables are supposed to be outside of the call to _()

review: Needs Fixing
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote : Posted in a previous version of this proposal

Shortcomings in price computation not solved by this merge are:
- The product_id_change method should have access to the invoice date. Because when retrieving
  prices, the invoice date should determine the prices in effect, instead of the current date.
- It should be possible to pass a 'target' currency to the price_get method of product_pricelist, to prevent the current double conversion taking place. Currency conversion should be done from pricelist currency to invoice currency, or no conversion when both are the same.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote : Posted in a previous version of this proposal

First of all, sorry for the delayed review.

As for l.9..13, I totally share the emotional argument for the refactoring but I want to avoid the practical risk of conflicts as much as possible. Any change in the line or in the line below will trigger a conflict. Note that I am currently looking into an automatic mechanism for updating the backports with the upstream branch, as suggested on the community mailing list. This is quite possible, but such a process necessarily stalls with every conflict it encounters. The necessary changes in the backported fixes cause conflicts enough and I am hoping not to have to intervene in this process for unnecessary conflicts too. I hope you understand.

Otherwise good.

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

I updated the merge proposal to do away with layout changes not related to the bug.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) :
review: Approve

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

to all changes: