mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Remove fields_view_get() on payment.order because dynamic domain is now possible and I implemented it in a previous commit. Minor usability improvements in mandate menu and views Refresh partner_id field on mandate in the on_change of partner_bank_id
This commit is contained in:
committed by
Enric Tobella
parent
ab2de30f92
commit
239ee148e4
@@ -223,18 +223,21 @@ class sdd_mandate(orm.Model):
|
||||
def mandate_partner_bank_change(
|
||||
self, cr, uid, ids, partner_bank_id, type, recurrent_sequence_type,
|
||||
last_debit_date, state):
|
||||
res = {'value': {}}
|
||||
if partner_bank_id:
|
||||
partner_bank_read = self.pool['res.partner.bank'].read(
|
||||
cr, uid, partner_bank_id, ['partner_id'])['partner_id']
|
||||
if partner_bank_read:
|
||||
res['value']['partner_id'] = partner_bank_read[0]
|
||||
if (state == 'valid' and partner_bank_id
|
||||
and type == 'recurrent'
|
||||
and recurrent_sequence_type != 'first'):
|
||||
return {
|
||||
'value': {'recurrent_sequence_type': 'first'},
|
||||
'warning': {
|
||||
res['value']['recurrent_sequence_type'] = 'first'
|
||||
res['warning'] = {
|
||||
'title': _('Mandate update'),
|
||||
'message': _("As you changed the bank account attached to this mandate, the 'Sequence Type' has been set back to 'First'."),
|
||||
}
|
||||
}
|
||||
else:
|
||||
return True
|
||||
return res
|
||||
|
||||
def validate(self, cr, uid, ids, context=None):
|
||||
to_validate_ids = []
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
</div>
|
||||
<group name="main">
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="partner_bank_id"
|
||||
on_change="mandate_partner_bank_change(partner_bank_id, type, recurrent_sequence_type, last_debit_date, state)"
|
||||
invisible="context.get('sdd_mandate_bank_partner_view')"
|
||||
/>
|
||||
<field name="partner_id" invisible="context.get('sdd_mandate_bank_partner_view')"/>
|
||||
<field name="type" on_change="mandate_type_change(type)"/>
|
||||
<field name="recurrent_sequence_type" attrs="{'invisible': [('type', '=', 'oneoff')], 'required': [('type', '=', 'recurrent')]}"/>
|
||||
<field name="signature_date"/>
|
||||
<field name="scan"/>
|
||||
<field name="last_debit_date"/>
|
||||
<field name="partner_bank_id"
|
||||
on_change="mandate_partner_bank_change(partner_bank_id, type, recurrent_sequence_type, last_debit_date, state)"
|
||||
invisible="context.get('sdd_mandate_bank_partner_view')"
|
||||
domain="[('partner_id', '=', partner_id)]"/>
|
||||
</group>
|
||||
<group name="payment_lines" string="Related Payment Lines">
|
||||
<field name="payment_line_ids" nolabel="1"/>
|
||||
@@ -95,7 +95,7 @@
|
||||
</record>
|
||||
|
||||
<menuitem id="sdd_mandate_menu"
|
||||
parent="account_banking.menu_finance_banking_actions"
|
||||
parent="account_banking.menu_finance_banking_settings"
|
||||
action="sdd_mandate_action"
|
||||
sequence="20"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user