[7.0/trunk] sale line margin is not computed if no product is selected

Bug #1218212 reported by Andrius Preimantas @ hbee
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Low
OpenERP R&D Addons Team 3

Bug Description

addons revno: 9358

Steps to reproduce:
1. Install sale_margin module
2. Create sale order line with Product, Cost Price and Price fields set
3. Save sale order and observe Margin field correctly computed
4. Open the same line and remove Product field (leaving Cost Price and Price fields as they were)
5. Save sale order and observe Margin field NOT computing at all

It turns out, if no product is selected, the system just ignores margin, although values for Cost Price and Price which are mandatory to compute margin is present.

Please see patch attached

Tags: margin sale

Related branches

Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Amit Parik (amit-parik)
tags: added: margin sale
Revision history for this message
Yogesh Parekh(OpenERP) (yogesh.parekh-openerp) wrote :

Hello,

       It has been fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1218212-ypa

      Revision id = <email address hidden>

     Revision no = 8876

     It will be available in trunk soon.

Thanks

Changed in openobject-addons:
status: Confirmed → Fix Committed
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Andrius, Twinkle and Yogesh.

I don't agree that bug is valid . If we don't have product then we can't calculate the margin because basically margin will be calculate based on product. If there is no product on sale order line when margin is not calculated which is good enough.
we have calculated the margin for check that how much margin we got for particular product

So I think the current behavior is good , For now I am not consider this as a valid bug.

@Andrius : would you please provide a real use case which will satisfy this requirement then after we can decide the correct status of this bug report meanwhile I am setting this as a "Invaild". If you have a better use case and good example you can feel free to reopen this.

Thank you!

Changed in openobject-addons:
status: Fix Committed → Invalid
Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :

IMHO the *margin* in question is in the context of sale order, not product. If we want to decide whether current behavior is wrong or not, we need to set clear distinction between those two. Having this in mind I'll try to differentiate those two concepts:
1. Margin of sale order: when I know margin of sale order I can answer this simple question "Is it worth selling this set of items?". I'm not particularly interested in knowing margin of every product, I'm interesting whether this sale order is profitable for me or not.
2. Margin of product: this answers question "Is it worth selling this product?". This provides me information if product I'm producing/reselling is worth doing so.

So as sale_margin attaches computed value to Sale Order, I believe this should be in the context of Sale Order, not Product. I'm not saying that you are wrong saying
"we have calculated the margin for check that how much margin we got for particular product", it just seems like you are talking about Margin in context of a Product, instead of Margin in context of a Sale Order.

Looking for your opinion.
Thanks
Andrius

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Andrius,

Thanks for the good explanation!
Which is clear enough now for mark this issue as a valid.

Thank you!

Revision history for this message
Andrius Preimantas @ hbee (andrius-preimantas) wrote :

Amit,

I appreciate your understanding.

Thank You

Revision history for this message
Amit Parik (amit-parik) wrote :

oppps, I forget to change the status, let me change it.

Thanks!

Changed in openobject-addons:
status: Invalid → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.