[sale] inconsistent workflow status check for sale.order

Bug #582320 reported by Raphaël Valyi - http://www.akretion.com
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

Hello,

Under some circumstances (can't remember exactly the manipulation but is related to picking/invoice cancellation), the "sale.order" workflow can become stuck because of a wrong check.

Indeed, the sale.order can by definition have only the following states:
        'state': fields.selection([
            ('draft', 'Quotation'),
            ('waiting_date', 'Waiting Schedule'),
            ('manual', 'Manual In Progress'),
            ('progress', 'In Progress'),
            ('shipping_except', 'Shipping Exception'),
            ('invoice_except', 'Invoice Exception'),
            ('done', 'Done'),
            ('cancel', 'Cancelled')
            ]

But in the sale.order#action_invoice_create method, we check the state against:
states=['confirmed', 'done', 'exception']
the "exception" state simply doesn't exist or doesn't exist anymore. I guess "invoice_except" should be used instead.

BTW, I'm not a pythonista, but I find it strange to test things against strings, I would have used constants in order to avoid using such strings mismatch, at least that's how Java, C++ guys would do and I'm pretty sure this would be a good practise in Python too.

I had to apply the following patch (also attached) to make it work:

=== modified file 'sale/sale.py'
--- sale/sale.py 2010-04-08 13:39:40 +0000
+++ sale/sale.py 2010-05-11 19:55:07 +0000
@@ -407,7 +407,7 @@
         inv_obj.button_compute(cr, uid, [inv_id])
         return inv_id

- def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception']):
+ def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'invoice_except']):
         res = False
         invoices = {}
         invoice_ids = []

Hope this helps.

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Raphaël Valyi ,

The state check being made at action_invioce_create() is upto the mark and it should have the list of states of sale order line,not of Sale Order.

The aim of putting such a check is, if the sale order line is not among those listed states(a draft line), can be invoiced.

I wonder when could it have blocked you?
Hope this helps.
Thanks.

Changed in openobject-addons:
milestone: none → 5.0.11
status: New → Invalid
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.