← Back to team overview

clearcorp team mailing list archive

[Branch ~banking-addons-team/banking-addons/6.1] Rev 144: [FIX] Backport of fix for OPW 574251, Vouchers get today's date or associated invoice's date

 

Merge authors:
  Stefan Rijnhart (Therp) (stefan-therp)
Related merge proposals:
  https://code.launchpad.net/~therp-nl/banking-addons/ab61-lp1090733-vouchers_wrong_date/+merge/140070
  proposed by: Stefan Rijnhart (Therp) (stefan-therp)
  review: Approve - Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
------------------------------------------------------------
revno: 144 [merge]
author: Stefan Rijnhart <stefan@xxxxxxxx>
committer: Guewen Baconnier @ Camptocamp <guewen.baconnier@xxxxxxxxxxxxxx>
branch nick: banking-addons
timestamp: Tue 2012-12-18 15:37:13 +0100
message:
  [FIX] Backport of fix for OPW 574251, Vouchers get today's date or associated invoice's date
modified:
  account_banking/account_banking.py


--
lp:banking-addons
https://code.launchpad.net/~banking-addons-team/banking-addons/6.1

Your team CLEARCORP development team is subscribed to branch lp:banking-addons.
To unsubscribe from this branch go to https://code.launchpad.net/~banking-addons-team/banking-addons/6.1/+edit-subscription
=== 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:19:49 +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,