diff --git a/__manifest__.py b/__manifest__.py index ebaf4badd3c6b2282fb535b9ec896cccb11b3f40..b8d7e6ddaef0a0b666927b58f682b85674600ffe 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -28,6 +28,7 @@ "templates/report_scop_bordereau.xml", "templates/report_scop_bordereau_payments.xml", "templates/report_scop_bordereau_refund.xml", + "templates/report_union_sociale.xml", # Views "views/account_invoice.xml", "views/res_config_settings.xml", diff --git a/controllers/__init__.py b/controllers/__init__.py index 4170eb43ad258f212bc0d72bf089e7ec0d0fdfa3..908a0a3d0a6b5b565a6b0761bffc32edaf53ea96 100644 --- a/controllers/__init__.py +++ b/controllers/__init__.py @@ -2,3 +2,4 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import main +from . import union_sociale diff --git a/controllers/union_sociale.py b/controllers/union_sociale.py new file mode 100644 index 0000000000000000000000000000000000000000..41968a263e58dbef23cf12ede73df2ae6e21d8cb --- /dev/null +++ b/controllers/union_sociale.py @@ -0,0 +1,38 @@ +# Copyright 2021 Le Filament (<http://www.le-filament.com>) +# License AGPL-3 or later (http://www.gnu.org/licenses/agpl.html). + +from werkzeug.exceptions import NotFound + +from odoo import http +from odoo.http import request + + +class UnionSocialeController(http.Controller): + # ------------------------------------------------------ + # Routes + # ------------------------------------------------------ + @http.route( + ['/union-sociale/<adh>', + '/union-sociale/<adh>/<year>'], + type='http', auth="public", method=['GET'], csrf=False, website=False) + def get_union_sociale_pdf(self, adh, year=False): + """ + URL pour générer le PDF de l'Union Sociale à joindre au + bordereau de cotisation + :params : adh -> num adhérent + :params : year -> année du bordereau + @return : PDF + """ + partner_id = request.env['res.partner'].sudo().search([('member_number', '=', adh)]) + if partner_id: + ctx = {'year': int(year)} if year else {} + # Get report + report = request.env.ref('cgscop_cotisation_cg.cgscop_union_sociale_report') + # Create PDF + pdf = report.sudo().with_context(ctx).render_qweb_pdf([partner_id.id])[0] + pdfhttpheaders = [('Content-Type', 'application/pdf'), + ('Content-Length', len(pdf)), ] + # Return PDF + return request.make_response(pdf, headers=pdfhttpheaders) + else: + raise NotFound() diff --git a/static/src/img/logo-usscop.png b/static/src/img/logo-usscop.png new file mode 100644 index 0000000000000000000000000000000000000000..4baa268bb3efdd1d826de9f333c9cbb89b4c6108 Binary files /dev/null and b/static/src/img/logo-usscop.png differ diff --git a/templates/report_union_sociale.xml b/templates/report_union_sociale.xml new file mode 100644 index 0000000000000000000000000000000000000000..cea5c02ee697fa8490e3c793cffc653fdaecda37 --- /dev/null +++ b/templates/report_union_sociale.xml @@ -0,0 +1,164 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <data> + + <template id="report_union_sociale_document"> + <style> + .input-block-empty { + width: 15px; height: 15px; + display: inline-block; + border: 1px solid #ccc; background: #fafafa; + margin-right: 10px; + } + .input-empty { + width: 100%; height: 25px; + border: 1px solid #ccc; background: #fafafa; + } + .presta { + margin-bottom: 0; + font-size: 9px; + } + </style> + <t t-if="not o" t-set="o" t-value="doc"/> + <div class="page" style="font-size: 10px;"> + <t t-foreach="range(1,5)" t-as="quarter"> + <div id="union-sociale container" class="mt16 m32" style="page-break-inside: avoid;"> + <hr/> + <div class="row"> + <div class="col-8"> + <p style="margin-bottom: 0; color: #E5074D; font-weight: bold; font-size: 13px;"> + COTISATION UNION SOCIALE DES SCOP ET DES SCIC - + <t t-esc="quarter"/> + <t t-if="quarter == 1">er </t> + <t t-else="">ème </t> + Trimestre + <t t-esc="env.context.get('year', datetime.datetime.now().year)"/> + </p> + <p><strong><i> + L’Union Sociale perçoit directement sa cotisation, + merci de lui envoyer un règlement distinct</i></strong></p> + <p class="mt16"> + <strong>N° ADHÉRENT : <t t-esc="o.member_number"/></strong> + <br/> + <strong>IDENTITÉ SOCIÉTÉ : <t t-esc="o.name.upper()"/></strong> + </p> + </div> + <div class="col-4"> + <div class="text-right" style="font-size: 9px;"> + <img src="/cgscop_cotisation_cg/static/src/img/logo-usscop.png" class="img-fluid" style="max-height: 60px;"/> + <br/> + Tel. : 01 43 07 18 08 - Fax: 01 43 41 50 44<br/> + <a href="mailto:contact@union-sociale.coop">contact@union-sociale.coop</a> - <a href="https://www.union-sociale.coop">www.union-sociale.coop</a> + </div> + </div> + </div> + <div class="row mt16"> + <div class="col-6"> + <div> + <p class="presta"><strong>SALAIRES BRUTS</strong> (non plafonnés du trimestre) :</p> + <p class="input-empty presta"></p> + </div> + <div> + <p class="presta"> + - Pour <strong>PRESTABAT</strong> Scop parisiennes du bâtiment et des travaux publics x <strong>0,40</strong> : + </p> + <p class="input-empty presta"></p> + </div> + <div> + <p class="presta"> + - Pour <strong>PRESTASUP</strong> Scop sur le plan national adhérentes à la super section x <strong>0,40</strong> : + </p> + <p class="input-empty presta"></p> + </div> + <div> + <p class="presta"> + - Pour <strong>PRESTA</strong> les autres Scop x <strong>0,30</strong> : + </p> + <p class="input-empty presta"></p> + </div> + <div> + <p class="presta"> + - Nombre de salariés à la fin de la période : : + </p> + <p class="input-empty"></p> + </div> + <div> + <p class="presta" style="margin-top: 10px; margin-bottom: 5px; font-size: 11px;"> + <strong> + À retourner à l’Union Sociale avant le : + <t t-if="quarter != 4"> + <t t-if="quarter != 3"> + 15/0<t t-esc="quarter * 3 + 1"/>/<t t-esc="env.context.get('year', datetime.datetime.now().year)"/> + </t> + <t t-else=""> + 15/<t t-esc="quarter * 3 + 1"/>/<t t-esc="env.context.get('year', datetime.datetime.now().year)"/> + </t> + </t> + <t t-else=""> + 15/0<t t-esc="quarter - 3"/>/<t t-esc="env.context.get('year', datetime.datetime.now().year) + 1"/> + </t> + </strong> + </p> + <div class="row"> + <div class="col-1"><span class="input-block-empty"/></div> + <div class="col-5">Chèque</div> + <div class="col-1"><span class="input-block-empty"/></div> + <div class="col-5">Virement</div> + </div> + <div class="row"> + <div class="col-6">Date : </div> + <div class="col-6">Signature : </div> + </div> + </div> + </div> + <div class="col-6"> + <div style="padding-top: 70px; "> + <div style="padding: 20px; border: 1px solid #aaa; font-size: 13px;"> + Union sociale des Scop et des Scic<br/> + 61, boulevard de Picpus<br/> + 75012 Paris + </div> + </div> + </div> + </div> + </div> + </t> + </div> + </template> + + <template id="report_union_sociale"> + <t t-call="web.basic_layout"> + <t t-set="docs" t-value="docs.with_context(lang='fr')"/> + <t t-foreach="docs" t-as="o"> + <t t-call="cgscop_cotisation_cg.report_union_sociale_document" t-lang="fr"/> + </t> + </t> + </template> + + <record id="paperformat_union_sociale" model="report.paperformat"> + <field name="name">A4 Union Sociale</field> + <field name="format">A4</field> + <field name="orientation">Portrait</field> + <field name="margin_top">10</field> + <field name="margin_bottom">10</field> + <field name="margin_left">10</field> + <field name="margin_right">10</field> + <field name="header_line" eval="False"/> + <field name="header_spacing">0</field> + <field name="dpi">90</field> + </record> + + <!-- QWeb Reports --> + <report + id="cgscop_union_sociale_report" + model="res.partner" + string="Bordereau Union Sociale" + report_type="qweb-pdf" + name="cgscop_cotisation_cg.report_union_sociale" + file="cgscop_cotisation_cg.report_union_sociale" + paperformat="paperformat_union_sociale" + attachment_use="False" + /> + + </data> +</odoo>