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

[update] update result of JSON reconcile widget to add maturity date

parent 43b72485
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import json
from odoo import api, fields, models
......@@ -75,48 +76,19 @@ class ScopAccountMove(models.Model):
# ------------------------------------------------------
# Override Parent
# ------------------------------------------------------
# TODO: check if necessary
# def _get_outstanding_info_JSON(self):
# super(ScopAccountMove, 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)
def _compute_payments_widget_to_reconcile_info(self):
"""
Modifie les données de sortie du JSON de réconciliation pour ajouter
la date d'échéance
"""
super()._compute_payments_widget_to_reconcile_info()
for move in self:
info = json.loads(move.invoice_outstanding_credits_debits_widget)
if info:
lines_info = info["content"]
for line in lines_info:
line_id = move.line_ids.browse(line.get("id"))
line.update(
{"date_maturity": fields.Date.to_string(line_id.date_maturity)}
)
move.invoice_outstanding_credits_debits_widget = json.dumps(info)
......@@ -9,9 +9,9 @@
<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-att-title="line.date_maturity + ' - ' + line.journal_name"
>
<t t-esc="line.date_maturity" /> - <t t-esc="line.invoice" />
<t t-esc="line.date_maturity" /> - <t t-esc="line.journal_name" />
</div>
</t>
</t>
......
......@@ -65,10 +65,16 @@
<field name="mode">primary</field>
<field name="inherit_id" ref="account.view_invoice_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_partner_display_name']" position="before">
<xpath
expr="//field[@name='invoice_partner_display_name']"
position="before"
>
<field name="partner_member_number" readonly="1" />
</xpath>
<xpath expr="//field[@name='invoice_partner_display_name'][2]" position="attributes">
<xpath
expr="//field[@name='invoice_partner_display_name'][2]"
position="attributes"
>
<attribute name="string">Adhérent</attribute>
</xpath>
<xpath expr="//field[@name='invoice_origin']" position="after">
......
......@@ -22,7 +22,7 @@ class ContributionAccountMoveReversal(models.TransientModel):
"year": move.year,
"is_contribution": move.is_contribution,
"type_contribution_id": move.type_contribution_id.id,
"payment_term_id": move.payment_term_id.id,
"invoice_payment_term_id": move.invoice_payment_term_id.id,
}
)
return refund
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