diff --git a/move.py b/move.py
index fb01475fc1..043a429c74 100644
--- a/move.py
+++ b/move.py
@@ -207,9 +207,9 @@ class Reconciliation(OSV):
def __init__(self):
super(Reconciliation, self).__init__()
self._constraints += [
- ('check_lines', 'You can not create reconciliation \n' \
- 'where lines are not balanced, not valid, \n' \
- 'not in the same account, not in account to reconcile!',
+ ('check_lines', 'You can not create reconciliation ' \
+ 'where lines are not balanced, nor valid, ' \
+ 'nor in the same account, nor in account to reconcile!',
['lines']),
]
@@ -226,6 +226,9 @@ class Reconciliation(OSV):
cursor)
return res
+ def write(self, cursor, user, ids, vals, context=None):
+ raise ExceptORM('UserError', 'You can not modify a reconciliation!')
+
def check_lines(self, cursor, user, ids):
currency_obj = self.pool.get('account.currency')
for reconciliation in self.browse(cursor, user, ids):
@@ -1006,6 +1009,51 @@ class ReconcileLines(Wizard):
ReconcileLines()
+class UnreconcileLinesInit(WizardOSV):
+ 'Unreconcile Lines Init'
+ _name = 'account.move.unreconcile_lines.init'
+
+UnreconcileLinesInit()
+
+
+class UnreconcileLines(Wizard):
+ 'Unreconcile Lines'
+ _name = 'account.move.unreconcile_lines'
+ states = {
+ 'init': {
+ 'result': {
+ 'type': 'form',
+ 'object': 'account.move.unreconcile_lines.init',
+ 'state': [
+ ('end', 'Cancel', 'gtk-cancel'),
+ ('unreconcile', 'Unreconcile', 'gtk-ok', True),
+ ],
+ },
+ },
+ 'unreconcile': {
+ 'actions': ['_unreconcile'],
+ 'result': {
+ 'type': 'state',
+ 'state': 'end',
+ },
+ },
+ }
+
+ def _unreconcile(self, cursor, user, data, context=None):
+ line_obj = self.pool.get('account.move.line')
+ reconciliation_obj = self.pool.get('account.move.reconciliation')
+
+ lines = line_obj.browse(cursor, user, data['ids'], context=context)
+ reconciliation_ids = [x.reconciliation.id for x in lines \
+ if x.reconciliation]
+ if reconciliation_ids:
+ reconciliation_obj.unlink(cursor, user, reconciliation_ids,
+ context=context)
+ return {}
+
+UnreconcileLines()
+
+
class OpenReconcileLinesInit(WizardOSV):
_name = 'account.move.open_reconcile_lines.init'
account = fields.Many2One('account.account', 'Account', required=True,
diff --git a/move.xml b/move.xml
index 127d8cab8a..f7b3e070e6 100644
--- a/move.xml
+++ b/move.xml
@@ -299,6 +299,29 @@
account.move.line,0
+
+
+ account.move.unreconcile_lines.init
+ form
+
+
+
+
+
+ ]]>
+
+
+
+ Unreconcile Lines
+ account.move.unreconcile_lines
+
+
+ form_action
+ account.move.line,0
+
+
+
Open Reconcile Lines
account.move.open_reconcile_lines