diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index e55b6d54fee..abade8c579c 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -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
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 62cb55b13e4..35d51003902 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -705,6 +705,10 @@
+
+
+
+
@@ -1354,10 +1358,10 @@
form
form
new
-
-
+
+
+
-
@@ -1367,8 +1371,8 @@
Define Fiscal Years and Select Charts of Account
open
-
-
+
+
diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py
index 455ab049649..e26410e1dae 100644
--- a/addons/account/wizard/wizard_fiscalyear_close.py
+++ b/addons/account/wizard/wizard_fiscalyear_close.py
@@ -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