solve problem :

- if you make invoice in 2008 fiscal year and then close that year..and create new fiscal year and in new fiscal year you pay that invoice that time..original invoice entries does not get paid and reconciled...

bzr revid: mra@tinyerp.com-20080925095852-fh177c0td425yx49
This commit is contained in:
Mustufa Rangwala 2008-09-25 15:28:52 +05:30
parent a3a7e64534
commit 79e22ccc72
3 changed files with 28 additions and 8 deletions

View File

@ -305,6 +305,8 @@ class account_move_line(osv.osv):
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account'),
#TODO: remove this
'amount_taxed':fields.float("Taxed Amount",digits=(16,2)),
'parent_move_lines':fields.many2many('account.move.line', 'account_move_line_rel', 'child_id', 'parent_id', 'Parent'),
'reconcile_implicit':fields.boolean('Implicit Reconciliaiton')
}
def _get_date(self, cr, uid, context):
@ -435,7 +437,11 @@ class account_move_line(osv.osv):
currency = 0.0
account_id = False
partner_id = False
implicit_lines = []
for line in unrec_lines:
if line.parent_move_lines:
for i in line.parent_move_lines:
implicit_lines.append(i.id)
if line.state <> 'valid':
raise osv.except_osv(_('Error'),
_('Entry "%s" is not valid !') % line.name)
@ -531,9 +537,13 @@ class account_move_line(osv.osv):
'line_id': map(lambda x: (4,x,False), ids),
'line_partial_ids': map(lambda x: (3,x,False), ids)
})
wf_service = netsvc.LocalService("workflow")
if implicit_lines:
self.write(cr, uid, implicit_lines, {'reconcile_implicit':True,'reconcile_id':r_id})
for id in implicit_lines:
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
# the id of the move.reconcile is written in the move.line (self) by the create method above
# because of the way the line_id are defined: (4, x, False)
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
return r_id

View File

@ -705,6 +705,10 @@
<page string="Analytic Lines">
<field colspan="4" name="analytic_lines" nolabel="1"/>
</page>
<page string="Move Lines">
<field colspan="4" name="reconcile_implicit"/>
<field colspan="4" name="parent_move_lines" nolabel="0"/>
</page>
</notebook>
</form>
</field>
@ -1354,10 +1358,10 @@
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</record>
<!-- register configuration wizard -->
@ -1367,8 +1371,8 @@
<field name="note">Define Fiscal Years and Select Charts of Account</field>
<field name="action_id" ref="action_account_config_wizard_form"/>
<field name="state">open</field>
</record>
</record>
<!-- Account Templates -->

View File

@ -110,7 +110,7 @@ def _data_save(self, cr, uid, data, context):
offset = 0
limit = 100
while True:
cr.execute('SELECT name, quantity, debit, credit, account_id, ref, ' \
cr.execute('SELECT id, name, quantity, debit, credit, account_id, ref, ' \
'amount_currency, currency_id, blocked, partner_id, ' \
'date_maturity, date_created ' \
'FROM account_move_line ' \
@ -123,10 +123,13 @@ def _data_save(self, cr, uid, data, context):
if not result:
break
for move in result:
parent_id = move['id']
move.pop('id')
move.update({
'date': period.date_start,
'journal_id': new_journal.id,
'period_id': period.id,
'parent_move_lines':[(6,0,[parent_id])]
})
pool.get('account.move.line').create(cr, uid, move, {
'journal_id': new_journal.id,
@ -137,7 +140,7 @@ def _data_save(self, cr, uid, data, context):
offset = 0
limit = 100
while True:
cr.execute('SELECT name, quantity, debit, credit, account_id, ref, ' \
cr.execute('SELECT id, name, quantity, debit, credit, account_id, ref, ' \
'amount_currency, currency_id, blocked, partner_id, ' \
'date_maturity, date_created ' \
'FROM account_move_line ' \
@ -149,10 +152,13 @@ def _data_save(self, cr, uid, data, context):
if not result:
break
for move in result:
parent_id = move['id']
move.pop('id')
move.update({
'date': period.date_start,
'journal_id': new_journal.id,
'period_id': period.id,
'parent_move_lines':[(6,0,[parent_id])]
})
pool.get('account.move.line').create(cr, uid, move)
offset += limit