← Back to team overview

clearcorp team mailing list archive

[Merge] lp:~gs.clearcorp/openobject-addons/6.1-ccorp into lp:~clearcorp-drivers/openobject-addons/6.1-ccorp

 

Glen Sojo has proposed merging lp:~gs.clearcorp/openobject-addons/6.1-ccorp into lp:~clearcorp-drivers/openobject-addons/6.1-ccorp.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~gs.clearcorp/openobject-addons/6.1-ccorp/+merge/240725
-- 
https://code.launchpad.net/~gs.clearcorp/openobject-addons/6.1-ccorp/+merge/240725
Your team CLEARCORP development team is subscribed to branch lp:~clearcorp-drivers/openobject-addons/6.1-ccorp.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2013-08-07 21:35:18 +0000
+++ account_voucher/account_voucher.py	2014-11-05 14:27:57 +0000
@@ -937,34 +937,66 @@
         # Even if the amount_currency is never filled, we need to pass the foreign currency because otherwise
         # the receivable/payable account may have a secondary currency, which render this field mandatory
         account_currency_id = company_currency <> current_currency and current_currency or False
-        move_line = {
-            'journal_id': line.voucher_id.journal_id.id,
-            'period_id': line.voucher_id.period_id.id,
-            'name': _('change')+': '+(line.name or '/'),
-            'account_id': line.voucher_id.type in ('sale', 'receipt') and line.account_id.id or account_id.id,
-            'move_id': move_id,
-            'partner_id': line.voucher_id.partner_id.id,
-            'currency_id': account_currency_id,
-            'amount_currency': 0.0,
-            'quantity': 1,
-            'credit': amount_residual > 0 and amount_residual or 0.0,
-            'debit': amount_residual < 0 and -amount_residual or 0.0,
-            'date': line.voucher_id.date,
-        }
-        move_line_counterpart = {
-            'journal_id': line.voucher_id.journal_id.id,
-            'period_id': line.voucher_id.period_id.id,
-            'name': _('change')+': '+(line.name or '/'),
-            'account_id': line.voucher_id.type in ('sale', 'receipt') and account_id.id or line.account_id.id,
-            'move_id': move_id,
-            'amount_currency': 0.0,
-            'partner_id': line.voucher_id.partner_id.id,
-            'currency_id': account_currency_id,
-            'quantity': 1,
-            'debit': amount_residual > 0 and amount_residual or 0.0,
-            'credit': amount_residual < 0 and -amount_residual or 0.0,
-            'date': line.voucher_id.date,
-        }
+        if line.voucher_id.type == 'payment':
+        #if True:
+            move_line = {
+                'journal_id': line.voucher_id.journal_id.id,
+                'period_id': line.voucher_id.period_id.id,
+                'name': _('change')+': '+(line.name or '/'),
+                'account_id': line.voucher_id.type in ('sale', 'receipt') and line.account_id.id or account_id.id,
+                'move_id': move_id,
+                'partner_id': line.voucher_id.partner_id.id,
+                'currency_id': account_currency_id,
+                'amount_currency': 0.0,
+                'quantity': 1,
+                'credit': amount_residual < 0 and -amount_residual or 0.0,
+                'debit': amount_residual > 0 and amount_residual or 0.0,
+                'date': line.voucher_id.date,
+            }
+            move_line_counterpart = {
+                'journal_id': line.voucher_id.journal_id.id,
+                'period_id': line.voucher_id.period_id.id,
+                'name': _('change')+': '+(line.name or '/'),
+                'account_id': line.voucher_id.type in ('sale', 'receipt') and account_id.id or line.account_id.id,
+                'move_id': move_id,
+                'amount_currency': 0.0,
+                'partner_id': line.voucher_id.partner_id.id,
+                'currency_id': account_currency_id,
+                'quantity': 1,
+                'debit': amount_residual < 0 and -amount_residual or 0.0,
+                'credit': amount_residual > 0 and amount_residual or 0.0,
+                'date': line.voucher_id.date,
+            }
+        else:
+            move_line = {
+                'journal_id': line.voucher_id.journal_id.id,
+                'period_id': line.voucher_id.period_id.id,
+                'name': _('change')+': '+(line.name or '/'),
+                'account_id': line.voucher_id.type in ('sale', 'receipt') and line.account_id.id or account_id.id,
+                'move_id': move_id,
+                'partner_id': line.voucher_id.partner_id.id,
+                'currency_id': account_currency_id,
+                'amount_currency': 0.0,
+                'quantity': 1,
+                'credit': amount_residual > 0 and amount_residual or 0.0,
+                'debit': amount_residual < 0 and -amount_residual or 0.0,
+                'date': line.voucher_id.date,
+            }
+            move_line_counterpart = {
+                'journal_id': line.voucher_id.journal_id.id,
+                'period_id': line.voucher_id.period_id.id,
+                'name': _('change')+': '+(line.name or '/'),
+                'account_id': line.voucher_id.type in ('sale', 'receipt') and account_id.id or line.account_id.id,
+                'move_id': move_id,
+                'amount_currency': 0.0,
+                'partner_id': line.voucher_id.partner_id.id,
+                'currency_id': account_currency_id,
+                'quantity': 1,
+                'debit': amount_residual > 0 and amount_residual or 0.0,
+                'credit': amount_residual < 0 and -amount_residual or 0.0,
+                'date': line.voucher_id.date,
+            }
+
         if line.voucher_id.type not in ('sale', 'receipt'):
             # in case of supplier vouchers, the line with the payable account is 'move_line_counterpart', 
             # and thus it must be returned as first element


Follow ups