Prechádzať zdrojové kódy

[ADD] Impresion de comprobante

adrielso 7 rokov pred
rodič
commit
fb18235c05

+ 29 - 0
README.md

@@ -0,0 +1,29 @@
+# Eiru payments
+
+## Requisitos para la instalación
+
+1. [Node.js](https://nodejs.org/es/) en su última versión
+2. [Yarn](https://yarnpkg.com/lang/en/) en su última versión
+
+### Instalación del módulo
+
+1. Clone el proyecto en la raíz de su carpeta de custom addons
+2. Ejecute `yarn install` desde su terminal para instalar las dependencias
+3. Ejecute `yarn build` desde su terminal para construir el proyecto
+4. Actualice su lista de módulos y luego instale
+
+### Para actualizarlo
+1. Ejecute `git pull` desde su terminal estando en la raíz del módulo
+2. Ejecute los pasos 2 y 3 del proceso de instalación
+
+### Qué necesitas?
+
+1. Primeramente -> [Mucho brío](https://www.youtube.com/watch?v=CVFTC5B895A)
+2. [Vue.js](https://vuejs.org/)
+3. [Vuex](https://vuex.vuejs.org/en/intro.html)
+4. [Sass](http://sass-lang.com/)
+5. [Pugjs](https://pugjs.org/api/getting-started.html)
+6. [ECMAScript6](http://es6-features.org/)
+7. [Babeljs](https://babeljs.io/)
+8. [Webpack](https://webpack.github.io/)
+9. [Node.js](https://nodejs.org/)

+ 1 - 1
__openerp__.py

@@ -4,7 +4,7 @@
     'author': "Adrielso Kunert",
     'category': 'Uncategorized',
     'version': '0.1',
-    'depends': ['base', 'account'],
+    'depends': ['base', 'account', 'voucher_print'],
     'data': [
         'views/template.xml',
     ]

+ 4 - 26
models/account_voucher.py

@@ -63,29 +63,7 @@ class AccountVoucher(models.Model):
                 'state': 'paid'
             })
 
-
-        # step 2 create voucher
-        # account_voucher = self.create({
-        #     'reference': values['reference'],
-        #     'type': 'receipt',
-        #     'journal_id': journal.id,
-        #     'company_id': company.id,
-        #     'pre_line': True,
-        #     'amount': float(values['amount']),
-        #     'period_id': int(period.id),
-        #     'date': fields.Date.context_today(self),
-        #     'partner_id': partner.id,
-        #     'account_id': journal.default_credit_account_id.id,
-        #     'currency_id': currency_id,
-            # 'line_cr_ids': [[0, False, {
-            #     'date_due': line.date_maturity,
-            #     'account_id': line.account_id.id,
-            #     'date_original': line.move_id.date,
-            #     'move_line_id': line.id,
-            #     'amount_original': abs(line.credit or line.debit or 0.0),
-            #     'amount_unreconciled': abs(line.amount_residual),
-            #     'amount': abs(line.debit) if amount > line.debit else amount,
-            #     'reconcile': line.move_id.date <= line.date_maturity,
-            #     'currency_id': currency_id
-            # }] for line in move_line]
-        # })
+        return {
+            'action_id': self.env['ir.actions.report.xml'].search([('report_name', '=', 'voucher_print.report_voucher')]).id,
+            'voucher_id': account_voucher.id
+        }

+ 24 - 2
src/store/actions.js

@@ -53,9 +53,10 @@ const actions = {
             ],{
                 context: new openerp.web.CompoundContext()
             }).then(response => {
-
                 window.location.reload()
 
+                dispatch('printPayments', response)
+
                 resolve(response)
             }).fail(error => {
                 console.log(error)
@@ -64,7 +65,28 @@ const actions = {
         })
     },
     printPayments({ getters, dispatch },payload) {
-        // let self = getters.getPaymentsInstance
+        let self = getters.getPaymentsInstance
+
+        let active_ids = {
+            active_id: payload.voucher_id,
+            active_ids: [payload.voucher_id],
+            active_model: 'account.voucher'
+        }
+
+        self.rpc('/web/action/load',{
+            action_id: payload.action_id,
+            context: new openerp.web.CompoundContext(active_ids).eval()
+        }).then(result => {
+            result.context = new openerp.web.CompoundContext(active_ids).eval()
+            result.flags = result.flags || {}
+            result.flags.new_window = true
+
+            self.do_action(result,{
+                on_close: function () {
+                    self.getParent().reload()
+                }
+            })
+        })
     }
 }
 

+ 0 - 1
src/store/modules/paymentsJournal.js

@@ -25,7 +25,6 @@ const getters = {
 const mutations = {
     pushPaymentsJournal(state, payload) {
         state.paymentsJournals = [...payload.paymentsJournals]
-        console.log(payload);
     },
     setSelectPaymentsJournal(state, payload) {
         state.selectedPaymentsJournals = payload

+ 2 - 1
views/template.xml

@@ -3,7 +3,8 @@
     <data>
         <template id="eiru_payments.assets" name="Eiru Payments Assets" inherit_id="eiru_assets.assets">
             <xpath expr="." position="inside">
-                <!-- <script src="http://192.168.88.130:8071/livereload.js"></script> -->
+                <script src="http://192.168.88.130:8071/livereload.js"></script>
+                <link rel="stylesheet" href="/eiru_payments/static/src/main.css" />
                 <script type="text/javascript" src="/eiru_payments/static/src/main.js"></script>
             </xpath>
         </template>