partial picking wizard generate wrong invoice

Bug #1060259 reported by Gustavo Cordero on 2012-10-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 2

Bug Description

When you use Receive Products wizard (stock.partial.picking) from a "To Be Invoiced" picking (defined from the purchase order property Based on incoming shipments), the result invoice reflects the products and quantities of the backorder (the picking don't received yet) instead to reflects the real products and quantities received and registered in the Receive Products wizard.

I added this code to fix this :

=== modificado archivo stock_invoice_directly/wizard/stock_invoice.py
--- stock_invoice_directly/wizard/stock_invoice.py 2011-10-16 01:28:00 +0000
+++ stock_invoice_directly/wizard/stock_invoice.py 2012-10-02 14:22:35 +0000
@@ -32,7 +32,7 @@
         result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
         partial = self.browse(cr, uid, ids[0], context)
         context.update(active_model='stock.picking',
- active_ids=[partial.picking_id.id])
+ active_ids=[partial.picking_id.backorder_id.id])
         if partial.picking_id.invoice_state == '2binvoiced':
             return {
                 'name': 'Create Invoice',

Openerp Addons trunk7.0 r.7555

Related branches

Changed in openobject-addons:
status: New → Confirmed
importance: Undecided → Medium
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)

 Hello,

           It has been Fixed in https://bugs.launchpad.net/openobject-addons/+bug/1060259
           Revno: 7895
           Revision ID: <email address hidden>

Thanks,
 pja

Changed in openobject-addons:
status: Confirmed → Fix Committed

I have tested this again in trunk without the branch and this works as it should.

Changed in openobject-addons:
status: Fix Committed → Fix Released
Yann Papouin (yann-papouin) wrote :

To works correctly, the backorder_id field must be set to False when creating the new return picking

in "stock_return_picking.py"
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s-%s-return' % (new_pick_name, pick.name),

otherwise it will use the backorder_id of the original picking object -> invalid

Fix for 6.1, 7.1, trunk is necessary

Yann Papouin (yann-papouin) wrote :

Please reopen

Alexis de Lattre (alexis-via) wrote :

The bug is still present in OpenERP 7.0.

The code of the merge proposal https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1060259-pja/+merge/132096 works well on an up-to-date OpenERP 7.0. What is preventing the merge proposal from being accepted and merged in the stable branch ?

Alexis de Lattre (alexis-via) wrote :

In fact, my previous comment was wrong, the merge proposal doesn't work : here is the bug scenario with the code of the merge proposal :
You have a picking with 3 products :
1) you do a partial delivery of 1 product -> the generated invoice is OK and has 1 product.
2) you deliver the last 2 products -> you get an error message "This picking list does not require invoicing."

When you look at the code and the exact behavior of the 2 pickings, you understand that, at step 2, the "active_id" variable in the do_partial() function of stock_invoice_directly/wizard/stock_invoice.py contains the ID the "done" picking with 1 products, and not the ID of the picking with 2 products.

Hi Alexis,

Could you please check the attached branch for 7.0 and provide your feedback?

Regards,
Rifakat

Hello,

As mentioned by Alexis, the initial patch did not work.
Instead I have made similar patch but also testing the state of the picking as well. This was merged in 7.0

revno: 9540 [merge]
revision-id: <email address hidden>

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers