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

[add] payments report

parent 7f595fcf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# © 2022 Le Filament (<http://www.le-filament.com>) # © 2022 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 . import models, wizard from . import models, report, wizard
...@@ -14,14 +14,21 @@ ...@@ -14,14 +14,21 @@
"queue_job_batch", "queue_job_batch",
], ],
"data": [ "data": [
# security
"security/security_rules.xml", "security/security_rules.xml",
"security/ir.model.access.csv", "security/ir.model.access.csv",
# wizard
"wizard/scop_cotisation_aura_wizard.xml",
# templates
"templates/report_cotisation_aura.xml",
"templates/report_cotisation_aura_refund.xml",
"templates/report_aura_contribution_payments.xml",
# views
"views/res_config_settings.xml", "views/res_config_settings.xml",
"views/scop_cotisation_aura.xml", "views/scop_cotisation_aura.xml",
"views/account_move.xml", "views/account_move.xml",
"views/account_payment_term.xml", "views/account_payment_term.xml",
"views/report_cotisation_aura.xml", # reports
"views/report_cotisation_aura_refund.xml", "report/scop_contribution_report.xml",
"wizard/scop_cotisation_aura_wizard.xml",
], ],
} }
# © 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import scop_contribution_report
# © 2022 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import _, fields, models
from odoo.exceptions import UserError
class ScopContributionReport(models.Model):
_inherit = "scop.contribution.report"
is_aura_report = fields.Boolean("Appel AURA lié", compute="_compute_is_aura_report")
# ------------------------------------------------------
# Compute
# ------------------------------------------------------
def _compute_is_aura_report(self):
ur_aura = self.env.ref("cgscop_partner.riga_14353")
contrib_ur = self.env.ref("cgscop_partner.riga_14399")
for contribution in self:
if (
contribution.year > "2020"
and contribution.type_contribution_id == contrib_ur
and contribution.partner_id.ur_id == ur_aura
):
contribution.is_aura_report = True
else:
contribution.is_aura_report = False
# ------------------------------------------------------
# Button
# ------------------------------------------------------
def print_aura_report_with_payment(self):
invoice_ids = self.get_invoice_contribution()
if len(invoice_ids) != 1:
raise UserError(_(
"Il n'est pas possible d'imprimer l'état des paiements car plusieurs "
"ajustements ont été effectués sur cet appel de cotisation.\n"
"Vous pouvez vous rapprocher du service administratif pour plus de détail."
))
return (
self.env.ref(
"cgscop_cotisation_aura.aura_contribution_report_with_payments"
)
.sudo()
.report_action(invoice_ids.sudo())
)
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<!-- FORM VIEW -->
<record model="ir.ui.view" id="scop_contribution_report_aura_form">
<field name="name">scop.contribution.report.aura.form</field>
<field name="model">scop.contribution.report</field>
<field
name="inherit_id"
ref="cgscop_cotisation.scop_contribution_report_form"
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payments']" position="before">
<field name="is_aura_report" invisible="1" />
<div
attrs="{'invisible': [('is_aura_report', '=', False)]}"
class="mt16 mb16"
>
<button
name="print_aura_report_with_payment"
type="object"
string="Imprimer l'état des paiements"
icon="fa-file-pdf-o"
class="btn btn-sm btn-outline-info"
/>
</div>
</xpath>
</field>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="report_aura_contribution_payments_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.sudo().with_context(lang='fr')" />
<div class="page" style="font-size: 15px;">
<!-- Adresse -->
<div class="row">
<div class="col-6 offset-6 oe_mt64 oe_mb64">
<span
t-field="o.partner_id.name"
style="text-transform: uppercase; font-weight: 600;"
/><br />
<span t-field="o.partner_id.street" /><br />
<t t-if="o.partner_id.street2"><span
t-field="o.partner_id.street2"
/><br /></t>
<t t-if="o.partner_id.street3"><span
t-field="o.partner_id.street3"
/><br /></t>
<span t-field="o.partner_id.zip" /> <span
t-field="o.partner_id.city"
style="text-transform: uppercase;"
/>
<t t-if="o.partner_id.cedex"> <span
t-field="o.partner_id.cedex"
/></t>
</div>
</div>
<!-- Titre -->
<div class="row">
<div class="col-12 text-center">
<h2 style="color: #E5074D;">
Etat des paiements de cotisation <t
t-esc="str(o.year)"
/>
</h2>
</div>
</div>
<!-- Détail adhérent et n° de bordereau -->
<div class="row">
<div class="col-12 oe_mb16">
<p>
N° adhérent : <t
t-esc="str(o.partner_id.member_number_int)"
/><br />
N° Appel : <span t-field="o.name" /><br />
Le <t
t-esc="datetime.date.today()"
t-options="{'widget': 'date', 'format': 'dd MMMM YYYY'}"
/>
</p>
</div>
</div>
<div class="row">
<!-- Rappel cotisations annuelles -->
</div>
</div>
</t>
</template>
<template id="report_aura_contribution_payments">
<t t-call="web.html_container">
<t t-set="docs" t-value="docs.with_context(lang='fr')" />
<t t-foreach="docs" t-as="o">
<t
t-call="cgscop_cotisation_aura.report_aura_contribution_payments_document"
t-lang="fr"
/>
</t>
</t>
</template>
<!-- QWeb Reports -->
<record id="aura_contribution_report_with_payments" model="ir.actions.report">
<field name="name">UR AURA - État des paiements</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field
name="report_name"
>cgscop_cotisation_aura.report_aura_contribution_payments</field>
</record>
</data>
</odoo>
Fichier déplacé
...@@ -18,16 +18,25 @@ ...@@ -18,16 +18,25 @@
expr="//button[@name='action_invoice_sent']" expr="//button[@name='action_invoice_sent']"
position="attributes" position="attributes"
> >
<attribute name="invisible">True</attribute> <attribute name="invisible">1</attribute>
</xpath> </xpath>
<xpath <xpath
expr="//button[@name='action_invoice_sent']" expr="//button[@name='action_invoice_sent']"
position="attributes" position="attributes"
> >
<attribute name="invisible">True</attribute> <attribute name="invisible">1</attribute>
</xpath> </xpath>
<xpath expr="//button[@name='preview_invoice']" position="attributes"> <xpath expr="//button[@name='preview_invoice']" position="attributes">
<attribute name="invisible">True</attribute> <attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='preview_invoice']" position="after">
<button
name="%(cgscop_cotisation_aura.aura_contribution_report_with_payments)d"
type="action"
string="État des paiements"
class="btn-primary"
attrs="{'invisible': ['|', '|', ('state', '!=', 'posted'), ('move_type', '!=', 'out_invoice'), ('is_contribution', '!=', True)]}"
/>
</xpath> </xpath>
<xpath expr="//field[@name='liasse_fiscale_id']" position="replace"> <xpath expr="//field[@name='liasse_fiscale_id']" position="replace">
......
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