Move field bank_account_required from module account_payment_partner to account_payment_mode

Make the mandate a required field on payment line when the payment method has mandate_required=True
Make the bank account a required field on payment line when the payment method has bank_account_required=True
Minor code cleanup
PEP8
This commit is contained in:
Alexis de Lattre
2016-06-14 22:25:23 +02:00
committed by Enric Tobella
parent d169c353a5
commit aad52940a9
5 changed files with 4 additions and 41 deletions

View File

@@ -16,7 +16,6 @@
'depends': ['account_payment_mode'],
'data': [
'views/res_partner_view.xml',
'views/account_payment_method.xml',
'views/account_invoice_view.xml',
'views/account_move_line.xml',
'views/report_invoice.xml',

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from . import res_partner
from . import account_payment_method
from . import account_invoice
from . import account_move_line

View File

@@ -29,7 +29,8 @@ class AccountInvoice(models.Model):
pay_mode.payment_type == 'outbound' and
pay_mode.payment_method_id.bank_account_required and
self.commercial_partner_id.bank_ids):
self.partner_bank_id = self.commercial_partner_id.bank_ids[0]
self.partner_bank_id =\
self.commercial_partner_id.bank_ids[0]
elif self.type == 'out_invoice':
pay_mode = self.partner_id.customer_payment_mode_id
self.payment_mode_id = pay_mode
@@ -46,13 +47,11 @@ class AccountInvoice(models.Model):
if (
self.payment_mode_id and
self.payment_mode_id.payment_type == 'outbound' and
not self.payment_mode_id.payment_method_id.\
bank_account_required):
not self.payment_mode_id.payment_method_id.
bank_account_required):
self.partner_bank_id = False
print "false"
elif not self.payment_mode_id:
self.partner_bank_id = False
print "false"
@api.model
def line_get_convert(self, line, part):

View File

@@ -1,14 +0,0 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields
class AccountPaymentMethod(models.Model):
_inherit = "account.payment.method"
bank_account_required = fields.Boolean(
string='Bank Account Required',
help="Activate this option if this payment method requires to "
"set the bank account of your supplier on the vendor bills.")

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="account_payment_method_form" model="ir.ui.view">
<field name="name">account_payment_partner.account.payment.method.form</field>
<field name="model">account.payment.method</field>
<field name="inherit_id" ref="account_payment_mode.account_payment_method_form"/>
<field name="arch" type="xml">
<field name="payment_type" position="after">
<field name="bank_account_required"
attrs="{'invisible': [('payment_type', '!=', 'outbound')]}"/>
</field>
</field>
</record>
</data>
</odoo>