From 8308c5d98557cc8850970793783acd2ee4f44038 Mon Sep 17 00:00:00 2001 From: Felipe Garcia Suez Date: Wed, 16 Oct 2024 10:36:04 -0300 Subject: [PATCH] [DEL] account_payment_pro: Deprecate double-validation --- account_payment_pro/__manifest__.py | 2 +- account_payment_pro/models/account_payment.py | 24 ----------- .../security/payment_security.xml | 6 --- .../views/account_payment_view.xml | 42 +------------------ 4 files changed, 2 insertions(+), 72 deletions(-) diff --git a/account_payment_pro/__manifest__.py b/account_payment_pro/__manifest__.py index 4d885768b..663dfe724 100644 --- a/account_payment_pro/__manifest__.py +++ b/account_payment_pro/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Account Payment Super Power", - "version": "17.0.1.9.0", + "version": "17.0.2.0.0", "category": "Payment", "website": "www.adhoc.com.ar", "author": "ADHOC SA", diff --git a/account_payment_pro/models/account_payment.py b/account_payment_pro/models/account_payment.py index 9b85f6b4c..6f5fd2480 100644 --- a/account_payment_pro/models/account_payment.py +++ b/account_payment_pro/models/account_payment.py @@ -111,7 +111,6 @@ class AccountPayment(models.Model): help="Difference between 'To Pay Amount' and 'Payment Total'" ) write_off_available = fields.Boolean(compute='_compute_write_off_available') - is_approved = fields.Boolean(string="Approved", tracking=True, copy=False,) use_payment_pro = fields.Boolean(related='company_id.use_payment_pro') @api.depends('company_id') @@ -120,31 +119,12 @@ def _compute_write_off_available(self): rec.write_off_available = bool( rec.env['account.write_off.type'].search([('company_id', '=', rec.company_id.id)], limit=1)) - def _check_to_pay_lines_account(self): - """ TODO ver si esto tmb lo llevamos a la UI y lo mostramos como un warning. - tmb podemos dar mas info al usuario en el error """ - for rec in self: - accounts = rec.to_pay_move_line_ids.mapped('account_id') - if len(accounts) > 1: - raise ValidationError(_('To Pay Lines must be of the same account!')) - - def action_approve(self): - # chequeamos lineas a pagar antes de confirmar pago para evitar idas y vueltas de validacion - self._check_to_pay_lines_account() - self.filtered(lambda x: x.state == 'draft').is_approved = True - - def action_unapprove(self): - # chequeamos lineas a pagar antes de confirmar pago para evitar idas y vueltas de validacion - self._check_to_pay_lines_account() - self.filtered(lambda x: x.state == 'draft').is_approved = False - def action_draft(self): # Seteamos posted_before en true para que nos permita pasar a borrador el pago y poder realizar cambio sobre el mismo # Nos salteamos la siguente validacion # https://github.com/odoo/odoo/blob/b6b90636938ae961c339807ea893cabdede9f549/addons/account/models/account_move.py#L2474 if self.company_id.use_payment_pro: self.posted_before = False - self.is_approved = False super().action_draft() @api.model @@ -153,8 +133,6 @@ def _get_confimed_blocked_field(self): 'withholdable_advanced_amount', 'company_id', 'to_pay_amount'] def write(self, vals): - if self.filtered('is_approved') and set(self) & set(self._get_confimed_blocked_field()): - raise UserError(_('Your are trying to modify a protected field on an approved payment. Set it back to edit if you want to make this modification.')) for rec in self: if rec.company_id.use_payment_pro or ('company_id' in vals and rec.env['res.company'].browse(vals['company_id']).use_payment_pro): # Lo siguiente lo evaluamos para evitar la validacion de odoo de @@ -521,8 +499,6 @@ def check_to_pay_lines(self): def action_post(self): res = super().action_post() for rec in self: - if (rec.is_approved and rec.payment_difference): - raise ValidationError(_('To Pay Amount and Payment Amount must be equal!')) counterpart_aml = rec.mapped('line_ids').filtered( lambda r: not r.reconciled and r.account_id.account_type in self._get_valid_payment_account_types()) if counterpart_aml and rec.to_pay_move_line_ids: diff --git a/account_payment_pro/security/payment_security.xml b/account_payment_pro/security/payment_security.xml index 54ef8aa76..9166ea841 100644 --- a/account_payment_pro/security/payment_security.xml +++ b/account_payment_pro/security/payment_security.xml @@ -9,12 +9,6 @@ Allow pay now on vendor invoices - - Confirm payments (only if double validation is enabled) - - - - Write Off Type multi-company diff --git a/account_payment_pro/views/account_payment_view.xml b/account_payment_pro/views/account_payment_view.xml index 94f10ccaf..f78ddc6d9 100644 --- a/account_payment_pro/views/account_payment_view.xml +++ b/account_payment_pro/views/account_payment_view.xml @@ -11,33 +11,6 @@ - - account.payment.tree - account.payment - - -
-
- - - - -
- - - account.payment.search - account.payment - - - - - - - - - - account.payment.form account.payment @@ -50,12 +23,11 @@
- @@ -70,18 +42,6 @@ - - - - Approved - - - - -