Explorar o código

[IMP] payment reference added

Gogs %!s(int64=7) %!d(string=hai) anos
pai
achega
927a8e11be

+ 1 - 1
models/account_voucher.py

@@ -207,7 +207,7 @@ class AccountVoucher(models.Model):
             'account_id': account_voucher.account_id.id,
             'journal_entry_id': account_voucher.move_id.id,
             'currency_id': account_voucher.currency_id.id,
-            'ref': 'POS'
+            'ref': 'POS/' + values.get('payment_reference') or ''
         }]]
 
         account_bank_statement = self.env['account.bank.statement'].search([('journal_id', '=', account_voucher.journal_id.id), ('date', '=', date_now)])

+ 19 - 1
src/components/payment/cash/PaymentAmount.vue

@@ -1,5 +1,12 @@
 <template lang="pug">
     form.payment-amount-form
+        div(v-show="selectedJournal.type === 'bank'")
+            .payment-form-separator
+                h3 Referencia de Pago
+                hr
+            .payment-amount-item
+                label.payment-label Referencia
+                input.payment-input(:value="reference" v-model="reference")
         .payment-form-separator
             h3 Detalles del Pago
             hr
@@ -20,6 +27,14 @@
 
     export default {
         computed: {
+            reference: {
+                get() {
+                    return this.paymentReference
+                },
+                set(value) {
+                    this.setPaymentReference(value)
+                }
+            },
             paid: {
                 get() {
                     return accounting.formatMoney(this.amountPaid, this.currencySymbol, 0, '.', ',')
@@ -34,6 +49,8 @@
             ...mapGetters([
                 'total',
                 'currencySymbol',
+                'selectedJournal',
+                'paymentReference',
                 'amountPaid'
             ])
         },
@@ -48,7 +65,8 @@
                 this.residual = this.amountPaid >= this.total ? this.amountPaid - this.total : 0
             },
             ...mapActions([
-                'changeAmountPaid'
+                'setPaymentReference',
+                'changeAmountPaid',
             ])
         },
         data() {

+ 1 - 0
src/store/actions.js

@@ -49,6 +49,7 @@ const actions = {
                         }
                     }),
                     cart_total: getters.total,
+                    payment_reference: getters.paymentReference,
                     amount_paid: getters.amountPaid > getters.total ? getters.total : getters.amountPaid
                 }
             ], {

+ 10 - 0
src/store/modules/account.js

@@ -2,6 +2,7 @@ const state = {
     journals: [],
     payment: 'cash',
     paymentTerms: [],
+    paymentReference: '',
     selectedJournal: null,
     selectedPaymentTerm: null,
     amountPaid: 0
@@ -17,6 +18,9 @@ const getters = {
     paymentTerms(state) {
         return state.paymentTerms
     },
+    paymentReference(state) {
+        return state.paymentReference
+    },
     selectedJournal(state) {
         return state.selectedJournal
     },
@@ -41,6 +45,9 @@ const mutations = {
     setSelectedPaymentTerm(state, payload) {
         state.selectedPaymentTerm = payload
     },
+    setPaymentReference(state, payload) {
+        state.paymentReference = payload
+    },
     togglePayment(state, payload) {
         state.payment = payload
     },
@@ -104,6 +111,9 @@ const actions = {
         dispatch('autoSelectPaymentTerm', payload === 'cash' ? getters.paymentTerms : getters.paymentTerms.filter(t => t.id !== getters.selectedPaymentTerm.id))
         commit('togglePayment', payload)
     },
+    setPaymentReference({ commit }, payload) {
+        commit('setPaymentReference', payload)
+    },
     changeAmountPaid({ commit, getters, dispatch }, payload) {
         if (getters.payment === 'cash') {
             commit('setAmountPaid', payload)