← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-one-move-fix-jge into lp:banking-addons/bank-statement-reconcile-7.0

 

Joël Grand-Guillaume @ camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-one-move-fix-jge into lp:banking-addons/bank-statement-reconcile-7.0.

Requested reviews:
  Leonardo Pistone - camptocamp (lpistone): code review
  Banking Addons Core Editors (banking-addons-team)

For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-one-move-fix-jge/+merge/209867

Hi,

This merge contain:

[FIX] Confirmation / cancellation of statement
[FIX] Add context for account_contraints compatibility in button_cancel
[FIX] Do not validate a move on statement confirmation

This is a return after testing that on a customer instance.
-- 
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-7.0-one-move-fix-jge/+merge/209867
Your team Banking Addons Core Editors is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-7.0-one-move-fix-jge into lp:banking-addons/bank-statement-reconcile-7.0.
=== modified file 'account_statement_one_move/statement.py'
--- account_statement_one_move/statement.py	2014-02-07 13:24:37 +0000
+++ account_statement_one_move/statement.py	2014-03-07 11:59:42 +0000
@@ -58,11 +58,12 @@
     def _prepare_move(self, cr, uid, st_line, st_line_number, context=None):
         res = super(account_bank_statement, self).\
                 _prepare_move(cr, uid, st_line, st_line_number, context=context)
-        res.update({
-            'ref': st_line.statement_id.name,
-            'name': st_line.statement_id.name,
-            'date': st_line.statement_id.date,
-            })
+        if st_line.statement_id.profile_id.one_move:
+            res.update({
+                'ref': st_line.statement_id.name,
+                'name': '/',
+                'date': st_line.statement_id.date,
+                })
         return res
 
 
@@ -123,19 +124,13 @@
             company_currency_id, context=context)
         return account_move_line_obj.create(cr, uid, bank_move_vals, context=context)
 
-    def _valid_move(self, cr, uid, move_id, context=None):
-        move_obj = self.pool.get('account.move')
-        move = move_obj.browse(cr, uid, move_id, context=context)
-        move_obj.post(cr, uid, [move_id], context=context)
-        return True
-
 
     def _prepare_transfer_move_line_vals(self, cr, uid, st, name, amount, move_id, context=None):
         """
             Prepare the dict of values to create the transfer move lines.
         """
         account_id = st.profile_id.journal_id.default_debit_account_id.id
-        partner_id = st.profile_id.partner_id and profile.partner_id.id or False
+        partner_id = st.profile_id.partner_id and st.profile_id.partner_id.id or False
         if amount < 0.0:
             debit = 0.0
             credit = -amount
@@ -201,7 +196,6 @@
                 move_id = context['move_id']
                 move = move_obj.browse(cr, uid, move_id, context=context)
                 transfe_line_ids = self.create_move_transfer_lines(cr, uid, move, st, context=context)
-                self._valid_move(cr, uid, move_id, context=context)
                 lines_ids = [x.id for x in st.line_ids]
                 st_line_obj.write(cr, uid, lines_ids,
                         {'move_ids': [(4, move_id, False)]},
@@ -210,6 +204,9 @@
 
     def button_cancel(self, cr, uid, ids, context=None):
         done = []
+        if context is None:
+            context = {}
+        context['from_parent_object'] = True
         for st in self.browse(cr, uid, ids, context=context):
             if st.profile_id.one_move and st.line_ids:
                 for move in st.line_ids[0].move_ids:
@@ -222,4 +219,3 @@
                                                                  context=context)
         return True
 
-


Follow ups