[account] def create account move error default period
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 'period_id' in vals: <======
+ if vals.get(
for l in vals['line_id']:
else:
for l in vals['line_id']:
+ vals['period_id'] = default_period <======
===CODE=====
Changed in openobject-addons: | |
assignee: | nobody → DHS(Open ERP) (dhs-openerp) |
Changed in openobject-addons: | |
milestone: | none → 5.0.15 |
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.