[Fix] When creating an account move don't assume all the information will be supplied
In this specific instance validating a physical inventory caused the account move creation code to fail because a period_id and a date were not supplied. We can use the current period for period_id and date will simply default to the current date if one is not supplied. bzr revid: mmakonnen@gmail.com-20121122141618-5ksk1ke8gh75bssp
This commit is contained in:
parent
e5133ecca4
commit
90c5bd38f2
|
@ -1439,9 +1439,9 @@ class account_move(osv.osv):
|
|||
if 'line_id' in vals:
|
||||
c = context.copy()
|
||||
c['novalidate'] = True
|
||||
c['period_id'] = vals['period_id']
|
||||
c['period_id'] = vals['period_id'] if 'period_id' in vals else self._get_period(cr, uid, context)
|
||||
c['journal_id'] = vals['journal_id']
|
||||
c['date'] = vals['date']
|
||||
if 'date' in vals: c['date'] = vals['date']
|
||||
result = super(account_move, self).create(cr, uid, vals, c)
|
||||
self.validate(cr, uid, [result], context)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue