diff --git a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml index 05d7fa446..4c9f03885 100644 --- a/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml +++ b/account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml @@ -21,7 +21,7 @@ sepa recurrent first - 2014-02-01 + valid diff --git a/account_payment_order/__manifest__.py b/account_payment_order/__manifest__.py index e8924b5cd..6aadb4cc8 100644 --- a/account_payment_order/__manifest__.py +++ b/account_payment_order/__manifest__.py @@ -9,7 +9,7 @@ { 'name': 'Account Payment Order', - 'version': '10.0.1.1.3', + 'version': '10.0.1.2.0', 'license': 'AGPL-3', 'author': "ACSONE SA/NV, " "Therp BV, " diff --git a/account_payment_order/models/account_invoice.py b/account_payment_order/models/account_invoice.py index 9da340809..847df3604 100644 --- a/account_payment_order/models/account_invoice.py +++ b/account_payment_order/models/account_invoice.py @@ -34,6 +34,8 @@ class AccountInvoice(models.Model): def _prepare_new_payment_order(self): self.ensure_one() vals = {'payment_mode_id': self.payment_mode_id.id} + # other important fields are set by the inherit of create + # in account_payment_order.py return vals @api.multi diff --git a/account_payment_order/models/account_payment_mode.py b/account_payment_order/models/account_payment_mode.py index 570028dbf..df34540b8 100644 --- a/account_payment_order/models/account_payment_mode.py +++ b/account_payment_order/models/account_payment_mode.py @@ -40,6 +40,12 @@ class AccountPaymentMode(models.Model): ('due', 'Due'), ('move', 'Move'), ], default='due', string="Type of Date Filter") + # default option for account.payment.order + default_date_prefered = fields.Selection([ + ('now', 'Immediately'), + ('due', 'Due Date'), + ('fixed', 'Fixed Date'), + ], string='Default Payment Execution Date') group_lines = fields.Boolean( string="Group Transactions in Payment Orders", default=True, help="If this mark is checked, the transaction lines of the " diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py index f95aceb47..3b1263607 100644 --- a/account_payment_order/models/account_payment_order.py +++ b/account_payment_order/models/account_payment_order.py @@ -141,6 +141,10 @@ class AccountPaymentOrder(models.Model): vals['payment_type'] = payment_mode.payment_type if payment_mode.bank_account_link == 'fixed': vals['journal_id'] = payment_mode.fixed_journal_id.id + if ( + not vals.get('date_prefered') and + payment_mode.default_date_prefered): + vals['date_prefered'] = payment_mode.default_date_prefered return super(AccountPaymentOrder, self).create(vals) @api.onchange('payment_mode_id') @@ -157,6 +161,8 @@ class AccountPaymentOrder(models.Model): jrl_ids = self.payment_mode_id.variable_journal_ids.ids res['domain']['journal_id'] = "[('id', 'in', %s)]" % jrl_ids self.journal_id = journal_id + if self.payment_mode_id.default_date_prefered: + self.date_prefered = self.payment_mode_id.default_date_prefered return res @api.multi diff --git a/account_payment_order/views/account_payment_mode.xml b/account_payment_order/views/account_payment_mode.xml index 3d43f876d..5be3a6025 100644 --- a/account_payment_order/views/account_payment_mode.xml +++ b/account_payment_order/views/account_payment_mode.xml @@ -16,6 +16,7 @@ attrs="{'invisible': [('payment_order_ok', '=', False)]}"> +