[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
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
<field name="res_model">account.payment</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="context">{}</field>
|
||||
<field name="context">{'default_payment_type': 'outbound'}</field>
|
||||
<field name="domain">[('partner_type', '=', 'supplier')]</field>
|
||||
<field name="view_id" ref="view_account_supplier_payment_tree"/>
|
||||
<field name="help" type="html">
|
||||
|
||||
Reference in New Issue
Block a user