-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] account_ux: alert that invoices will be unpaid if are unreconciled
Task: 30282
- Loading branch information
1 parent
fd09828
commit a088adc
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |