diff --git a/models/account_move.py b/models/account_move.py index a810061017fb4e692906ec69ab0058bc3942a456..0c0c7f0f3a4a47613c6d45c5a42ce242fe6362c4 100644 --- a/models/account_move.py +++ b/models/account_move.py @@ -1,6 +1,7 @@ # © 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) diff --git a/static/src/xml/account_payment.xml b/static/src/xml/account_payment.xml index b2bfc276b5ea95bff5cb8af5aa67fdc81a7fe4a2..0f301f1649ad13bc8f6fbac6d4efdb1b726cf06c 100644 --- a/static/src/xml/account_payment.xml +++ b/static/src/xml/account_payment.xml @@ -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> diff --git a/views/account_move.xml b/views/account_move.xml index 296460768c489420f03be69791bade08941e872f..17392d20a7bf2815914ddccc423e858ff415f63d 100644 --- a/views/account_move.xml +++ b/views/account_move.xml @@ -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"> diff --git a/wizard/account_move_reversal.py b/wizard/account_move_reversal.py index bc8cbebe304c71003dfa09737d301a5660e2a824..e1df551d572b97d01e6b732419cf8bb43d9aa031 100644 --- a/wizard/account_move_reversal.py +++ b/wizard/account_move_reversal.py @@ -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