From f0b07428476b9c951f69cf017ba634ee7da76773 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 3 Jun 2015 10:39:06 +0200 Subject: [PATCH] [FIX] account: default values of payments (customer/supplier) In `account.abstract.payment` model, The `partner_type` and `payment_type` fields had set as default `supplier` and `outbound`, respectively. The thing is, the `default_get` method of model `account.payment` (inheriting on the above model), will keep these default values set, even if the invoice is customer invoice, which is wrong. Either, this `default_get` should ignore the current default values, either, the default values should not be wrong in the first place. In this revision, I choose the second solution. Therefore, I had to add the default value `outbound` in the purchase payments menu action. opw-641441 --- addons/account/account_payment.py | 4 ++-- addons/account/views/account_payment_view.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/account_payment.py b/addons/account/account_payment.py index 2245847e7cf..f5aae107807 100644 --- a/addons/account/account_payment.py +++ b/addons/account/account_payment.py @@ -30,12 +30,12 @@ class account_abstract_payment(models.AbstractModel): _name = "account.abstract.payment" _description = "Contains the logic shared between models which allows to register payments" - payment_type = fields.Selection([('outbound', 'Send Money'), ('inbound', 'Receive Money')], default='outbound', string='Payment Type', required=True) + payment_type = fields.Selection([('outbound', 'Send Money'), ('inbound', 'Receive Money')], string='Payment Type', required=True) payment_method = fields.Many2one('account.payment.method', string='Payment Method', required=True) payment_method_code = fields.Char(related='payment_method.code', help="Technical field used to adapt the interface to the payment method selected.") - partner_type = fields.Selection([('customer', 'Customer'), ('supplier', 'Supplier')], default='supplier') + partner_type = fields.Selection([('customer', 'Customer'), ('supplier', 'Supplier')]) partner_id = fields.Many2one('res.partner', string='Partner') amount = fields.Monetary(string='Payment Amount', required=True) diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 682d793fb4a..a413a55477e 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -154,7 +154,7 @@ account.payment form tree,form,graph - {} + {'default_payment_type': 'outbound'} [('partner_type', '=', 'supplier')]