[FIX] Account: Creation of Moves to Subscription entries Corrected

lp bug: https://launchpad.net/bugs/500591 fixed

bzr revid: jvo@tinyerp.com-20100105103947-olj8ttteodqzcblt
This commit is contained in:
Jay (Open ERP) 2010-01-05 16:09:47 +05:30
parent 433b54792d
commit 81b3dd570c
3 changed files with 6 additions and 4 deletions

View File

@ -1553,7 +1553,8 @@ class account_model(osv.osv):
def generate(self, cr, uid, ids, datas={}, context={}):
move_ids = []
for model in self.browse(cr, uid, ids, context):
period_id = self.pool.get('account.period').find(cr,uid, context=context)
context.update({'date':datas['date']})
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date',False))
if not period_id:
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
period_id = period_id[0]
@ -1561,6 +1562,7 @@ class account_model(osv.osv):
'ref': model.ref,
'period_id': period_id,
'journal_id': model.journal_id.id,
'date': context.get('date',time.strftime('%Y-%m-%d'))
})
move_ids.append(move_id)
for line in model.lines_id:
@ -1578,7 +1580,7 @@ class account_model(osv.osv):
'move_id': move_id,
'ref': line.ref,
'partner_id': line.partner_id.id,
'date': time.strftime('%Y-%m-%d'),
'date': context.get('date',time.strftime('%Y-%m-%d')),
'date_maturity': time.strftime('%Y-%m-%d')
})
c = context.copy()

View File

@ -163,7 +163,7 @@ class account_bank_statement(osv.osv):
_('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configration Error !'),
raise osv.except_osv(_('Configuration Error !'),
_('Please verify that an account is defined in the journal.'))
for line in st.move_line_ids:

View File

@ -39,7 +39,7 @@ _subscription_fields = {
}
class wiz_subscription(wizard.interface):
def _action_generate(self, cr, uid, data, context):
def _action_generate(self, cr, uid, data, context={}):
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['form']['date'],))
ids = map(lambda x: x[0], cr.fetchall())
pooler.get_pool(cr.dbname).get('account.subscription.line').move_create(cr, uid, ids)