Account: wrong invoice number sequence for fiscal year in a certain case

Bug #602188 reported by Numérigraphe
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Status tracked in Trunk
5.0
Fix Released
Undecided
Unassigned
Trunk
Invalid
Low
OpenERP R&D Addons Team 3

Bug Description

Using 5.0.10, there is a case where the wrong sequence is picked when you create an invoice.
- install accounts
- in the sequence for invoices (call it A), enter a new sequence for invoices in the current fiscal year (call it B)
- duplicate an invoice, create it in the current fiscal year
=> you should get a number from B, but you get a number from sequence A.

That's because the fiscal year is not passed in the context of sequence.get_id() in
action_number().

From the current code I gather that it works only if you set the sequence on the journal, but it should work without that.

Lionel.

Related branches

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Tentative fix committed to lp:~numerigraphe/openobject-addons/dev-5.0 in <email address hidden> .
Lionel

Changed in openobject-addons:
status: New → Fix Committed
Revision history for this message
Numérigraphe (numerigraphe) wrote :

Please don't merge lp:~numerigraphe/openobject-addons/dev-5.0 (it's not intended to be merged).
The fix for v5.0 was discussed with Stéphane (OpenERP) this afternoon, he's going to review it.

I'm also pushing a fix for the trunk to LP on a dedicated branch - this one can be merged.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Fixed by Stéphane in <email address hidden> but he forgot to link the commit to this bug.

Changed in openobject-addons:
status: Fix Committed → Fix Released
Changed in openobject-addons:
status: Fix Released → In Progress
Revision history for this message
Stephane Wirtel (OpenERP) (stephane-openerp) wrote :

Thank you Lionel.

I have to merge your branch for the trunk version.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

As it turns out, the fix committed by Stéphane won't work because the year is passed in the wrong context entry:
                 tmp_context = {
+<<<<<<< WRONG
                     'fiscal_year_id' : obj_inv.period_id.fiscalyear_id.id,
                     'test' : True,
+=======
+ 'fiscalyear_id': obj_inv.period_id.fiscalyear_id.id
+>>>>>>> RIGHT
                 }

Revision history for this message
Numérigraphe (numerigraphe) wrote :

New fix in <email address hidden> committed by Stéphane just in time for v5.0.12.

Changed in openobject-addons:
status: In Progress → Fix Released
Changed in openobject-addons:
milestone: none → 5.0.12
Revision history for this message
Numérigraphe (numerigraphe) wrote :

I've added an XML test file to make sure the bug remains fixed, I'm going to submit the branches for merging.
Lionel

Changed in openobject-addons:
status: Fix Released → Fix Committed
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

This is already fixed in stable code.

Thanks.

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) wrote :

This is not fixed in current trunk code.
The related code is merged partially so please refer the merge proposal code.

Thanks.

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Hello Numérigraphe,

         I have tested in Trunk Addons3 branch as per scenario described and it works fine. In Version 6.0 we don't have invoice sequence field on Journal and so we are using Entry sequence only for the invoice too.
        So it passes fiscal year id in context to get_id method when we post the move.

Thank you,
Mustufa (mra)

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.