← Back to team overview

account-payment-team team mailing list archive

[Merge] lp:~mikel-martin/account-payment/imp_move_line_date into lp:account-payment

 

mikel has proposed merging lp:~mikel-martin/account-payment/imp_move_line_date into lp:account-payment.

Requested reviews:
  Account Payment (account-payment-team)

For more details, see:
https://code.launchpad.net/~mikel-martin/account-payment/imp_move_line_date/+merge/171411

When "Direct payment" is selected in Rec. payment order for 'Create account moves' the date asigned for move lines is set to 'Preferred date' instead of execution date.
-- 
https://code.launchpad.net/~mikel-martin/account-payment/imp_move_line_date/+merge/171411
Your team Account Payment is requested to review the proposed merge of lp:~mikel-martin/account-payment/imp_move_line_date into lp:account-payment.
=== modified file 'account_payment_extension/payment.py'
--- account_payment_extension/payment.py	2012-11-01 21:49:33 +0000
+++ account_payment_extension/payment.py	2013-06-25 20:51:30 +0000
@@ -238,11 +238,17 @@
                 ctx = context.copy()
                 ctx['res.currency.compute.account'] = acc_cur
                 amount = self.pool.get('res.currency').compute(cr, uid, currency_id, company_currency_id, line_amount, context=ctx)
-
+                move_date = order.date_done
+                if order.date_prefered == 'due':
+                    move_date = line.move_line_id.date_maturity
+                if order.date_prefered == 'fixed':
+                    move_date = order.date_scheduled
+                                    
                 val = {
                     'name': line.move_line_id and line.move_line_id.name or '/',
                     'move_id': move_id,
-                    'date': order.date_done,
+                    'date': move_date,
+                    'date_created': order.date_done,
                     'ref': line.move_line_id and line.move_line_id.ref or False,
                     'partner_id': line.partner_id and line.partner_id.id or False,
                     'account_id': line.account_id.id,
@@ -280,7 +286,8 @@
                 self.pool.get('account.move.line').create(cr, uid, {
                     'name': line.move_line_id and line.move_line_id.name or '/',
                     'move_id': move_id,
-                    'date': order.date_done,
+                    'date': move_date,
+                    'date_created': order.date_done,
                     'ref': line.move_line_id and line.move_line_id.ref or False,
                     'partner_id': line.partner_id and line.partner_id.id or False,
                     'account_id': account_id,


Follow ups