[FIX] payment: clear the mess about electronical payment.

It is already defined as a payment method (subtype=inbound) and that's what we want. No need of adding 'electronic' in 'payment_type' selection (that crashes if we select that, btw) and 'payment_method_id_code' is a duplicate of 'payment_method_code'.
This commit is contained in:
qdp-odoo
2016-09-27 12:52:50 +02:00
parent 108d809358
commit 4e0053fe86
2 changed files with 6 additions and 7 deletions
+2 -4
View File
@@ -12,8 +12,6 @@ class AccountPayment(models.Model):
payment_transaction_id = fields.Many2one('payment.transaction', string="Payment Transaction")
payment_token_id = fields.Many2one('payment.token', string="Saved payment token", domain=[('acquirer_id.auto_confirm', '!=', 'authorize')],
help="Note that tokens from acquirers set to only authorize transactions (instead of capturing the amount) are not available.")
payment_type = fields.Selection(selection_add=[('electronic', 'Electronically receive money')])
payment_method_id_code = fields.Char(related='payment_method_id.code')
@api.onchange('partner_id')
def _onchange_partner_id(self):
@@ -25,7 +23,7 @@ class AccountPayment(models.Model):
@api.onchange('payment_method_id', 'journal_id')
def _onchange_payment_method(self):
if self.payment_method_id.code == 'electronic':
if self.payment_method_code == 'electronic':
self.payment_token_id = self.env['payment.token'].search([('partner_id', '=', self.partner_id.id), ('acquirer_id.auto_confirm', '!=', 'authorize')], limit=1)
else:
self.payment_token_id = False
@@ -59,4 +57,4 @@ class AccountPayment(models.Model):
if not s2s_result or tx.state != 'done':
raise ValidationError(_("Payment transaction failed (%s)") % tx.state_message)
self.payment_transaction_id = tx
self.payment_transaction_id = tx
@@ -18,11 +18,12 @@
<field name="inherit_id" ref="account.view_account_payment_invoice_form"/>
<field name="arch" type="xml">
<field name="payment_method_id" position="after">
<field name="payment_method_id_code" invisible="1"/>
<field name="payment_token_id" attrs="{'invisible': [('payment_method_id_code', '!=', 'electronic')],
'required': [('payment_method_id_code', '=', 'electronic')]}"/>
<field name="payment_method_code" invisible="1"/>
<field name="payment_token_id" attrs="{'invisible': [('payment_method_code', '!=', 'electronic')],
'required': [('payment_method_code', '=', 'electronic')]}"/>
</field>
</field>
</record>
</data>
</odoo>