Skip to content

Commit

Permalink
[IMP] account_ux: alert that invoices will be unpaid if are unreconciled
Browse files Browse the repository at this point in the history
Task: 30282
  • Loading branch information
pablohmontenegro committed Apr 6, 2023
1 parent fd09828 commit a088adc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
4 changes: 3 additions & 1 deletion account_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Account UX',
'version': "16.0.1.1.0",
'version': "16.0.1.2.0",
'category': 'Accounting',
'sequence': 14,
'summary': '',
Expand All @@ -32,6 +32,7 @@
'account',
"base_vat",
"account_debit_note",
"account_accountant",
],
'data': [
'security/account_ux_security.xml',
Expand All @@ -45,6 +46,7 @@
'views/account_partial_reconcile_views.xml',
'views/account_account_views.xml',
'views/account_move_views.xml',
'views/bank_rec_widget_views.xml'
],
'demo': [
],
Expand Down
1 change: 1 addition & 0 deletions account_ux/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from . import res_partner
from . import res_currency_rate
from . import account_move
from . import account_bank_statement_line
30 changes: 30 additions & 0 deletions account_ux/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models
from odoo.exceptions import UserError


class AccountBankStatementLine(models.Model):
_inherit = 'account.bank.statement.line'

def action_undo_reconciliation(self):
''' Los statement lines que fueron creados en versiones < 15.0 no tienen un accounnt.move.line asociado, para
que el circuito completo de desconciliacion y conciliacion puedan funcionar debemos corregir esto creando
manualmente un asiento similar al que se genera automaticamente. Tambien, las bases que fueron migrades tienen
el problema donde reconocen que los statement.lines tienen si tiene un aml, pero este es el del pago y al
desconciliar modifica el asiento del pago dejandolo incorrecto. En este metodo:
1. Identificamos los st.lines que tengan am que sean pago y los corregimos
2. creamos un nuevo asiento similar al que se genera automatico al crear el st.line.
3, desvinculamos el am del pago del st.line '''
invoice_names = self.line_ids.filtered(lambda x: x.account_type in ['asset_receivable', 'liability_payable']).mapped('name')
if len(invoice_names)==1:
body = 'La factura {} dejó de figurar como pagada.'.format(invoice_names[0])
self.move_id.message_post(body=body)
if len(invoice_names)>1:
invoice_names_formatted = ", ".join(invoice_names)
body = 'Las facturas {} dejaron de figurar como pagadas.'.format(invoice_names_formatted)
self.move_id.message_post(body=body)
super().action_undo_reconciliation()

15 changes: 15 additions & 0 deletions account_ux/views/bank_rec_widget_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_bank_rec_widget_form" model="ir.ui.view">
<field name="name">bank.rec.widget.inherit</field>
<field name="model">bank.rec.widget</field>
<field name="inherit_id" ref="account_accountant.view_bank_rec_widget_form"/>
<field name="priority">90</field>
<field name="mode">primary</field>
<field name="arch" type="xml">
<button name="button_reset" position="attributes">
<attribute name="confirm">Asi no funciona, ni siquiera poniendo confirm en vista padre</attribute>
</button>
</field>
</record>
</odoo>

0 comments on commit a088adc

Please sign in to comment.