openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #16618
[Bug 1066127] Re: The return packing wizard doesn't take into accout the field "Invoice control"
** Changed in: openobject-addons
Status: Confirmed => In Progress
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1066127
Title:
The return packing wizard doesn't take into accout the field "Invoice
control"
Status in OpenERP Addons (modules):
In Progress
Bug description:
Here is the scenario of the bug on OpenERP 6.1 (and also OpenERP trunk) :
1. Create a new DB and install the "sale" module (and "stock" module on OpenERP trunk)
2. Create a new sale order for Agrolait with one sale order line with product CPU1. Set "Invoice Policy" to "Invoice based on deliveries" and confirm this sale order.
3. Go to the delivery order that has been generated. Process it and create the customer invoice (you need to create the customer invoice, otherwise the bug doesn't happen).
4. On the picking, click on the button "Return Products". In the wizard, set "Invoicing" to "No invoicing" and click on the "Return" button to generate the Return picking.
5. Open the return picking and look at the field "Invoice control" : the value is "To be invoiced" ! That's the bug : as we set in the return picking wizard the field "Invoicing" to "No invoicing", the value of the field "Invoice control" should be "Not applicable".
Analysis of the code and solution for OpenERP 6.1 :
If you look at addons-6.1/stock/wizard/stock_return_picking.py line 171, you see that the return picking is copied from the original picking, and, in the dict that is passed to the copy() function, there is "invoice_state": <the_value_of_the_wizard>... so it should work ! But, if you look at addons-61/stock/stock.py line 700, in the definition of the "copy()" function for the object stock.picking, you see :
if picking_obj.invoice_state == 'invoiced':
default['invoice_state'] = '2binvoiced'
So, if when original picking has invoice_state = 'Invoiced", then the
return picking always has invoice_state = "To be invoiced", whatever
the content of the "default" dict is... so whatever the user sets in
the "Return product" wizard !
My patch changes this code : invoice_state is set to "2binvoiced" if
the original picking has invoice_state = 'invoiced' AND the "default"
dict doesn't have an "invoice_state" key. In fact, there is the same
kind of code 5 lines above, in the previous "if", so it seems to be a
natural solution for me.
The bug and the solution is the same on addons/trunk.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1066127/+subscriptions
References