Kaynağa Gözat

[FIX] Verificar pagos a proveedor

Adrielso 7 yıl önce
ebeveyn
işleme
4f367a5b51
1 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 10 4
      static/src/js/account_bank_voucher_import.js

+ 10 - 4
static/src/js/account_bank_voucher_import.js

@@ -92,7 +92,7 @@ openerp.account_bank_voucher_import = function (instance, local) {
                 return map.voucher_id[0]
             }));
             //
-            var fields =['id','partner_id','amount','journal_id','reference','move_id','account_id','state'];
+            var fields =['id','partner_id','amount','journal_id','reference','move_id','account_id','state','type'];
             var domain =[['state','=','posted'],['journal_id','in',journal],["id",'not in',voucher]];
             var accountVouche = new instance.web.Model('account.voucher');
 
@@ -106,15 +106,21 @@ openerp.account_bank_voucher_import = function (instance, local) {
             var self = this;
             var defer = $.Deferred();
             var itemvoucher;
-            var voucherImport=[];
-
+            var voucherImport = [];
+            var ammount = 0;
             for (var i = 0; i < self.accountVouche.length; i++) {
                 itemvoucher = self.accountVouche[i];
+                if (itemvoucher.type == 'payment'){
+                    ammount = (itemvoucher.amount*-1);
+                }else {
+                    ammount = (itemvoucher.amount);
+                }
+
                 voucherImport.push({
                                     statement_id : this.id,
                                     name : itemvoucher.reference,
                                     partner_id : itemvoucher.partner_id[0],
-                                    amount : itemvoucher.amount,
+                                    amount : ammount,
                                     voucher_id : itemvoucher.id,
                                     journal_id : itemvoucher.journal_id[0],
                                     account_id : itemvoucher.account_id[0],