[account] def create account move error default period

Bug #605393 reported by Sébastien BEAU - http://www.akretion.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Dhruti Shastri(OpenERP)

Bug Description

Hello
I found this bug when I was using the function reconcile (class account_move_line). (I am working on a new way to reconcile automaticaly the account_move_line with cron task..., I will commit it soon)

Indeed by default this function will set the period_id at False
This is ok but in the function create (class account_move) we have a bug

First mistake we only check if we have the key 'period_id' in vals or we have to check also the value because the period_id can be False (default value for the function reconcile!!!).

Second mistake if we don't have the value in vals we don't add the period_id to the move (we only add it to the move_line)!! And so we have an error because the journal_id is null

====CODE====
@@ -1008,7 +1008,7 @@
def create(self, cr, uid, vals, context={}):
        if 'line_id' in vals:
            if 'journal_id' in vals:
                for l in vals['line_id']:
                    if not l[0]:
                        l[2]['journal_id'] = vals['journal_id']
                context['journal_id'] = vals['journal_id']
- if 'period_id' in vals: <===================HERE
+ if vals.get('period_id', False):
                for l in vals['line_id']:
                    if not l[0]:
                        l[2]['period_id'] = vals['period_id']
                context['period_id'] = vals['period_id']
            else:
                default_period = self._get_period(cr, uid, context)
                for l in vals['line_id']:
                    if not l[0]:
                        l[2]['period_id'] = default_period
                context['period_id'] = default_period
+ vals['period_id'] = default_period <=================HERE

===CODE=====

Tags: account
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :
Changed in openobject-addons:
assignee: nobody → DHS(Open ERP) (dhs-openerp)
Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Sébastien,

The period_id field is mandatory for model account_move.

I could not generate or see the problem.

Would you please give us an example where I can meet to the error?

Thanks.

Revision history for this message
Dhruti Shastri(OpenERP) (dhs-openerp) wrote :

Hello Sébastien,
We have tried to get the error, but we could not reproduce.
Let us know more (with more steps) when you face the error again.
Thanks.

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

Other bug subscribers

Patches

Remote bug watches

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