From 4c2d20fa2dcba9ab07a20ea75ce8da3f55d76e16 Mon Sep 17 00:00:00 2001 From: Felipe Garcia Suez Date: Mon, 15 Jul 2024 11:04:44 -0300 Subject: [PATCH] [REM] Remove Account Payment invoice token: Deprecated for 17.0 --- account_payment_invoice/__init__.py | 1 - account_payment_invoice/__manifest__.py | 29 ---------- account_payment_invoice/models/__init__.py | 1 - .../models/account_move.py | 54 ------------------- .../views/account_move.xml | 23 -------- 5 files changed, 108 deletions(-) delete mode 100644 account_payment_invoice/__init__.py delete mode 100644 account_payment_invoice/__manifest__.py delete mode 100644 account_payment_invoice/models/__init__.py delete mode 100644 account_payment_invoice/models/account_move.py delete mode 100644 account_payment_invoice/views/account_move.xml diff --git a/account_payment_invoice/__init__.py b/account_payment_invoice/__init__.py deleted file mode 100644 index 0650744f6..000000000 --- a/account_payment_invoice/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models diff --git a/account_payment_invoice/__manifest__.py b/account_payment_invoice/__manifest__.py deleted file mode 100644 index d8ac707bd..000000000 --- a/account_payment_invoice/__manifest__.py +++ /dev/null @@ -1,29 +0,0 @@ -# © 2023 ADHOC SA -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -{ - "name": "Account Payment invoice token", - "version": "16.0.2.0.0", - "category": "Accounting", - "description": """This module allows you to associate an invoice with a payment token and make the electronic payment of the invoice. - - add a filter Electronic payment pending - - add a payment status "Electronic payment pending" for invoices that are associated to a payment - but are in pending or those that have a payment in done but have not yet been reconciled.""", - "website": "www.adhoc.com.ar", - "author": "ADHOC SA", - "license": "AGPL-3", - "sequence": 100, - "application": False, - 'installable': False, - "external_dependencies": { - "python": [], - "bin": [], - }, - "depends": [ - "account_payment", - ], - "data": [ - 'views/account_move.xml' - ], - "demo": [ - ], -} diff --git a/account_payment_invoice/models/__init__.py b/account_payment_invoice/models/__init__.py deleted file mode 100644 index 9c0a42138..000000000 --- a/account_payment_invoice/models/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import account_move diff --git a/account_payment_invoice/models/account_move.py b/account_payment_invoice/models/account_move.py deleted file mode 100644 index d4c588cbf..000000000 --- a/account_payment_invoice/models/account_move.py +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################## -# For copyright and license notices, see __manifest__.py file in module root -# directory -############################################################################## -from odoo import models, fields, api, _ -from odoo.tools import plaintext2html - - -class AccountMove(models.Model): - - _inherit = "account.move" - payment_state = fields.Selection( - selection_add=[('electronic_pending', 'Electronic payment')], - ondelete={'electronic_pending': 'cascade'} - ) - payment_token_id = fields.Many2one('payment.token', string="automatic electonic payment", - check_company=True, readonly=True, states={'draft': [('readonly', False)]}, copy=False) - - @api.depends('transaction_ids.state') - def _compute_payment_state(self): - super()._compute_payment_state() - for rec in self.filtered(lambda x: x.payment_state=='not_paid' and {'pending','authorized'}.intersection(set(x.transaction_ids.mapped('state')))): - rec.payment_state = 'electronic_pending' - - def action_post(self): - res = super().action_post() - to_pay_moves = self.filtered( - lambda x: x.payment_token_id and x.state == 'posted' and - x.payment_state in ['not_paid', 'electronic_pending'] and x.move_type == 'out_invoice') - to_pay_moves.sudo().create_electronic_payment() - return res - - def create_electronic_payment(self): - tx_obj = self.env['payment.transaction'] - for rec in self: - active_transaction_amount = sum(rec.transaction_ids.filtered(lambda tx: tx.state in ['authorized', 'done','pending']).mapped('amount')) - if rec.currency_id.compare_amounts(rec.amount_total, active_transaction_amount) > 0.0: - try: - transaction = tx_obj.create({ - 'provider_id': rec.payment_token_id.provider_id.id, - 'amount': rec.amount_total - active_transaction_amount, - 'currency_id': rec.currency_id.id, - 'partner_id': rec.partner_id.id, - 'token_id': rec.payment_token_id.id, - 'operation': 'offline', - 'invoice_ids': [(6, 0, [rec.id])], - }) - transaction._send_payment_request() - transaction._cr.commit() - except Exception as exp: - rec.message_post( - body=_('We tried to validate this payment but got this error') + ': \n\n' + plaintext2html(str(exp), 'em'), - partner_ids=rec.get_internal_partners().ids, - body_is_html=True) diff --git a/account_payment_invoice/views/account_move.xml b/account_payment_invoice/views/account_move.xml deleted file mode 100644 index 666b83c1a..000000000 --- a/account_payment_invoice/views/account_move.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - view_move_form.view.form - account.move - - - - - - - - - account.invoice.select - account.move - - - - - - - -