Files
odoo_source/addons/pos_self_order/views/qr_code.xml
T
David Monnom (moda) 0ae2b9a3f2 [IMP] pos_self_order: change authorisation token
Previously, access_token were linked to tables. These tables were linked
to a floor_plan, which could be linked to several pos_configs.

The only way to access the self-order was to obtain a valid table
access_token. This behaviour was not correct because sometimes we would
allow table selection directly in the interface or commands without
a table.

Now, access_token is managed by pos_config. When a user has this token,
they can place commands and select the table they want if the option is
enabled.

closes odoo/odoo#126186

Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-07-03 21:56:04 +02:00

96 lines
4.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="report_self_order_qr_codes_page" model="ir.actions.report">
<field name="name">qr.codes</field>
<field name="model">pos.config</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">pos_self_order.qr_codes_page</field>
<field name="report_file">pos_self_order.qr_codes_page</field>
<field name="print_report_name">"QR codes"</field>
<field name="binding_model_id" ref="model_pos_config"/>
<field name="binding_type">report</field>
</record>
<record id="paperformat_qrcodes" model="report.paperformat">
<field name="name">QR Codes Page</field>
<field name="default" eval="True"/>
<field name="header_line" eval="False"/>
</record>
</data>
<template id="qr_codes_page">
<t t-call="web.basic_layout">
<div class="page">
<h1 class="text-center">
QR Code Menu
</h1>
<!-- There is a very annoying problem here:
wkhtmltopdf does not handle flex-wrap. ( at least not in this version )
This makes it so the bootstrap grid system does not work.
We have to do a workaround -->
<t t-foreach="floors" t-as="floor">
<!-- MDN states that "page-break-after" has been replaced by "break-after",
but "break-after" is not supported in this version of wkhtmltopdf so we
have to keep using "page-break-after" -->
<div style="page-break-after: always;">
<h3 t-if="floor.get('name')" t-out="floor['name']" class="mb-5"/>
<div
t-foreach="floor['rows_of_tables']"
t-as="row_of_tables"
class="d-flex"
>
<t t-foreach="row_of_tables"
t-as="table"
t-call="pos_self_order.qr_code"
/>
</div>
</div>
</t>
</div>
</t>
</template>
<template id="qr_code">
<t t-set="qr_code_size" t-value="180"/>
<div style="padding: 0px 40px; margin-bottom:40px; page-break-inside: avoid;">
<!-- This page-break-inside does not seem to work;
It would be nice to have the qr codes so the title is never on
a different page then the qr code itself -->
<h4 class="fw-bold text-center"
style="margin-top: 20px"
t-if="table['id']"
>
Table: <t t-esc="table['name']"/>
</h4>
<div class="p-3">
<div class="mt-1 mb-4 position-relative top-0 start-0">
<img t-att-src="'/report/barcode/QR/%s?width=%s&amp;height=%s&amp;barLevel=H' %(table['url'], qr_code_size, qr_code_size)"
class="position-relative top-0 start-0"
/>
<t t-call="pos_self_order.first_letter_of_odoo_logo_svg"/>
</div>
</div>
</div>
</template>
<template id="first_letter_of_odoo_logo_svg">
<svg
class="position-absolute top-50 start-50"
style="-webkit-transform: translate(-50%, -50%);"
t-att-width="qr_code_size/4"
t-att-height="qr_code_size/4"
viewBox="0 0 120 120" fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g>
<rect width="120" height="120" rx="33" fill="white"/>
<g>
<path d="M60 110C87.6142 110 110 87.6142 110 60C110 32.3858 87.6142 10 60 10C32.3858 10 10 32.3858 10 60C10 87.6142 32.3858 110 60 110Z" fill="#9C5789"/>
<path d="M59.5166 89.6961C75.8029 89.6961 89.0055 76.4935 89.0055 60.2072C89.0055 43.9209 75.8029 30.7182 59.5166 30.7182C43.2303 30.7182 30.0276 43.9209 30.0276 60.2072C30.0276 76.4935 43.2303 89.6961 59.5166 89.6961Z" fill="white"/>
</g>
</g>
</svg>
</template>
</odoo>