[FIX] account_payment_order: 4 things:

* Fix crash when selecting a customer that has a direct debit payment mode but no mandate
* Hide many fields when payment_order_ok is False on a payment_mode
* Fix payment line communication when the move line is not linked to an invoice (problem found when porting donation_debit_debit to v9)
* For the communication field, if self.move_id.ref is False, fallback on self.move_id.name
This commit is contained in:
Alexis de Lattre
2016-07-23 00:21:07 +02:00
committed by Pedro M. Baeza
parent 702fe99ac5
commit da364295d1
8 changed files with 6075 additions and 1560 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -23,7 +23,7 @@ class AccountMoveLine(models.Model):
aplo = self.env['account.payment.line']
# default values for communication_type and communication
communication_type = 'normal'
communication = self.move_id.name or '-'
communication = self.move_id.ref or self.move_id.name
# change these default values if move line is linked to an invoice
if self.invoice_id:
if self.invoice_id.reference_type != 'none':

View File

@@ -8,21 +8,29 @@
<field name="model">account.payment.mode</field>
<field name="inherit_id" ref="account_payment_mode.account_payment_mode_form"/>
<field name="arch" type="xml">
<field name="payment_type" position="after">
<field name="payment_order_ok"/>
</field>
<group name="main" position="after">
<group name="payment_order_options" string="Options for Payment Orders">
<field name="payment_order_ok"/>
<group name="payment_order_options"
string="Options for Payment Orders"
attrs="{'invisible': [('payment_order_ok', '=', False)]}">
<field name="no_debit_before_maturity"
attrs="{'invisible': ['|', ('payment_type', '!=', 'inbound'), ('payment_order_ok', '!=', True)]}"/>
<field name="group_lines"/>
</group>
<group name="payment_order_create_defaults" string="Select Move Lines to Pay - Default Values">
<group name="payment_order_create_defaults"
string="Select Move Lines to Pay - Default Values"
attrs="{'invisible': [('payment_order_ok', '=', False)]}">
<field name="default_journal_ids" widget="many2many_tags"/>
<field name="default_payment_mode"/>
<field name="default_target_move" widget="radio"/>
<field name="default_invoice"/>
<field name="default_date_type"/>
</group>
<group name="accounting-config" string="Accounting Entries Options">
<group name="accounting-config"
string="Accounting Entries Options"
attrs="{'invisible': [('payment_order_ok', '=', False)]}">
<field name="generate_move"/>
<field name="offsetting_account" widget="radio"
attrs="{'required': [('generate_move', '=', True)], 'invisible': [('generate_move', '=', False)]}"/>