Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4829-BankBranch #2010

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion l10n_th_fields/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
'data': [
'views/voucher_payment_receipt_view.xml',
'views/partner_view.xml',
'views/account_bank_view.xml',
'views/account_invoice_view.xml',
'views/ir_sequence_view.xml',
],
Expand Down
1 change: 0 additions & 1 deletion l10n_th_fields/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from . import partner
from . import account_voucher
from . import account_invoice
from . import account_bank
from . import ir_sequence

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
11 changes: 0 additions & 11 deletions l10n_th_fields/models/account_bank.py

This file was deleted.

23 changes: 0 additions & 23 deletions l10n_th_fields/views/account_bank_view.xml

This file was deleted.

15 changes: 13 additions & 2 deletions pabi_bank/models/res_bank.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from openerp import fields, models, api
from openerp import fields, models, api, _
from openerp.exceptions import ValidationError


class ResBank(models.Model):
Expand Down Expand Up @@ -31,8 +32,18 @@ class ResPartnerBank(models.Model):

@api.onchange('bank')
def _onchange_bank(self):
self.bank_branch = False
for rec in self:
if rec.bank:
rec.bank_name = rec.bank.name
rec.bank_bic = rec.bank.bic
rec.bank_branch = False

@api.onchange('bank_branch')
def _onchange_bank_branch(self):
for rec in self:
if rec.bank_branch and rec.bank and rec.bank_branch.bank_id != rec.bank:
raise ValidationError(_('กรุณาเลือกสาขาใหม่ \nเนื่องจากสาขาไม่สัมพันธ์กับธนาคาร'))

@api.multi
def name_get(self):
res = []
Expand Down
19 changes: 19 additions & 0 deletions pabi_bank/views/res_bank_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@
</field>
</field>
</record>

<delete id="l10n_th_fields.view_partner_bank_form_inherit" model="ir.ui.view"/>

<record id="view_partner_bank_form_inherit" model="ir.ui.view">
<field name="name">Partner Bank Accounts - Journal</field>
<field name="model">res.partner.bank</field>
<field name="inherit_id" ref="account.view_partner_bank_form_inherit"/>
<field name="arch" type="xml">
<group name="accounting" position="attributes">
<attribute name="attrs" >{}</attribute>
</group>
<field name="bank" position="attributes">
<attribute name="on_change">1</attribute>
</field>
<xpath expr="//field[@name='bank_bic']" position="after">
<field name="bank_branch"/>
</xpath>
</field>
</record>

<!-- res.bank.branch.branch -->
<record id="view_res_bank_master_form" model="ir.ui.view">
Expand Down