From 90c5bd38f20bba4f5df75e2d922a919a7e913fb8 Mon Sep 17 00:00:00 2001 From: Michael Telahun Makonnen Date: Thu, 22 Nov 2012 17:16:18 +0300 Subject: [PATCH] [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 --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index cfba30856a9..abff9d84628 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -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: