From a2f081159468c4782af490bc1d37f9b4ae612dd9 Mon Sep 17 00:00:00 2001 From: jcoux Date: Tue, 13 Feb 2018 13:31:34 +0100 Subject: [PATCH] BSSFL-490: On payment, empty the amount when a difference appears --- HISTORY.rst | 1 + odoo/local-src/sf_account/models/__init__.py | 1 + odoo/local-src/sf_account/models/account_payment.py | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 odoo/local-src/sf_account/models/account_payment.py diff --git a/HISTORY.rst b/HISTORY.rst index ec9ce6e0ade6..e5bbabced878 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -22,6 +22,7 @@ latest (unreleased) **Features and Improvements** * BSSFL-485: Custom sale order report (add field note) +* BSSFL-490: On payment, empty the amount when a difference appears **Bugfixes** diff --git a/odoo/local-src/sf_account/models/__init__.py b/odoo/local-src/sf_account/models/__init__.py index 7febfc67db4c..9923a5cd442e 100644 --- a/odoo/local-src/sf_account/models/__init__.py +++ b/odoo/local-src/sf_account/models/__init__.py @@ -4,4 +4,5 @@ from . import account from . import account_invoice from . import account_move +from . import account_payment from . import res_bank diff --git a/odoo/local-src/sf_account/models/account_payment.py b/odoo/local-src/sf_account/models/account_payment.py new file mode 100644 index 000000000000..d40aafb58732 --- /dev/null +++ b/odoo/local-src/sf_account/models/account_payment.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +# Part of sensefly. + +from odoo import models, api + + +class AccountPayment(models.Model): + _inherit = 'account.payment' + + @api.onchange('payment_difference') + def onchange_payment_difference(self): + if self.payment_difference != 0: + self.amount = 0