← Back to team overview

banking-addons-team team mailing list archive

[Merge] lp:~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date into lp:banking-addons

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date into lp:banking-addons.

Requested reviews:
  Banking Addons Team (banking-addons-team)
Related bugs:
  Bug #1090733 in Banking Addons: "Vouchers get today's date or associated invoice's date"
  https://bugs.launchpad.net/banking-addons/+bug/1090733

For more details, see:
https://code.launchpad.net/~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date/+merge/140070

This is a backport of https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-574251-rha/+merge/104383 to the modified version of this method that exists in account_banking

-- 
https://code.launchpad.net/~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date/+merge/140070
Your team Banking Addons Team is requested to review the proposed merge of lp:~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date into lp:banking-addons.
=== modified file 'account_banking/account_banking.py'
--- account_banking/account_banking.py	2012-05-02 15:09:49 +0000
+++ account_banking/account_banking.py	2012-12-15 15:23:19 +0000
@@ -410,13 +410,19 @@
             'account.bank.statement.line')
         st_line = account_bank_statement_line_obj.browse(
             cr, uid, st_line_id, context=context)
+        period_id = self._get_period(
+            cr, uid, st_line.date, context=context)    # AB
         # Start account voucher
         # Post the voucher and update links between statement and moves
         if st_line.voucher_id:
             voucher_pool = self.pool.get('account.voucher')
             wf_service = netsvc.LocalService("workflow")
             voucher_pool.write(
-                cr, uid, [st_line.voucher_id.id], {'number': st_line_number}, context=context)
+                cr, uid, [st_line.voucher_id.id], {
+                    'number': st_line_number,
+                    'date': st_line.date,
+                    'period_id': period_id, # AB
+                }, context=context)
             if st_line.voucher_id.state == 'cancel':
                 voucher_pool.action_cancel_draft(
                     cr, uid, [st_line.voucher_id.id], context=context)
@@ -443,8 +449,6 @@
         context.update({'date': st_line.date})
         ctxt = context.copy()                       # AB
         ctxt['company_id'] = st_line.company_id.id  # AB
-        period_id = self._get_period(
-            cr, uid, st_line.date, context=ctxt)    # AB
 
         move_id = account_move_obj.create(cr, uid, {
             'journal_id': st.journal_id.id,


Follow ups