Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account_accountant_ux: fix in order to allow to transform check… #355

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions account_accountant_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from . import account_move_line
from . import account_move
from . import account_journal_dashboard
from . import account_payment
14 changes: 14 additions & 0 deletions account_accountant_ux/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from odoo import models, api
from odoo.exceptions import ValidationError

class AccountPayment(models.Model):
_inherit = 'account.payment'

@api.constrains('payment_method_line_id')
def _check_payment_method_line_id(self):
''' Ensure the 'payment_method_line_id' field is not null.
Can't be done using the regular 'required=True' because the field is a computed editable stored one.
'''
for pay in self:
if not pay.payment_method_line_id:
raise ValidationError(_("Please define a payment method line on your payment."))