Skip to content
Extraits de code Groupes Projets
Valider c2189b8e rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[add] date_maturity on account_payment widget

parent f0a8d57b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -24,5 +24,8 @@ ...@@ -24,5 +24,8 @@
"views/res_partner.xml", "views/res_partner.xml",
"views/scop_cotisation_task.xml", "views/scop_cotisation_task.xml",
], ],
"qweb": [
"static/src/xml/*.xml",
],
'post_init_hook': '_configure_journals', 'post_init_hook': '_configure_journals',
} }
# © 2020 Le Filament (<http://www.le-filament.com>) # © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
import json
from odoo import models, fields, api, _ from odoo import models, fields, api, _
from odoo.exceptions import UserError from odoo.exceptions import UserError
...@@ -207,6 +210,39 @@ class ScopAccountInvoice(models.Model): ...@@ -207,6 +210,39 @@ class ScopAccountInvoice(models.Model):
inv.write(vals) inv.write(vals)
return True return True
@api.one
def _get_outstanding_info_JSON(self):
super(ScopAccountInvoice, self)._get_outstanding_info_JSON()
info = json.loads(self.outstanding_credits_debits_widget)
if info:
values = info.get('content', False)
if self.state == 'open' and values:
domain = [('account_id', '=', self.account_id.id),
('partner_id', '=',
self.env['res.partner']._find_accounting_partner(
self.partner_id).id),
('reconciled', '=', False),
('move_id.state', '=', 'posted'),
'|',
'&', ('amount_residual_currency', '!=', 0.0),
('currency_id', '!=', None),
'&', ('amount_residual_currency', '=', 0.0), '&',
('currency_id', '=', None),
('amount_residual', '!=', 0.0)]
if self.type in ('out_invoice', 'in_refund'):
domain.extend([('credit', '>', 0), ('debit', '=', 0)])
else:
domain.extend([('credit', '=', 0), ('debit', '>', 0)])
lines = self.env['account.move.line'].search(domain)
for value in values:
for line in lines:
if value.get('id') == line.id:
value.update({
'date_maturity': datetime.strftime(line.date_maturity, "%d/%m/%Y"),
'invoice': line.invoice_id.number
})
self.outstanding_credits_debits_widget = json.dumps(info)
# ------------------------------------------------------ # ------------------------------------------------------
# Common Function # Common Function
# ------------------------------------------------------ # ------------------------------------------------------
......
<?xml version="1.0" encoding="utf-8"?>
<templates xml:space="preserve">
<!-- Copyright 2020 Le Filament
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<t t-extend="ShowPaymentInfo">
<t t-jquery='div.oe_form_field' t-operation='replace'>
<div class="oe_form_field"
style="margin-right: 10px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;"
t-att-title="line.date_maturity + ' - ' + line.title">
<t t-esc="line.date_maturity"></t> - <t t-esc="line.invoice"></t>
</div>
</t>
</t>
</templates>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter