diff --git a/__manifest__.py b/__manifest__.py index 7e7b0405495a4bfb8703144194c8881762bf75d4..3dc5f53992f067e689dbb1a914255d635bb093fe 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -32,6 +32,7 @@ "views/menu_views.xml", "report/report_template.xml", "report/account_template.xml", + "report/account_template_old.xml", "report/account_report.xml", ], "qweb": [ diff --git a/models/acc_account.py b/models/acc_account.py index 0376cb8532c5bfa54aacedb8335cff9edabbdea5..0a1e5295257b3fdddb4e2ca60c745b16de79def1 100644 --- a/models/acc_account.py +++ b/models/acc_account.py @@ -147,6 +147,16 @@ class AccAccount(models.Model): "acc.account.payment", string="Méthodes de paiement") free_text = fields.Text("Texte libre à afficher sur les factures") + # OLD DATA + amount_tcfe = fields.Monetary( + string="Montant ACCISE", store=True, readonly=True, compute="_compute_amount" + ) + amount_without_tcfe = fields.Monetary( + string="Montant hors ACCISE", + store=True, + readonly=True, + compute="_compute_amount", + ) @api.model_create_multi def create(self, vals_list): @@ -210,10 +220,21 @@ class AccAccount(models.Model): tot_accise = 0.0 tot_elec = 0.0 tot_divers = 0.0 + # old data + tot_tcfe = 0.0 + tot_tcfe_off = 0.0 for line in move.line_ids: total += line.price_total tot_qty += line.quantity + + # Begin OLD DATA + if line.is_tax: + tot_tcfe += line.price_total + else: + tot_tcfe_off += line.price_total + # End OLD DATA + if line.is_tax and line.acc_injection_id: tot_accise += line.price_total elif line.acc_injection_id: @@ -230,6 +251,8 @@ class AccAccount(models.Model): move.amount_accise_tot = tot_accise move.amount_elec_tot = tot_elec move.amount_divers_tot = tot_divers + move.amount_tcfe = tot_tcfe + move.amount_without_tcfe = tot_tcfe_off def _compute_url(self): """ diff --git a/models/acc_account_payment.py b/models/acc_account_payment.py index 6a069bbf3ab203aeaddf613efac420aad59f2430..e2560f43a6a1592ac41e82293ea56324602f6566 100644 --- a/models/acc_account_payment.py +++ b/models/acc_account_payment.py @@ -37,7 +37,7 @@ class AccAccountPayment(models.Model): def _onchange_name_type(self): self.name = self.name_type if self.name_type == "cheque": - self.description = "Merci d’indiquer au dos du chèque la référence facture ci-dessus" + self.description = "Merci d’indiquer au dos du chèque la référence facture ci-dessus." if self.name_type == "virement": self.description = "Merci d’indiquer la référence facture ci-dessus sur votre ordre de virement.\nIBAN: ...\nCode BIC: ..." # ------------------------------------------------------ diff --git a/report/account_report.xml b/report/account_report.xml index df2ac18b93e87dc364c5418f8631c1c4190b0ea9..e9618b333f523d00164d64b50df89799f6fd4f6e 100644 --- a/report/account_report.xml +++ b/report/account_report.xml @@ -32,5 +32,18 @@ <field name="paperformat_id" ref="acc_account.paperformat_spe" /> </record> + <record id="acc_account_invoices_old" model="ir.actions.report"> + <field name="name">Factures OLD</field> + <field name="model">acc.account</field> + <field name="report_type">qweb-pdf</field> +<!-- <field name="report_type">qweb-html</field>--> + <field name="report_name">acc_account.report_account_old</field> + <field name="report_file">account.report_account_old</field> + <field name="print_report_name">'Facture - %s' % (object.name)</field> + <field name="binding_model_id" ref="model_acc_account" /> + <field name="binding_type">report</field> + <field name="paperformat_id" ref="acc_account.paperformat_spe" /> + </record> + </data> </odoo> diff --git a/report/account_template.xml b/report/account_template.xml index f4e199a495cb59156943190e560ef73f38804a0c..f4eb7a8c7f4ac9462f4656cf1e4ae1065a6fc570 100644 --- a/report/account_template.xml +++ b/report/account_template.xml @@ -278,7 +278,7 @@ <span t-field="o.acc_operation_id.description" /><br /> <span class="font-weight-bold" - >Numéro ACC (²)</span><br /> + >Numéro ACC⁽²⁾</span><br /> <span t-field="o.acc_operation_id.name" /><br /> <span class="font-weight-bold" @@ -378,7 +378,7 @@ </td> </tr> <tr> - <td>Total Frais Divers / Régularisation</td> + <td>Total Frais Divers</td> <td class="text-right"> <span t-field="o.amount_divers_tot" /> <span >HT</span> @@ -422,7 +422,7 @@ </t> <tr> <td><strong><h5 - >Total TTC (¹)</h5></strong></td> + >Total TTC⁽¹⁾</h5></strong></td> <td class="text-right"> <strong><h4 class="text-nowrap" @@ -456,11 +456,11 @@ </div> <div class="row mt-2"> <div class="col-12"> - <h5 >Délai de règlement : à facturation</h5> - <h5 class="mb-5">Date limite de règlement : <span + <h6 >Délai de règlement : à facturation</h6> + <h6 class="mb-5">Date limite de règlement : <span t-field="o.date_limit" t-options="{'format': 'dd/MM/yyyy'}" - /></h5> + /></h6> </div> </div> </t> @@ -472,7 +472,7 @@ <div class="row mt-3"> <div class="col-12 font-italic font-mini"> <p class="mt-5"> - (¹) Le total à payer correspond à l’électricité autoconsommée et à l'ACCISE - (²) ACC : Auto-Consommation Collective + ⁽¹⁾Le total à payer correspond à l’électricité autoconsommée et à l'ACCISE - ⁽²⁾ACC : Auto-Consommation Collective </p> <span t-if="o.invoice_terms" t-field="o.invoice_terms"/> </div> @@ -501,7 +501,7 @@ >Autoconsommation Collective <t t-esc="o.acc_operation_id.name" /></span><br /> - <h5>PRM-I : <span class="font-weight-bold " t-field="injection.name"/></h5> + <h5 class="font-weight-bold ">PRM-I : <span class="font-weight-bold " t-field="injection.name"/></h5> </div> </div> <div class="row mt-5 "> @@ -709,7 +709,7 @@ <div class="row mt-5 "> <div class="col-12"> <!-- Table les lignes spécifiques --> - <h6>Frais divers / Régularisation</h6> + <h6>Frais divers</h6> <table class="table table-sm o_main_table" name="account_line_table" diff --git a/report/account_template_old.xml b/report/account_template_old.xml new file mode 100644 index 0000000000000000000000000000000000000000..da7002c819fbed74e9c9df007b80cb70266f09f6 --- /dev/null +++ b/report/account_template_old.xml @@ -0,0 +1,657 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo> + <data> + + <template id="report_account_document_old"> + <t t-call="acc_account.external_layout_spe"> + <t t-set="o" t-value="o.with_context(lang=o.producer_id.lang)" /> +<!-- Rapport Facture Surplus--> + <t t-if="o.is_account_buyer"> + <div class="page"> + <div class="row"> + <div class="col-3"> + <img + t-if="o.producer_id.image_1920" + t-att-src="image_data_uri(o.producer_id.image_1920)" + style="max-height: 80px;" + alt="Logo" + /> + <p class="mt-2" t-field="o.producer_id.name" /> + </div> + + <div class="col-9 text-right"> + <p class="font-weight-bold"> + <span>Facture <t t-esc="o.name" /></span><br /> + <span>En date du: <t t-esc="o.date" /> + </span><br /> + <t + t-if="o.producer_id.vat" + >TVA Intracommunautaire: <span + t-field="o.producer_id.vat" + /></t> + </p> + </div> + </div> + + <div class="row mt32 mb32"> + <div class="col-3"> + </div> + <div class="col-9"> + <div class="text-right"> + <p> + <span + class="font-weight-bold" + t-field="o.producer_id.name" + /><br /> + <span t-field="o.producer_id.street" /><br /> + <t t-if="o.producer_id.street2"><span + t-field="o.producer_id.street2" + /><br /></t> + <span t-field="o.producer_id.zip" /> - <span + t-field="o.producer_id.city" + /><br /> + </p> + </div> + + </div> + </div> + <div class="row mt32 mb32"> + <div class="col-12"> + <p + >Objet: Facture de production d'énergie renouvelable - Surplus <span + t-field="o.acc_operation_id.name" + /></p> + <table + class="table table-sm " + name="account_line_table" + > + <thead> + <tr> + <th>Description</th> + <th>Qté</th> + <th>PU H.T.</th> + <th>Total H.T.</th> + </tr> + </thead> + <tbody> + <t t-set="lines" t-value="o.line_ids" /> + <t t-set="current_subtotal" t-value="0" /> + <t t-foreach="lines" t-as="line"> + <t + t-set="current_subtotal" + t-value="current_subtotal + line.price_total" + /> + <tr class=""> + <t + name="account_invoice_line_accountable" + > + <td + name="account_invoice_line_name" + > + <span + t-field="line.description" + t-options="{'widget': 'text'}" + /> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.quantity" + /> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_unit" + /><span> kWh</span> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_total" + /> + </td> + </t> + </tr> + + </t> + </tbody> + </table> + <div class="clearfix"> + <div id="total" class="row"> + <div t-attf-class="col-6 ml-auto"> + <table + class="table table-sm" + style="page-break-inside: avoid;" + > + <tr + class="border-black o_subtotal" + style="" + > + <td>Total H.T.</td> + <td class="text-right"> + <span + t-field="o.amount_untaxed" + /> + </td> + </tr> + <t t-if="o.is_tva"> + <tr style=""> + <t> + <td><span + class="text-nowrap" + />TVA applicable 20%</td> + <td + class="text-right o_price_total" + > + <span + class="text-nowrap" + t-field="o.amount_tax" + /> + </td> + </t> + </tr> + </t> + <tr class="border-black o_total"> + <td><strong>Total TTC</strong></td> + <td class="text-right"> + <strong><span + class="text-nowrap" + t-field="o.amount_total" + /></strong> + </td> + </tr> + </table> + </div> + </div> + </div> + </div> + </div> + <div class="mt32 "> + <p t-if="o.producer_id.iban" name="payment_term"> + <span + class="font-weight-bold" + >Modalités de paiement : règlement par virement</span><br + /> + <span + >Le règlement par virement bancaire doit être effectué sur le compte suivant :</span><br + /> + <span>IBAN : <t t-esc="o.producer_id.iban" /></span><br + /> + <span>BIC : <t t-esc="o.producer_id.bic" /></span><br /> + <br /> + <span + >Merci de bien vouloir indiquer le numéro de facture et/ou votre référence client sur l’ordre de virement</span> + </p> + <p> + En cas de paiement anticipé, aucun escompte ne sera accordé Indemnités pour frais de recouvrement en cas de retard de paiement : 40.00€ sauf frais supplémentaires. Conformément à l’article L 441-6 du Code de commerce, en cas de non paiement à l'échéance, sera appliquée une pénalité de retard équivalente à trois fois le taux d'intérét légal en vigueur. + </p> + </div> + </div> + </t> + <t t-else=""> + <div class="page"> + <div class="row"> + <div class="col-3"> + <img + t-if="o.producer_id.image_1920" + t-att-src="image_data_uri(o.producer_id.image_1920)" + style="max-height: 80px;" + alt="Logo" + /> + <p class="mt-2" t-field="o.producer_id.name" /> + </div> + + <div class="col-9 text-right"> + <p class="font-weight-bold"> + <span + class="text-uppercase text-uppercase mt0 " + >Autoconsommation Collective <t + t-esc="o.acc_operation_id.name" + /></span><br /> + <span + class="text-uppercase mt0 " + >Vente d'électricité d'origine renouvelable</span><br + /> + <span>Facture <t t-esc="o.name" /> du <t + t-esc="o.date" + /></span> + </p> + </div> + </div> + + <div class="row mt32 mb32"> + <div class="col-4"> + <div> + <p> + <span + class="text-center font-weight-bold" + >Vos références utiles</span><br /> + <span + class="font-weight-bold" + >Titulaire du contrat:</span><br /> + <span t-field="o.consumer_id.name" /><br /> + <span t-field="o.consumer_id.street" /><br /> + <t t-if="o.consumer_id.street2"><span + t-field="o.consumer_id.street2" + /><br /></t> + <span t-field="o.consumer_id.zip" /> - <span + t-field="o.consumer_id.city" + /><br /> + <span + class="font-weight-bold" + >Courrier:</span><br /> + <span t-field="o.consumer_id.email" /><br /> + <span + t-if="o.consumer_id.ref" + class="font-weight-bold" + >Référence Client:</span><br /> + <span t-field="o.consumer_id.ref" /> + <span + t-if="o.consumer_id.vat" + class="font-weight-bold" + >N°TVA:</span><br /> + <span t-field="o.consumer_id.vat" /> + <span + t-if="o.consumer_id.siret" + class="font-weight-bold" + >N°TVA:</span><br /> + <span t-field="o.consumer_id.siret" /> + </p> + <hr /> + <p> + <span + class="font-weight-bold" + >Référence Point de livraison (PDL):</span><br + /> + <span t-field="o.acc_delivery_id.name" /><br /> + <span + class="font-weight-bold" + >Lieu de consommation:</span><br /> + <span t-field="o.acc_delivery_id.street" /><br + /> + <t t-if="o.acc_delivery_id.street2"><span + t-field="o.acc_delivery_id.street2" + /><br /></t> + <t t-if="o.acc_delivery_id.zip"> + <span t-field="o.acc_delivery_id.zip" /> - <span + t-field="o.acc_delivery_id.city" + /><br /></t> + </p> + </div> + <div> + <p> + <span + class="text-center font-weight-bold" + >Pour répondre à vos questions</span><br /> + <span + class="font-weight-bold" + >Contact PMO</span><br /> + <span + class="font-weight-bold" + t-field="o.pmo_id.name" + /><br /> + <span t-field="o.pmo_id.street" /><br /> + <t t-if="o.pmo_id.street2"><span + t-field="o.pmo_id.street2" + /><br /></t> + <t t-if="o.pmo_id.zip"> + <span t-field="o.pmo_id.zip" /> - <span + t-field="o.pmo_id.city" + /><br /></t> + <t t-if="o.pmo_id.phone"> + <span + class="font-weight-bold" + >Téléphone:</span><br /> + <span t-field="o.pmo_id.phone" /><br /> + </t> + <t t-if="o.pmo_id.email"> + <span + class="text-center font-weight-bold" + >Courrier:</span> + <span t-field="o.pmo_id.email" /> + </t> + </p> + <hr /> + <p> + <span + class="text-center font-weight-bold" + >Référence Autoconsommation collective:</span><br + /> + <span t-field="o.acc_operation_id.name" /><br /> + <span + class="font-weight-bold" + >Nom producteur</span><br /> + <span t-field="o.producer_id.name" /><br /> + <span + class="font-weight-bold" + >Référence point d'injection (PRM):</span><br /> + <span t-field="o.acc_injection_id.name" /><br /> + <span + class="text-center font-weight-bold" + >Lieu de production:</span><br /> + <span t-field="o.acc_injection_id.street" /><br + /> + <t t-if="o.acc_injection_id.street2"><span + t-field="o.acc_injection_id.street2" + /><br /></t> + <t t-if="o.acc_injection_id.zip"> + <span + t-field="o.acc_injection_id.zip" + /> - <span + t-field="o.acc_injection_id.city" + /><br /></t> + </p> + </div> + </div> + <div class="col-8"> + <div class="text-right"> + <p> + <span + class="text-center font-weight-bold" + >Coordonnées de facturation</span><br /> + <span + class="font-weight-bold" + t-field="o.consumer_id.name" + /><br /> + <span t-field="o.consumer_id.street" /><br /> + <t t-if="o.consumer_id.street2"><span + t-field="o.consumer_id.street2" + /><br /></t> + <span t-field="o.consumer_id.zip" /> - <span + t-field="o.consumer_id.city" + /><br /> + </p> + </div> + <div> + <h3>Synthèse de votre facture</h3> + <h4>Période de livraison concernée : du <span + t-field="o.start_date" + t-options="{'format': 'dd/MM/yyyy'}" + /> au <span + t-field="o.end_date" + t-options="{'format': 'dd/MM/yyyy'}" + /> + </h4> + <hr /> + + <table + class="table table-sm table-none o_main_table" + name="account_line_table" + > + <tr> + <td>Electricité autoconsommée</td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="o.power_cons" + />kWh + </td> + </tr> + <tr> + <td>Total électricité locale</td> + <td class="text-right"> + <span + t-field="o.amount_without_tcfe" + /> <span>HT</span> + </td> + </tr> + <tr> + <td>Total ACCISE</td> + <td class="text-right"> + <span t-field="o.amount_tcfe" /> <span + >HT</span> + </td> + </tr> + <tr> + <td /> + <td /> + </tr> + <tr> + <td /> + <td /> + </tr> + <tr> + <td><strong><h5 + >Total H.T.</h5></strong></td> + <td class="text-right"> + <h4 t-field="o.amount_untaxed" /> + </td> + </tr> + <hr /> + <t t-if="o.is_tva"> + <tr style=""> + <t> + <td><span + class="text-nowrap" + />TVA applicable <span + t-field="o.tax_id.name" + /></td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="o.amount_tax" + /> + </td> + </t> + </tr> + </t> + <tr> + <td><strong><h4 + >Total TTC*</h4></strong></td> + <td class="text-right"> + <strong><h3 + class="text-nowrap" + t-field="o.amount_total" + /></strong> + </td> + </tr> + + </table> + <div> + <h5 + >Montant à régler 15 jours après réception</h5> + <p + >*Le total à payer correspond à l’électricité autoconsommée, + et à la taxe sur la consommation finale d’électricité. La contribution + d’acheminement (“TURPE”) est collectée par + le fournisseur du complément d’électricité</p> + </div> + </div> + + </div> + </div> + + <p t-if="o.producer_id.iban" name="payment_term"> + <div class="row mt32 mb32"> + <div class="col-12"> + <span + class="font-weight-bold" + >Modalités de paiement : règlement par virement</span><br + /> + <span + >Le règlement par virement bancaire doit être effectué sur le compte suivant :</span><br + /> + <span>IBAN : <t + t-esc="o.producer_id.iban" + /></span><br /> + <span>BIC : <t + t-esc="o.producer_id.bic" + /></span><br /> + <br /> + <span + >Merci de bien vouloir indiquer le numéro de facture sur l’ordre de virement</span> + </div> + </div> + </p> + <div class="row mt32 mb32" style="page-break-before:always;"> + <div class="col-12"> + <h4>Votre facture en détail</h4> + <!-- Table pour l'électricité locale--> + <table + class="table table-sm o_main_table" + name="account_line_table" + > + <thead> + <tr> + <th colspan="4"> + Electricité Locale + </th> + </tr> + <tr> + <th>Production</th> + <th>Quantité d'électricité renouvelable</th> + <th>Prix</th> + <th>Montant</th> + </tr> + </thead> + <tbody> + <t t-set="lines" t-value="o.line_ids" /> + <t t-foreach="lines" t-as="line"> + <t t-if="not line.is_tax"> + <tr class=""> + <td> + <span + t-field="line.description" + t-options="{'widget': 'text'}" + /> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.quantity" + /><span> kWh</span> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_unit" + /><span> €/kWh</span> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_total" + /> + </td> + </tr> + </t> + </t> + </tbody> + </table> + + <!-- Table pour les taxes TCFE--> + <table + class="table table-sm o_main_table" + name="account_line_table" + > + <thead> + <tr> + <th colspan="4"> + Taxe sur la consommation finale d’électricité (ACCISE) + </th> + </tr> + <tr> + <th>Production</th> + <th + >Quantité d'électricité renouvelable autoconsommée</th> + <th>Prix</th> + <th>Montant</th> + </tr> + </thead> + <tbody> + <t t-set="lines" t-value="o.line_ids" /> + <t t-foreach="lines" t-as="line"> + <t t-if="line.is_tax"> + <tr class=""> + <td> + <span + t-field="line.description" + t-options="{'widget': 'text'}" + /> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.quantity" + /><span> kWh</span> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_unit" + /><span> €/kWh</span> + </td> + <td class="text-right"> + <span + class="text-nowrap" + t-field="line.price_total" + /> + </td> + </tr> + + </t> + <t t-else="" /> + </t> + </tbody> + </table> + </div> + </div> + </div> + </t> + <div t-attf-class="footer o_boxed_footer o_company_layout"> + <div class="text-center"> + <ul class="list-inline"> + <li class="list-inline-item"> + <t t-if="o.producer_id.name"><span + t-field="o.producer_id.name" + /></t> + <t t-if="o.producer_id.company_form"> - <span + t-field="o.producer_id.company_form" + /></t> + <t t-if="o.producer_id.street"> - <span + t-field="o.producer_id.street" + /></t> + <t t-if="o.producer_id.zip">, <span + t-field="o.producer_id.zip" + /></t> + <t t-if="o.producer_id.city"> <span + t-field="o.producer_id.city" + /></t> + <br /> + <t t-if="o.producer_id.siret"><span + t-field="o.producer_id.siret" + /></t> + <t t-if="o.producer_id.naf"> - <span + t-field="o.producer_id.naf" + /></t> + <t t-if="o.producer_id.rcs"> - <span + t-field="o.producer_id.rcs" + /></t> + <t t-if="o.producer_id.vat"> - <span + t-field="o.producer_id.vat" + /></t> + </li> + </ul> + <div t-if="report_type == 'pdf'"> + Page: <span class="page" /> / <span class="topage" /> + </div> + </div> + </div> + + </t> + </template> + + <template id="report_account_old"> + <t t-call="web.html_container"> + <t t-foreach="docs" t-as="o"> + <t + t-call="acc_account.report_account_document_old" + t-lang="o.producer_id.lang" + /> + </t> + </t> + </template> + + </data> +</odoo>