瀏覽代碼

[IMP] cashbox register [FIX] name in payment method

Gogs 7 年之前
父節點
當前提交
d0381d39e8
共有 4 個文件被更改,包括 43 次插入7 次删除
  1. 36 1
      models/account_voucher.py
  2. 2 1
      src/App.vue
  3. 1 1
      src/components/payment/method/PaymentDetails.vue
  4. 4 4
      src/store/actions.js

+ 36 - 1
models/account_voucher.py

@@ -196,7 +196,42 @@ class AccountVoucher(models.Model):
                 'state': 'paid'
             })
 
+
+        # Step 10: Save bank statement
+        bank_statement_lines = [[0, False, {
+            'name': account_voucher.reference,
+            'amount': account_voucher.amount,
+            'partner_id': account_voucher.partner_id.id,
+            'voucher_id': account_voucher.id,
+            'journal_id': account_voucher.journal_id.id,
+            'account_id': account_voucher.account_id.id,
+            'journal_entry_id': account_voucher.move_id.id,
+            'currency_id': account_voucher.currency_id.id,
+            'ref': 'POS'
+        }]]
+
+        account_bank_statement = self.env['account.bank.statement'].search([('journal_id', '=', account_voucher.journal_id.id), ('date', '=', date_now)])
+
+        account_bank_statement_values = {
+            'date': date_now,
+            'user_id': self.env.user.id,
+            'journal_id': account_voucher.journal_id.id,
+            'period_id': account_voucher.period_id.id,
+            'line_ids': bank_statement_lines,
+            'state': 'open'
+        }
+
+        if account_bank_statement:
+            if len(account_bank_statement) == 1:
+                account_bank_statement.write(account_bank_statement_values) 
+            else: 
+                account_bank_statement[len(account_bank_statement) - 1].write(account_bank_statement_values)
+        else:
+            account_bank_statement.create(account_bank_statement_values)
+            
+        # Step 11: Return values
         return {
             'action_id': self.env['ir.actions.report.xml'].search([('report_name', '=', 'account.report_invoice')]).id,
             'invoice_id': invoice.id
-        }
+        }
+        

+ 2 - 1
src/App.vue

@@ -15,7 +15,7 @@
 </template>
 
 <script>
-    import { FormWizard, TabContent } from 'vue-form-wizard'
+    import { FormWizard, TabContent, WizardButton } from 'vue-form-wizard'
     import 'vue-form-wizard/dist/vue-form-wizard.min.css'
 
     import CartStep from '@/components/cart/CartStep'
@@ -33,6 +33,7 @@
         components: {
             TabContent,
             FormWizard,
+            WizardButton,
             CartStep,
             CustomerStep,
             PaymentMethodStep,

+ 1 - 1
src/components/payment/method/PaymentDetails.vue

@@ -72,7 +72,7 @@
         },
         methods: {
             getCustomerName() {
-                return this.hasSelectedCustomer ? this.selectedCustomer.display_name : ''
+                return this.hasSelectedCustomer ? this.selectedCustomer.name : ''
             },
             getCustomerCredit() {
                 return this.hasSelectedCustomer && this.selectedCustomer.credit_limit >= this.selectedCustomer.credit ? this.selectedCustomer.credit_limit - this.selectedCustomer.credit : 0

+ 4 - 4
src/store/actions.js

@@ -72,15 +72,15 @@ const actions = {
             active_ids: [payload.invoice_id],
             active_model: 'account.invoice'
         }
-
+            
         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.context = new openerp.web.CompoundContext(result.context || {}, active_ids).eval();
             result.flags = result.flags || {};
-            result.flags.new_window = true;
-
+            result.flags.inline = true;
+    
             self.do_action(result, {
                 on_close: function () {
                     self.getParent().reload();