Merge lp:~elicoidal/purchase-wkfl/purchase-wkfl-fix-0001 into lp:~purchase-core-editors/purchase-wkfl/7.0

Proposed by Eric Caudal - www.elico-corp.com
Status: Rejected
Rejected by: Guewen Baconnier @ Camptocamp
Proposed branch: lp:~elicoidal/purchase-wkfl/purchase-wkfl-fix-0001
Merge into: lp:~purchase-core-editors/purchase-wkfl/7.0
Diff against target: 30 lines (+3/-3)
1 file modified
purchase_landed_costs/purchase.py (+3/-3)
To merge this branch: bzr merge lp:~elicoidal/purchase-wkfl/purchase-wkfl-fix-0001
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Disapprove
Leonardo Pistone code review Disapprove
Guewen Baconnier @ Camptocamp Disapprove
Alexandre Fayolle - camptocamp code review, no test Needs Information
Review via email: mp+208758@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Can I suggest using the "value if condition else other_value" construct rather than "condition and value or other_value"

the former is more explicit and does not suffer from the possible unintended behavior you get when value is False (you get other_value in that case even if condition is True).

review: Needs Information (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I think there's no side effect on the expression. It's also used everywhere on OpenERP core.

Regards.

review: Approve (code review)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> I think there's no side effect on the expression. It's also used everywhere on
> OpenERP core.
>
> Regards.

Being used everywhere on OpenERP is not a good rationale.

Eric, the changes on the lines 9 and 27 of the diff are not correct: `prod_obj._choose_exp_account_from` expects a browse_record.

I proposed a correct fix [0] hence I reject this patch.

Thanks anyway

[0] https://code.launchpad.net/~camptocamp/purchase-wkfl/7.0-browse_record_error-1287159/+merge/209056

review: Disapprove
Revision history for this message
Leonardo Pistone (lepistone) wrote :

To back Alexandre's point, here is a bug caused by the and-or trick:

https://bugs.launchpad.net/openobject-addons/+bug/1190592

review: Disapprove (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

OK, I see what's your point. It's convenient to rename them variables with the suffix _id to differentiate browse_record instances from id variables.

Regards.

review: Disapprove

Unmerged revisions

29. By <elicoidal <email address hidden>> <email address hidden>

[FIX] fiscal position

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'purchase_landed_costs/purchase.py'
--- purchase_landed_costs/purchase.py 2013-12-12 15:34:53 +0000
+++ purchase_landed_costs/purchase.py 2014-02-28 10:15:58 +0000
@@ -281,7 +281,7 @@
281 apply_on = 'order'281 apply_on = 'order'
282 po_obj = self.pool.get('purchase.order')282 po_obj = self.pool.get('purchase.order')
283 po = po_obj.browse(cr, uid, purchase_order_id, context=context)283 po = po_obj.browse(cr, uid, purchase_order_id, context=context)
284 fiscal_position = po.fiscal_position or False284 fiscal_position = po.fiscal_position and po.fiscal_position.id or False
285 else:285 else:
286 apply_on = 'line'286 apply_on = 'line'
287 if not product_id:287 if not product_id:
@@ -550,7 +550,7 @@
550 po = (landed_cost.purchase_order_id or550 po = (landed_cost.purchase_order_id or
551 landed_cost.purchase_order_line_id.order_id)551 landed_cost.purchase_order_line_id.order_id)
552 currency_id = landed_cost.purchase_order_id.pricelist_id.currency_id.id552 currency_id = landed_cost.purchase_order_id.pricelist_id.currency_id.id
553 fiscal_position = po.fiscal_position or False553 fiscal_position = po.fiscal_position and po.fiscal_position.id or False
554 journal_obj = self.pool.get('account.journal')554 journal_obj = self.pool.get('account.journal')
555 journal_ids = journal_obj.search(555 journal_ids = journal_obj.search(
556 cr, uid,556 cr, uid,
@@ -587,7 +587,7 @@
587 vals_inv = self._prepare_landed_cost_inv(cr, uid, landed_cost,587 vals_inv = self._prepare_landed_cost_inv(cr, uid, landed_cost,
588 context=context)588 context=context)
589 inv_id = invoice_obj.create(cr, uid, vals_inv, context=context)589 inv_id = invoice_obj.create(cr, uid, vals_inv, context=context)
590 fiscal_position = (po.fiscal_position or False)590 fiscal_position = po.fiscal_position and po.fiscal_position.id or False
591 exp_account_id = prod_obj._choose_exp_account_from(591 exp_account_id = prod_obj._choose_exp_account_from(
592 cr, uid,592 cr, uid,
593 landed_cost.product_id,593 landed_cost.product_id,

Subscribers

People subscribed via source and target branches