diff --git a/controllers/__init__.py b/controllers/__init__.py deleted file mode 100644 index ed5c1788c063fee3739c1d0cae259c55dfa3e9b2..0000000000000000000000000000000000000000 --- a/controllers/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2022 Le Filament (<http://www.le-filament.com>) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from . import portal diff --git a/controllers/portal.py b/controllers/portal.py deleted file mode 100644 index ee55f8b34a0f01caadde860ee99ffadd4434477a..0000000000000000000000000000000000000000 --- a/controllers/portal.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2022 Le Filament (<http://www.le-filament.com>) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - - -from odoo import http, _ -from odoo.addons.portal.controllers.portal import CustomerPortal - - -class PortalAccount(CustomerPortal): - - @http.route(['/my/invoices/<int:invoice_id>'], type='http', auth="public", website=True) - def portal_my_invoice_detail(self, invoice_id, access_token=None, report_type=None, download=False, **kw): - invoice_sudo = self._document_check_access('acc.account', invoice_id, access_token) - - if report_type in ('html', 'pdf', 'text'): - return self._show_report( - model=invoice_sudo, - report_type=report_type, - report_ref='acc_account.acc_account_invoices', - download=download) diff --git a/models/acc_account.py b/models/acc_account.py index fcc1454355c18909eb5a15b5480f8014b19e375d..c935c69788793e74545c6a6e95c806b632bac11b 100644 --- a/models/acc_account.py +++ b/models/acc_account.py @@ -97,6 +97,12 @@ class AccAccount(models.Model): amount_total = fields.Monetary( string="Total", store=True, readonly=True, compute="_compute_amount" ) + amount_tcfe = fields.Monetary( + string="Montant TCFE", store=True, readonly=True, compute="_compute_amount" + ) + amount_without_tcfe = fields.Monetary( + string="Montant hors TCFE", store=True, readonly=True, compute="_compute_amount" + ) # inverse='_inverse_amount_total') power_cons = fields.Float("Consommation locale (index Enedis)") url = fields.Char("URL", compute="_compute_url", store=True) @@ -144,10 +150,16 @@ class AccAccount(models.Model): total_tax = 0.0 total = 0.0 tot_qty = 0.0 + tot_tcfe = 0.0 + tot_tcfe_off = 0.0 for line in move.line_ids: total += line.price_total tot_qty += line.quantity + if line.is_tax: + tot_tcfe += line.price_total + else: + tot_tcfe_off += line.price_total if move.is_tva and move.tax_id: total_tax = (total * move.tax_id.amount) / 100 @@ -155,6 +167,8 @@ class AccAccount(models.Model): move.amount_untaxed = total move.amount_tax = total_tax move.amount_total = total + total_tax + move.amount_tcfe = tot_tcfe + move.amount_without_tcfe = tot_tcfe_off def _compute_url(self): for account in self: @@ -206,6 +220,7 @@ class AccAccountLine(models.Model): end_date = fields.Date("Fin de la période") description = fields.Text("Description de la ligne") is_tva = fields.Boolean(related="acc_account_id.is_tva") + is_tax = fields.Boolean("Est une taxe") @api.depends("quantity", "price_unit") def _compute_amount(self): @@ -266,7 +281,8 @@ class AccAccountTaxTcfe(models.Model): _("Un prix de vente existe déjà pour cette date là") ) - price_id = self.env["acc.account.tax.tcfe"].search([], + price_id = self.env["acc.account.tax.tcfe"].search( + [], limit=1, order="create_date desc", ) diff --git a/models/acc_operation.py b/models/acc_operation.py index d9e6d9a0506cac06bae647a6270b177a57ab4f77..d60599aeb9ef82127e6a4096b6c97325213c3628 100644 --- a/models/acc_operation.py +++ b/models/acc_operation.py @@ -330,14 +330,15 @@ class AccOperation(models.Model): AccountLine.create( { "quantity": power_total, + "is_tax": True, "price_unit": interval.price, "acc_account_id": acc_account.id, "start_date": date_interval_start, "end_date": date_interval_end, "description": "TCFE - Période du " - + str(date_interval_start) - + " au " - + str(date_interval_end), + + str(date_interval_start) + + " au " + + str(date_interval_end), } ) account_list.append(acc_account) diff --git a/report/account_report.xml b/report/account_report.xml index 59b108f654c4f732db8921865253e04547ad14c8..3722aaf8f760a587e94e044b75f44748eb23937f 100644 --- a/report/account_report.xml +++ b/report/account_report.xml @@ -6,6 +6,7 @@ <field name="name">Factures</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</field> <field name="report_file">account.report_account</field> <field name="print_report_name">'Facture - %s' % (object.name)</field> diff --git a/report/account_template.xml b/report/account_template.xml index 3309a93715a239a3e023d82424ffb53529be22eb..572e285ad818921183db33c6140f5ac38e557bb8 100644 --- a/report/account_template.xml +++ b/report/account_template.xml @@ -275,8 +275,8 @@ /><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-field="o.pmo_id.city" + /><br /></t> <t t-if="o.pmo_id.phone"> <span class="font-weight-bold" @@ -325,135 +325,139 @@ </div> <div> <h2>Synthèse de votre facture</h2> - <h3>Période de livraison concernée : du <t - t-esc="o.start_date" - /> au <t t-esc="o.end_date" /></h3> - - <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" - /> - <div > - <span - t-field="line.description" - t-options="{'widget': 'text'}" - /><br /> - Prix de l'électricité locale <span - class="text-nowrap" - t-field="line.price_unit"/> € - <span - class="text-nowrap" - t-field="line.price_total"/> - </div> - - </t> - - + <h3>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'}" + /></h3> + <hr /> <table class="table table-sm o_main_table" name="account_line_table" > + <tr> + <td>Consommation locale</td> + <td class="text-right"> + <span t-field="o.power_cons" /> <span + >kWh</span> + </td> + </tr> <tr> <td>Prix de l'électricité locale</td> <td class="text-right"> + <span + t-field="o.amount_without_tcfe" + /> <span>HT</span> </td> </tr> <tr> - <td>Consommation locale (index Enedis)</td> + <td>Prix de la TCFE</td> <td class="text-right"> - <span t-field="o.power_cons" /> <span - >kWh</span> + <span t-field="o.amount_tcfe" /> <span + >HT</span> </td> </tr> - - <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="border-black"> - <t - name="account_invoice_line_accountable" - > - <td - name="account_invoice_line_name" - > - <span - t-field="line.description" - t-options="{'widget': 'text'}" - /><br /> - Prix de l'électricité locale <span + <tr /> + <tr> + <td><strong>Total H.T.</strong></td> + <td class="text-right"> + <span t-field="o.amount_untaxed" /> + </td> + </tr> + <hr /> + <t t-if="o.is_tva"> + <tr style=""> + <t> + <td><span class="text-nowrap" - t-field="line.price_unit" - /> € - </td> + />TVA applicable <span + t-field="o.tax_id.name" + /></td> <td class="text-right"> <span class="text-nowrap" - t-field="line.price_total" + t-field="o.amount_tax" /> </td> </t> </tr> - </t> - </table> + <tr> + <td><strong>Total TTC*</strong></td> + <td class="text-right"> + <strong><span + class="text-nowrap" + t-field="o.amount_total" + /></strong> + </td> + </tr> - </div> - <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><strong>Sous-Total</strong></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</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</strong></td> - <td class="text-right"> - <span - class="text-nowrap" - t-field="o.amount_total" - /> - </td> - </tr> - </table> - </div> + </table> + <div> + <p + >*Le total à payer correspond à l’électricité autoconsommée, + la contribution d’acheminement et les taxes hors TVA sur cette + électricité sont collectées par le fournisseur du complément + électrique.</p> </div> </div> +<!-- <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><strong>Sous-Total</strong></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</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">--> +<!-- <span--> +<!-- class="text-nowrap"--> +<!-- t-field="o.amount_total"--> +<!-- />--> +<!-- </td>--> +<!-- </tr>--> +<!-- </table>--> +<!-- <div>--> +<!-- <p>*Le total à payer correspond à l’électricité autoconsommée,--> +<!-- la contribution d’acheminement et les taxes hors TVA sur cette--> +<!-- électricité sont collectées par le fournisseur du complément--> +<!-- électrique.</p>--> +<!-- </div>--> +<!-- </div>--> +<!-- </div>--> +<!-- </div>--> </div> </div> diff --git a/security/security.xml b/security/security.xml index a53d0e445d0a0f102184f96be03f4a69cf009331..8b7f107258daf9dc5cd43b07bdbd74fae0c2951b 100644 --- a/security/security.xml +++ b/security/security.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" ?> <odoo> - <data noupdate="1"> + <data noupdate="0"> <!-- Portal for invoice and invoice lines --> <record id="acc_account_rule_portal_cons" model="ir.rule"> @@ -25,7 +25,10 @@ <record id="acc_account_rule_portal_pmo" model="ir.rule"> <field name="name">Portail : Factures pour les pmo</field> <field name="model_id" ref="acc_account.model_acc_account" /> - <field name="domain_force">[('pmo_id','=',[user.partner_id.id])]</field> +<!-- <field name="domain_force">[('pmo_id','=',[user.partner_id.id])]</field>--> + <field + name="domain_force" + >[('pmo_id','child_of',[user.partner_id.id])]</field> <field name="groups" eval="[(4, ref('base.group_portal'))]" /> </record> diff --git a/static/src/scss/style.scss b/static/src/scss/style.scss index 9351058055958b1f8714096d6d2d98c3ff8d4dc2..08a0029472dabefaae3a0f296429ee2f1102fbd9 100644 --- a/static/src/scss/style.scss +++ b/static/src/scss/style.scss @@ -7,3 +7,7 @@ .o_report_layout_boxed div#total table tr.o_total strong { color: #000 !important; } + +.o_report_layout_boxed table tbody tr td { + border-right: 0px solid #495057 !important; +} diff --git a/views/acc_account_views.xml b/views/acc_account_views.xml index 750cf8ecfcff205a33100abaceb7de373f9f4e23..bd1e38e296dcb6c7e5a2f2511a7fcfdeda5e083d 100644 --- a/views/acc_account_views.xml +++ b/views/acc_account_views.xml @@ -241,6 +241,8 @@ <field name="start_date" /> <field name="end_date" /> <field name="power_cons" /> + <field name="amount_tcfe" /> + <field name="amount_without_tcfe" /> </group> </group> <group>