From 95d76ac4e600eac980dd3a2c256cabe3504216a6 Mon Sep 17 00:00:00 2001 From: idelapoza Date: Thu, 12 Sep 2024 12:43:15 +0200 Subject: [PATCH] Added a check and change the domain of populate function --- .../__init__.py | 1 + .../__manifest__.py | 1 + payment_order_transactions_summary/i18n/es.po | 10 +++++++++ .../wizards/__init__.py | 4 ++++ .../wizards/account_payment_line_create.py | 21 +++++++++++++++++++ .../account_payment_line_create_view.xml | 14 +++++++++++++ 6 files changed, 51 insertions(+) create mode 100644 payment_order_transactions_summary/wizards/__init__.py create mode 100644 payment_order_transactions_summary/wizards/account_payment_line_create.py create mode 100644 payment_order_transactions_summary/wizards/account_payment_line_create_view.xml diff --git a/payment_order_transactions_summary/__init__.py b/payment_order_transactions_summary/__init__.py index 0018867..c41e68a 100644 --- a/payment_order_transactions_summary/__init__.py +++ b/payment_order_transactions_summary/__init__.py @@ -2,3 +2,4 @@ # For copyright and license notices, see __manifest__.py file in root directory ############################################################################### from . import models +from . import wizards diff --git a/payment_order_transactions_summary/__manifest__.py b/payment_order_transactions_summary/__manifest__.py index e39c055..98d561e 100644 --- a/payment_order_transactions_summary/__manifest__.py +++ b/payment_order_transactions_summary/__manifest__.py @@ -30,6 +30,7 @@ ], 'data': [ 'views/account_payment_order_views.xml', + 'wizards/account_payment_line_create_view.xml', 'report/print_account_payment_order_document.xml', ], } diff --git a/payment_order_transactions_summary/i18n/es.po b/payment_order_transactions_summary/i18n/es.po index ca1e54e..d7f1765 100644 --- a/payment_order_transactions_summary/i18n/es.po +++ b/payment_order_transactions_summary/i18n/es.po @@ -15,6 +15,16 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: payment_order_transactions_summary +#: model:ir.model.fields,field_description:payment_order_transactions_summary.field_account_payment_line_create__allow_normal +msgid "Allow Normal Move Lines" +msgstr "Incluir apuntes normales" + +#. module: payment_order_transactions_summary +#: model:ir.model.fields,help:payment_order_transactions_summary.field_account_payment_line_create__allow_normal +msgid "Allow normal move lines (No Blocked or Returned)" +msgstr "Incluye apuntes que no sean en litigio o devueltos" + #. module: payment_order_transactions_summary #: model:ir.model.fields,field_description:payment_order_transactions_summary.field_account_payment_line__invoice_date #: model_terms:ir.ui.view,arch_db:payment_order_transactions_summary.print_account_payment_order_document_sdi diff --git a/payment_order_transactions_summary/wizards/__init__.py b/payment_order_transactions_summary/wizards/__init__.py new file mode 100644 index 0000000..e02cc8b --- /dev/null +++ b/payment_order_transactions_summary/wizards/__init__.py @@ -0,0 +1,4 @@ +############################################################################### +# For copyright and license notices, see __manifest__.py file in root directory +############################################################################### +from . import account_payment_line_create diff --git a/payment_order_transactions_summary/wizards/account_payment_line_create.py b/payment_order_transactions_summary/wizards/account_payment_line_create.py new file mode 100644 index 0000000..0fb9f5a --- /dev/null +++ b/payment_order_transactions_summary/wizards/account_payment_line_create.py @@ -0,0 +1,21 @@ +from odoo import api, fields, models + + +class AccountPaymentLineCreate(models.TransientModel): + _inherit = 'account.payment.line.create' + + allow_normal = fields.Boolean( + string='Allow Normal Move Lines', + help='Allow normal move lines (No Blocked or Returned)' + ) + + @api.multi + def _prepare_move_line_domain(self): + domain = super(AccountPaymentLineCreate, self)._prepare_move_line_domain() + if not self.allow_normal: + domain += [ + '|', + ('blocked', '=', True), + ('invoice_id.returned_payment', '=', True) + ] + return domain diff --git a/payment_order_transactions_summary/wizards/account_payment_line_create_view.xml b/payment_order_transactions_summary/wizards/account_payment_line_create_view.xml new file mode 100644 index 0000000..c0b3bfa --- /dev/null +++ b/payment_order_transactions_summary/wizards/account_payment_line_create_view.xml @@ -0,0 +1,14 @@ + + + + + + account.payment.line.create + + + + + + + +