Debian Codegraph @

addons/sale/views/sale_portal_templates.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3
4 <template id="portal_my_home_menu_sale" name="Portal layout : sales menu entries" inherit_id="portal.portal_breadcrumbs" priority="20">
5 <xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
6 <li id="portal_breadcrumbs_sale" t-if="page_name == 'quote' or sale_order and sale_order.state in ('sent', 'cancel')" t-attf-class="breadcrumb-item #{'active ' if not sale_order else ''}">
7 <a t-if="sale_order" t-attf-href="/my/quotes?{{ keep_query() }}">Quotations</a>
8 <t t-else="">Quotations</t>
9 </li>
10 <li t-elif="page_name == 'order' or sale_order and sale_order.state not in ('sent', 'cancel')" t-attf-class="breadcrumb-item #{'active ' if not sale_order else ''}">
11 <a t-if="sale_order" t-attf-href="/my/orders?{{ keep_query() }}">Sales Orders</a>
12 <t t-else="">Sales Orders</t>
13 </li>
14 <li t-if="sale_order" class="breadcrumb-item active">
15 <span t-field="sale_order.type_name"/>
16 <t t-out="sale_order.name"/>
17 </li>
18 </xpath>
19 </template>
20
21 <template id="portal_my_home_sale" name="Quotations / Sales Orders" customize_show="True" inherit_id="portal.portal_my_home" priority="20">
22 <xpath expr="//div[hasclass('o_portal_docs')]" position="before">
23 <t t-set="portal_client_category_enable" t-value="True"/>
24 <t t-set="portal_alert_category_enable" t-value="True"/>
25 </xpath>
26 <div id="portal_alert_category" position="inside">
27 <t t-call="portal.portal_docs_entry">
28 <t t-set="bg_color" t-value="'alert alert-primary align-items-center'"/>
29 <t t-set="placeholder_count" t-value="'quotation_count'"/>
30 <t t-set="title">Quotations to review</t>
31 <t t-set="url" t-value="'/my/quotes'"/>
32 <t t-set="show_count" t-value="True"/>
33 </t>
34 </div>
35 <div id="portal_client_category" position="inside">
36 <t t-call="portal.portal_docs_entry">
37 <t t-set="icon" t-value="'/sale/static/src/img/bag.svg'"/>
38 <t t-set="title">Your Orders</t>
39 <t t-set="url" t-value="'/my/orders'"/>
40 <t t-set="text">Follow, view or pay your orders</t>
41 <t t-set="placeholder_count" t-value="'order_count'"/>
42 </t>
43 </div>
44 </template>
45
46 <template id="portal_my_quotations" name="My Quotations">
47 <t t-call="portal.portal_layout">
48 <t t-set="breadcrumbs_searchbar" t-value="True"/>
49
50 <t t-call="portal.portal_searchbar">
51 <t t-set="title">Quotations</t>
52 </t>
53 <div t-if="not quotations" class="alert alert-warning" role="alert">
54 There are currently no quotations for your account.
55 </div>
56 <t t-if="quotations" t-call="portal.portal_table">
57 <thead>
58 <tr class="active">
59 <th>Quotation #</th>
60 <th class="text-end">Quotation Date</th>
61 <th class="text-end">Valid Until</th>
62 <th class="text-center"/>
63 <th class="text-end">Total</th>
64 </tr>
65 </thead>
66 <t t-foreach="quotations" t-as="quotation">
67 <tr>
68 <td><a t-att-href="quotation.get_portal_url()"><t t-out="quotation.name"/></a></td>
69 <td class="text-end"><span t-field="quotation.date_order"/></td>
70 <td class="text-end"><span t-field="quotation.validity_date"/></td>
71 <td class="text-center">
72 <span t-if="quotation.state == 'cancel'" class="badge rounded-pill text-bg-danger">
73 <i class="fa fa-fw fa-remove"/> Cancelled</span>
74 <span t-if="quotation.is_expired" class="badge rounded-pill text-bg-danger">
75 <i class="fa fa-fw fa-clock-o"/> Expired</span>
76 </td>
77 <td class="text-end">
78 <span t-field="quotation.amount_total"/>
79 </td>
80 </tr>
81 </t>
82 </t>
83 </t>
84 </template>
85
86 <template id="portal_my_orders" name="My Sales Orders">
87 <t t-call="portal.portal_layout">
88 <t t-set="breadcrumbs_searchbar" t-value="True"/>
89
90 <t t-call="portal.portal_searchbar">
91 <t t-set="title">Your Orders</t>
92 </t>
93 <div t-if="not orders" class="alert alert-warning" role="alert">
94 There are currently no sales orders for your account.
95 </div>
96 <t t-if="orders" t-call="portal.portal_table">
97 <thead>
98 <tr class="active">
99 <th>
100 <span class='d-none d-md-inline'>Sales Order #</span>
101 <span class='d-block d-md-none'>Ref.</span>
102 </th>
103 <th class="text-end">Order Date</th>
104 <th name="order_total" class="text-end">Total</th>
105 </tr>
106 </thead>
107 <t t-foreach="orders" t-as="order">
108 <tr>
109 <td><a t-att-href="order.get_portal_url()"><t t-out="order.name"/></a></td>
110 <td class="text-end">
111 <span t-field="order.date_order" t-options="{'widget': 'date'}"/>&amp;nbsp;
112 <span class='d-none d-md-inline' t-field="order.date_order" t-options="{'time_only': True}"/>
113 </td>
114 <td name="order_amount_total" class="text-end">
115 <span t-field="order.amount_total"/>
116 </td>
117 </tr>
118 </t>
119 </t>
120 </t>
121 </template>
122
123 <!-- Complete page of the sale_order -->
124 <template id="sale_order_portal_template" name="Sales Order" inherit_id="portal.portal_sidebar" primary="True">
125 <t t-call="portal.portal_layout" position="inside">
126 <t t-set="o_portal_fullwidth_alert" groups="sales_team.group_sale_salesman">
127 <!-- Uses backend_url provided in rendering values -->
128 <t t-call="portal.portal_back_in_edit_mode"/>
129 </t>
130 </t>
131
132 <xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
133 <div
134 class="row o_portal_sale_sidebar"
135 t-att-data-order-amount-total="sale_order.amount_total"
136 >
137 <!-- Sidebar -->
138 <t t-call="portal.portal_record_sidebar">
139 <t t-set="classes" t-value="'col-lg-4 col-xxl-3 d-print-none'"/>
140 <t t-set="title">
141 <t t-if="sale_order._has_to_be_paid() and sale_order.prepayment_percent != 1.0">
142 <h4>Down payment</h4>
143 <h2>
144 <t
145 t-out="sale_order._get_prepayment_required_amount()"
146 t-options="{
147 'widget': 'monetary',
148 'display_currency': sale_order.currency_id,
149 }"
150 />
151 (<t t-out="sale_order.prepayment_percent * 100"/>%)
152 </h2>
153 </t>
154 <h2 t-else="" t-field="sale_order.amount_total" class="mb-0 text-break"/>
155 </t>
156 <t t-set="entries">
157 <div
158 t-if="0 &lt; sale_order.amount_paid &lt; sale_order.amount_total
159 and sale_order.state != 'cancel'"
160 class="alert alert-success mt-3"
161 role="alert"
162 >
163 Amount paid:
164 <span
165 t-field="sale_order.amount_paid"
166 t-options="{
167 'widget': 'monetary',
168 'display_currency': sale_order.currency_id,
169 }"
170 />
171 </div>
172
173 <div class="d-flex flex-column gap-4 mt-3">
174 <div class="d-flex flex-column gap-2" id="sale_order_sidebar_button">
175 <a
176 t-if="sale_order._has_to_be_signed() and not payment_amount"
177 role="button"
178 class="btn btn-primary"
179 data-bs-toggle="modal"
180 data-bs-target="#modalaccept"
181 href="#"
182 > <!-- If paying by link, signing is skipped. -->
183 <i class="fa fa-check"/>
184 <t t-if="sale_order._has_to_be_paid()"> Sign &amp; Pay</t>
185 <t t-else=""> Accept &amp; Sign</t>
186 </a>
187 <a
188 t-elif="sale_order._has_to_be_paid()
189 or (
190 payment_amount
191 and sale_order.amount_paid &lt; sale_order.amount_total
192 and sale_order.state != 'cancel'
193 )"
194 id="o_sale_portal_paynow"
195 role="button"
196 data-bs-toggle="modal"
197 data-bs-target="#modalaccept"
198 href="#"
199 t-att-class="'btn btn-primary' if not sale_order.transaction_ids else 'btn btn-light'"
200 >
201 <i class="fa fa-check"/>
202 <t t-if="not sale_order.signature
203 and sale_order._has_to_be_paid()
204 and not payment_amount"> Accept &amp; Pay</t>
205 <t t-else=""> Pay Now</t>
206 </a>
207 <div
208 id="print_invoice_sidebar_button"
209 class="o_download_pdf d-flex gap-2 flex-lg-column flex-xl-row flex-wrap"
210 >
211 <a class="btn btn-light o_print_btn o_portal_invoice_print flex-grow-1" t-att-href="sale_order.get_portal_url(report_type='pdf')" id="print_invoice_report" title="View Details" role="button" target="_blank"><i class="fa fa-print me-1"/>View Details</a>
212 </div>
213 </div>
214
215 <div class="navspy flex-grow-1 ps-0" t-ignore="true" role="complementary">
216 <ul class="nav flex-column bs-sidenav"></ul>
217 </div>
218
219 <t t-if="not sale_order.is_expired and sale_order.state in ['draft', 'sent']">
220 <div t-if="sale_order.amount_undiscounted - sale_order.amount_untaxed &gt; 0.01" class="list-group-item flex-grow-1" name="sale_order_advantage">
221 <small><b class="text-muted">Your advantage</b></small>
222 <small>
223 <b t-field="sale_order.amount_undiscounted"
224 t-options='{"widget": "monetary", "display_currency": sale_order.currency_id}'
225 style="text-decoration: line-through"
226 class="d-block mt-1"
227 data-id="amount_undiscounted" />
228 </small>
229 <t t-if="sale_order.amount_untaxed == sale_order.amount_total">
230 <h4 t-field="sale_order.amount_total" class="text-success" data-id="total_amount"/>
231 </t>
232 <t t-else="">
233 <h4 t-field="sale_order.amount_untaxed" class="text-success mb-0" data-id="total_untaxed"/>
234 <small>(<span t-field="sale_order.amount_total" data-id="total_amount"/> Incl. tax)</small>
235 </t>
236 </div>
237 </t>
238
239 <div t-if="sale_order.user_id">
240 <h6><small class="text-muted">Your contact</small></h6>
241 <t t-call="portal.portal_my_contact">
242 <t t-set="_contactAvatar" t-value="image_data_uri(sale_order.user_id.avatar_128)"/>
243 <t t-set="_contactName" t-value="sale_order.user_id.name"/>
244 <t t-set="_contactLink" t-value="True"/>
245 </t>
246 </div>
247
248 <div t-if="sale_order._get_edi_builders()">
249 <button id="portal_connect_software_modal_btn" type="button" class="btn btn-primary"
250 data-bs-toggle="modal" data-bs-target="#sale_portal_connect_software_modal">
251 Connect with your software!
252 </button>
253 </div>
254 </div>
255 </t>
256 </t>
257
258 <div class="modal fade" id="sale_portal_connect_software_modal" tabindex="-1" role="dialog" aria-hidden="true">
259 <div class="modal-dialog modal-lg" role="document">
260 <div class="modal-content">
261 <div class="modal-body">
262 <div>
263 <h5>Want to import this document in Odoo?</h5>
264 <p>Drag and drop the request for quotation PDF file into your list of quotations in Odoo. Enjoy the automation!</p>
265 </div>
266 <div>
267 <h5>Not using Odoo?</h5>
268 <div class="input-group mb-3 w-50">
269 <t t-set="base_address" t-value="sale_order.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
270 <t t-set="doc_url" t-value="base_address + '/my/orders/' + str(sale_order.id) + '/download_edi?' + str(keep_query())"/>
271 <input type="text" class="form-control" aria-describedby="copy-button" readonly="readonly" t-att-value="doc_url"/>
272 <button class="btn btn-outline-secondary" type="button" id="copy-button"
273 t-attf-onclick="navigator.clipboard.writeText('#{doc_url}')">Copy</button>
274 </div>
275 <p>Use the above REST URL to get structured data of the purchase order in UBL format.
276 <a href="https://www.odoo.com/documentation/">Read the documentation </a>to learn all the ways to connect your software with <a href="https://www.odoo.com">Odoo</a>.
277 </p>
278 </div>
279 <div>
280 <h5>You don't use a good CRM software?</h5>
281 <p><a href="https://www.odoo.com/app/sales">Start on Odoo</a>, it's 100% free! You'll save time creating beautiful quotations and track sales.</p>
282 </div>
283 </div>
284 <div class="modal-footer justify-content-between">
285 <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
286 </div>
287 </div>
288 </div>
289 </div>
290
291 <!-- Page content -->
292 <div id="quote_content" class="col-12 col-lg-8 col-xxl-9 mt-5 mt-lg-0">
293
294 <!-- Modals container -->
295 <div role="dialog" class="modal fade" id="modalaccept" name="sale_order_modal_sign_and_pay">
296 <div
297 t-if="sale_order._has_to_be_signed() and not payment_amount"
298 class="modal-dialog"
299 ><t t-call="sale.sale_order_portal_sign_modal"/></div>
300 <div
301 t-elif="not sale_order._has_to_be_signed()
302 and sale_order._has_to_be_paid()
303 or (payment_amount and sale_order.state != 'cancel')"
304 name="sale_order_modal_validate"
305 class="modal-dialog"
306 ><t t-call="sale.sale_order_portal_pay_modal"/></div>
307 </div>
308
309 <!-- modal relative to the action reject -->
310 <div role="dialog" class="modal fade" id="modaldecline">
311 <div class="modal-dialog">
312 <form id="decline" method="POST" t-attf-action="/my/orders/#{sale_order.id}/decline?access_token=#{sale_order.access_token}" class="modal-content">
313 <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
314 <header class="modal-header">
315 <h4 class="modal-title">Reject This Quotation</h4>
316 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
317 </header>
318 <main class="modal-body">
319 <p>
320 Tell us why you are refusing this quotation, this will help us improve our services.
321 </p>
322 <textarea rows="4" name="decline_message" required="" placeholder="Your feedback..." class="form-control" />
323 </main>
324 <footer class="modal-footer">
325 <button type="submit" t-att-id="sale_order.id" class="btn btn-danger">
326 <i class="fa fa-times"></i> Reject
327 </button>
328 <button type="button" class="btn btn-primary" data-bs-dismiss="modal">
329 Cancel
330 </button>
331 </footer>
332 </form>
333 </div>
334 </div>
335
336 <!-- status messages -->
337 <div t-if="message == 'sign_ok'" class="alert alert-success alert-dismissible d-print-none" role="status">
338 <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
339 <strong>Thank You!</strong><br/>
340 <t t-if="message == 'sign_ok' and sale_order.state == 'sale'">
341 Your order has been confirmed.
342 </t>
343 <t t-elif="message == 'sign_ok' and sale_order._has_to_be_paid()">
344 Your order has been signed but still needs to be paid to be confirmed.
345 </t>
346 <t t-else="">Your order has been signed.</t>
347 </div>
348
349 <div t-if="message == 'cant_reject'" class="alert alert-danger alert-dismissible d-print-none" role="alert">
350 <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
351 Your order is not in a state to be rejected.
352 </div>
353
354 <t t-set="current_tx" t-value="sale_order.get_portal_last_transaction()"/>
355 <!-- hide state header when invoice is posted for current transaction. -->
356 <t t-if="current_tx and not (current_tx.state == 'done' and len(current_tx.invoice_ids) == 1 and current_tx.invoice_ids.state == 'posted')">
357 <t t-call="payment.state_header">
358 <t t-set="tx" t-value="current_tx"/>
359 </t>
360 </t>
361
362 <div t-if="sale_order.state == 'cancel'" class="alert alert-danger alert-dismissible d-print-none" role="alert">
363 <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"></button>
364 <strong>This quotation has been cancelled.</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get a new quotation.</a>
365 </div>
366
367 <div t-if="sale_order.is_expired" class="alert alert-warning alert-dismissible d-print-none" role="alert">
368 <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="close"></button>
369 <strong>This offer expired!</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get a new quotation.</a>
370 </div>
371
372 <!-- main content -->
373 <div t-attf-class="#{'pb-5' if report_type == 'html' else ''}" id="portal_sale_content">
374 <div><t t-call="#{sale_order._get_name_portal_content_view()}"/></div>
375 </div>
376
377 <!-- bottom actions -->
378 <div t-if="sale_order._has_to_be_signed() or sale_order._has_to_be_paid()" class="d-flex justify-content-center gap-1 d-print-none" name="sale_order_actions">
379
380 <t t-if="sale_order._has_to_be_signed()">
381 <div class="col-sm-auto mt8">
382 <a role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#modalaccept" href="#"><i class="fa fa-check"/><t t-if="sale_order._has_to_be_paid()"> Sign &amp; Pay</t><t t-else=""> Accept &amp; Sign</t></a>
383 </div>
384 <div class="col-sm-auto mt8">
385 <a role="button" class="btn btn-light" href="#discussion"><i class="fa fa-comment"/> Feedback</a>
386 </div>
387 <div class="col-sm-auto mt8">
388 <a role="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#modaldecline" href="#"> <i class="fa fa-times"/> Reject</a>
389 </div>
390 </t>
391 <div t-elif="sale_order._has_to_be_paid()" class="col-sm-auto mt8">
392 <a role="button" data-bs-toggle="modal" data-bs-target="#modalaccept" href="#" t-att-class="'%s' % ('btn btn-light' if sale_order.transaction_ids else 'btn btn-primary')">
393 <i class="fa fa-check"/> <t t-if="not sale_order.signature">Accept &amp; Pay</t><t t-else="">Pay Now</t>
394 </a>
395 </div>
396 </div>
397
398 <!-- chatter -->
399 <hr/>
400 <div id="sale_order_communication">
401 <h3>Communication history</h3>
402 <t t-call="portal.message_thread"/>
403 </div>
404 </div><!-- // #quote_content -->
405 </div>
406 </xpath>
407 </template>
408
409 <template id="sale_order_portal_sign_modal" name="Sales Order Portal Sign Modal">
410 <form
411 id="accept"
412 method="POST"
413 t-att-data-order-id="sale_order.id"
414 t-att-data-token="sale_order.access_token"
415 class="js_accept_json modal-content js_website_submit_form"
416 >
417 <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
418 <header class="modal-header">
419 <h4 class="modal-title">Validate Order</h4>
420 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"/>
421 </header>
422 <main class="modal-body" id="sign-dialog">
423 <span>
424 By signing, you confirm acceptance on behalf of
425 <b t-field="sale_order.partner_id.commercial_partner_id"/>
426 for the <b data-id="total_amount" t-field="sale_order.amount_total"/> quote.
427 </span>
428 <b t-if="sale_order.payment_term_id" t-field="sale_order.payment_term_id.note"/>
429 <t t-call="portal.signature_form">
430 <t t-set="call_url" t-value="sale_order.get_portal_url(suffix='/accept')"/>
431 <t
432 t-set="default_name"
433 t-value="sale_order.partner_id.name or sale_order.partner_id.commercial_partner_id.name"
434 />
435 </t>
436 </main>
437 </form>
438 </template>
439
440 <template id="sale_order_portal_pay_modal" name="Sales Order Portal Pay Modal">
441 <div class="modal-content">
442 <header class="modal-header">
443 <h4 class="modal-title">Pay Order</h4>
444 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"/>
445 </header>
446 <main class="modal-body" id="sign-dialog">
447 <t
448 t-set="prepayment_amount"
449 t-value="sale_order._get_prepayment_required_amount()"
450 />
451 <t
452 t-set="prepayment_available"
453 t-value="sale_order.prepayment_percent
454 and sale_order.prepayment_percent != 1.0"
455 />
456 <t
457 t-if="sale_order._has_to_be_paid() and prepayment_available"
458 t-call="sale.sale_order_portal_pay_modal_amount_selector"
459 />
460 <div t-if="sale_order._has_to_be_paid()" class="mb-3">
461 <!-- The widget associated with this modal will hide and show spans depending of the selected option. -->
462 <span t-if="prepayment_available">
463 <span id="o_sale_portal_use_amount_prepayment">
464 By paying a <u>down payment</u> of
465 <span
466 t-out="amount"
467 t-options="{
468 'widget': 'monetary',
469 'display_currency': sale_order.currency_id
470 }"
471 class="fw-bold"
472 />
473 <t t-if="sale_order._get_prepayment_required_amount() == amount">
474 (<b t-esc="sale_order.prepayment_percent * 100"/>%),
475 </t>
476 </span>
477 <span id="o_sale_portal_use_amount_total">By paying,</span>
478 </span>
479 <span t-else="">
480 By paying,
481 <span
482 t-out="amount"
483 t-options="{
484 'widget': 'monetary',
485 'display_currency': sale_order.currency_id,
486 }"
487 class="fw-bold"
488 />
489 </span>
490 you confirm acceptance on behalf of
491 <b t-field="sale_order.partner_id.commercial_partner_id"/>
492 for the <b data-id="total_amount" t-field="sale_order.amount_total"/> quote.
493 <b
494 t-if="sale_order.payment_term_id"
495 t-field="sale_order.payment_term_id.note"
496 class="o_sale_payment_terms"
497 />
498 </div>
499 <div t-if="payment_amount and not sale_order._has_to_be_paid()" class="mb-3">
500 Amount:
501 <span
502 t-out="payment_amount"
503 t-options="{
504 'widget': 'monetary',
505 'display_currency': sale_order.currency_id,
506 }"
507 class="fw-bold"
508 />
509 </div>
510 <div t-if="company_mismatch"><t t-call="payment.company_mismatch_warning"/></div>
511 <div
512 t-elif="not sale_order._has_to_be_paid() and not payment_amount"
513 class="alert alert-danger"
514 >
515 The order is not in a state requiring customer payment.
516 </div>
517 <div t-else="" id="payment_method" class="text-start mt-0" >
518 <!-- Inject the order ID to allow Stripe to check if tokenization is required. -->
519 <t t-call="payment.form" sale_order_id="sale_order.id"/>
520 </div>
521 </main>
522 </div>
523 </template>
524
525 <template
526 id="sale_order_portal_pay_modal_amount_selector"
527 name="Sales Order Portal Pay Modal Amounts Selector"
528 >
529 <div class="d-flex btn-group mb-3" role="group">
530 <button name="o_sale_portal_amount_prepayment_button" class="btn btn-light active">
531 Down payment <br/>
532 <span
533 t-if="not payment_amount or payment_amount == sale_order.amount_total"
534 t-out="prepayment_amount"
535 t-options="{
536 'widget': 'monetary',
537 'display_currency': sale_order.currency_id,
538 }"
539 class="fw-bold"
540 />
541 <span
542 t-else=""
543 t-out="payment_amount"
544 t-options="{
545 'widget': 'monetary',
546 'display_currency': sale_order.currency_id,
547 }"
548 class="fw-bold"
549 />
550 </button>
551 <button name="o_sale_portal_amount_total_button" class="btn btn-light">
552 Full amount <br/>
553 <span
554 t-out="sale_order.amount_total"
555 t-options="{
556 'widget': 'monetary',
557 'display_currency': sale_order.currency_id,
558 }"
559 class="fw-bold"
560 />
561 </button>
562 </div>
563 </template>
564
565 <!--
566 Sales Order content : intro, information, order lines, remarks, descriptions ....
567 This template should contain all the printable element of the SO. This is the
568 template rendered in PDF with the report engine.
569 -->
570 <template id="sale_order_portal_content" name="Sales Order Portal Content">
571 <!-- Intro -->
572 <div id="introduction" t-attf-class="#{'border-bottom-0 pt-0 pb-3' if report_type == 'html' else ''}">
573 <div class="d-flex gap-2" id="intro_row">
574 <h2>
575 <t t-out="sale_order.type_name"/> -
576 <em t-out="sale_order.name"/>
577 </h2>
578 </div>
579 </div>
580 <div id="content">
581 <div id="informations" class="row">
582 <span id="transaction_info">
583 <div t-if="sale_order.get_portal_last_transaction() and not invoices and sale_order.state in ('sent', 'sale') and portal_confirmation == 'pay' and not success and not error"
584 t-att-data-order-id="sale_order.id">
585 <t t-if="sale_order.transaction_ids">
586 <t t-call="payment.state_header">
587 <t t-set="tx" t-value="sale_order.get_portal_last_transaction()"/>
588 </t>
589 </t>
590 </div>
591 </span>
592 <!-- Information -->
593 <div id="sale_info" class="col-12 col-lg-6 mb-4">
594 <span id="sale_info_title">
595 <h5 class="mb-1">Sale Information</h5>
596 <hr class="mt-1 mb-2"/>
597 </span>
598 <table class="table table-borderless table-sm">
599 <tbody style="white-space:nowrap" id="sale_info_table">
600 <tr>
601 <th t-if="sale_order.state in ['sale', 'cancel']" class="ps-0 pb-0">Order Date:</th>
602 <th t-else="" class="ps-0 pb-0">Date:</th>
603 <td class="w-100 pb-0 text-wrap"><span t-field="sale_order.date_order" t-options='{"widget": "date"}'/></td>
604 </tr>
605 <tr t-if="sale_order.commitment_date and sale_order.state in ['sent', 'sale']">
606 <th class="ps-0 pb-0">Delivery Date:</th>
607 <td class="w-100 pb-0 text-wrap"><span t-field="sale_order.commitment_date" t-options='{"widget": "date"}'/></td>
608 </tr>
609 <tr t-if="sale_order.validity_date and sale_order.state in ['draft', 'sent']">
610 <th class="ps-0 pb-0">Expiration Date:</th>
611 <td class="w-100 pb-0 text-wrap"><span t-field="sale_order.validity_date" t-options='{"widget": "date"}'/></td>
612 </tr>
613 <tr t-if="sale_order.client_order_ref">
614 <th class="ps-0 pb-0">Your Reference:</th>
615 <td class="w-100 pb-0 text-wrap"><span t-field="sale_order.client_order_ref"/></td>
616 </tr>
617 <tr t-if="sale_order.commitment_date">
618 <th class="ps-0 pb-0">Delivery Date:</th>
619 <td class="w-100 pb-0 text-wrap">
620 <span
621 t-field="sale_order.commitment_date"
622 t-options="{'widget': 'date'}"
623 />
624 </td>
625 </tr>
626 </tbody>
627 </table>
628 </div>
629
630 <!-- ====== Customer Information ====== -->
631 <div id="customer_info" class="col-12 col-lg-6 mb-4">
632 <h5 class="mb-1">
633 <t t-if="sale_order.partner_shipping_id == sale_order.partner_invoice_id">
634 Invoicing and Shipping Address
635 </t>
636 <t t-else="">
637 Invoicing Address
638 </t>
639 <small t-if="sale_order.partner_id == sale_order.partner_invoice_id == sale_order.env.user.partner_id">
640 <a class="small" t-attf-href="/my/account?redirect={{sale_order.get_portal_url()}}">
641 <i class="fa fa-fw fa-pencil"/>
642 </a>
643 </small>
644 </h5>
645 <hr class="mt-1 mb-2"/>
646 <div t-field="sale_order.partner_invoice_id" t-options="{'widget': 'contact', 'fields': ['name', 'address', 'phone', 'email']}"/>
647 <span t-if="sale_order.partner_shipping_id != sale_order.partner_invoice_id"
648 id="shipping_address"
649 class="col-lg-6">
650 <br/>
651 <h5 class="mb-1">
652 Shipping Address
653 </h5>
654 <hr class="mt-1 mb-2"/>
655 <div t-field="sale_order.partner_shipping_id" t-options='{ "widget": "contact", "fields": [ "name", "address"]}'/>
656 </span>
657 </div>
658 <t t-set="invoices" t-value="sale_order.invoice_ids.filtered(lambda i: i.state not in ['draft', 'cancel']).sorted('date', reverse=True)[:3]"/>
659 <div id="sale_invoices" t-if="invoices and sale_order.state in ['sale', 'cancel']" class="col-12 col-lg-6 mb-4">
660 <h5 class="mb-1">Last Invoices</h5>
661 <hr class="mt-1 mb-2"/>
662 <t t-foreach="invoices" t-as="i">
663 <t t-set="report_url" t-value="i.get_portal_url()"/>
664 <t t-set="authorized_tx_ids" t-value="i.sudo().authorized_transaction_ids"/>
665 <div class="d-flex flex-column gap-2">
666 <div class="d-flex flex-column">
667 <div class="d-flex align-items-center justify-content-between">
668 <a t-att-href="report_url">
669 <span t-out="i.name"/>
670 </a>
671 <div t-if="i.payment_state in ('paid', 'in_payment')" class="small badge rounded-pill text-bg-success orders_label_text_align">
672 <i class="fa fa-fw fa-check"/> Paid
673 </div>
674 <div t-elif="i.payment_state == 'reversed'" class="small badge text-bg-success orders_label_text_align">
675 <i class="fa fa-fw fa-check"/> Reversed
676 </div>
677 <div t-elif="authorized_tx_ids" class="small badge rounded-pill text-bg-success orders_label_text_align">
678 <i class="fa fa-fw fa-check"/> Authorized
679 </div>
680 <div t-else="" class="small badge rounded-pill text-bg-info orders_label_text_align">
681 <i class="fa fa-fw fa-clock-o"/> Waiting Payment
682 </div>
683 </div>
684 <div class="small d-lg-inline-block">Date: <span class="text-muted" t-field="i.invoice_date"/></div>
685 </div>
686 </div>
687 </t>
688 </div>
689 </div>
690
691 <section id="details" style="page-break-inside: auto;">
692 <t t-if="product_documents">
693 <h4 id="details">Documents</h4>
694 <div class="d-flex flex-grow-1 flex-wrap gap-1 mb32">
695 <t t-foreach="product_documents" t-as="document_sudo">
696 <div class="bg-light p-2 rounded">
697 <div class="position-relative text-center">
698 <t t-set="attachment_sudo" t-value="document_sudo.ir_attachment_id"/>
699 <t t-set="target" t-value="attachment_sudo.type == 'url' and '_blank' or '_self'"/>
700 <a t-att-href="sale_order.get_portal_url('/document/' + str(document_sudo.id))" t-att-target="target" class="d-flex flex-row">
701 <div class="o_image"
702 t-att-title="attachment_sudo.name"
703 t-att-data-mimetype="attachment_sudo.mimetype"
704 t-attf-data-src="/web/image/#{attachment_sudo.id}/100x80?access_token=#{attachment_sudo.access_token}"/>
705 <div class="o_portal_product_document align-self-center" t-out="attachment_sudo.name"/>
706 </a>
707 </div>
708 </div>
709 </t>
710 </div>
711 </t>
712
713 <t t-set="lines_to_report" t-value="sale_order._get_order_lines_to_report()"/>
714 <t t-set="display_discount" t-value="any(line.discount > 0 for line in lines_to_report)"/>
715 <t t-set="hide_taxes_details" t-value="False"/>
716 <t t-set="display_taxes" t-value="not hide_taxes_details and any(line._has_taxes() for line in lines_to_report)"/>
717
718 <div name="sol_table" class="table-responsive">
719 <table t-att-data-order-id="sale_order.id" t-att-data-token="sale_order.access_token" class="table table-sm" id="sales_order_table">
720 <thead>
721 <tr>
722 <th class="text-start" id="product_name_header">Products</th>
723 <th class="text-end" id="product_qty_header">Quantity</th>
724 <th t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}" id="product_unit_price_header">
725 Unit Price
726 </th>
727 <th t-if="display_discount" t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}" id="product_discount_header">
728 <span>Disc.%</span>
729 </th>
730 <th t-if="display_taxes" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" id="taxes_header">
731 <span>Taxes</span>
732 </th>
733 <th class="text-end" id="subtotal_header">
734 <span>Amount</span>
735 </th>
736 </tr>
737 </thead>
738 <tbody class="sale_tbody">
739
740 <t t-set="current_section" t-value="None"/>
741 <t t-set="current_subsection" t-value="None"/>
742 <t t-set="price_field" t-value="'price_total' if hide_taxes_details else 'price_subtotal'"/>
743
744 <t t-foreach="lines_to_report" t-as="line">
745
746 <t t-set="is_note" t-value="line.display_type == 'line_note'"/>
747 <t t-set="is_section" t-value="line.display_type == 'line_section'"/>
748 <t t-set="is_subsection" t-value="line.display_type == 'line_subsection'"/>
749 <t t-set="is_combo" t-value="line.product_type == 'combo'"/>
750
751 <t t-if="is_section">
752 <t t-set="current_section" t-value="line"/>
753 <t t-set="current_subsection" t-value="None"/>
754 <t t-set="line_padding" t-value="0"/>
755 <t t-set="collapse_prices" t-value="line.collapse_prices"/>
756 </t>
757 <t t-elif="is_subsection">
758 <t t-set="current_subsection" t-value="line"/>
759 <t t-set="line_padding" t-value="2"/>
760 <t t-set="collapse_prices" t-value="current_section.collapse_prices or line.collapse_prices"/>
761 </t>
762 <t t-else="">
763 <t
764 t-set="line_padding"
765 t-value="3 if current_subsection else (2 if current_section else 0)"
766 />
767 </t>
768
769 <t t-if="line.combo_item_id">
770 <t t-set="line_padding" t-value="line_padding + 1"/>
771 </t>
772
773 <t t-set="padding_class" t-value="line_padding and ('px-' + str(line_padding)) or ''"/>
774
775 <t t-if="not line.collapse_composition">
776 <tr
777 t-if="is_section or is_subsection"
778 name="tr_section"
779 t-att-class="'fw-bolder o_line_section' if is_section else 'fw-bold o_line_subsection'"
780 >
781 <t t-set="show_section_total" t-value="is_section or not line.parent_id.collapse_prices"/>
782 <t
783 t-set="section_name_colspan"
784 t-value="3 + (1 if display_discount else 0) + (1 if display_taxes else 0)"
785 />
786 <t t-if="not show_section_total">
787 <t t-set="section_name_colspan" t-value="99"/>
788 </t>
789 <td
790 name="td_section_name"
791 t-att-colspan="section_name_colspan"
792 t-att-class="padding_class"
793 >
794 <span t-field="line.name"/>
795 </td>
796 <td
797 t-if="show_section_total"
798 name="td_section_price"
799 class="text-end o_price_total"
800 >
801 <span
802 name="price_subtotal_section"
803 t-out="line._get_section_totals(price_field)"
804 class="text-nowrap"
805 t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"
806 />
807 </td>
808 </tr>
809 <tr t-elif="is_note" name="tr_note" class="fst-italic o_line_note">
810 <td
811 name="td_note_name"
812 colspan="99"
813 t-att-class="padding_class"
814 >
815 <span t-field="line.name"/>
816 </td>
817 </tr>
818 <tr t-elif="is_combo" name="tr_combo" class="fw-bold o_line_subsection">
819 <td
820 name="td_combo_name"
821 t-att-class="padding_class"
822 >
823 <span t-field="line.name">Combo Product</span>
824 </td>
825 <td
826 name="td_combo_quantity"
827 class="text-end"
828 >
829 <div id="quote_qty">
830 <span t-field="line.product_uom_qty"/>
831 <span t-field="line.product_uom_id"/>
832 </div>
833 </td>
834 <td
835 name="td_combo_priceunit"
836 t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"
837 />
838 <td
839 t-if="display_discount"
840 name="td_combo_discount"
841 t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"
842 />
843 <td
844 t-if="display_taxes"
845 name="td_combo_taxes"
846 t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
847 />
848 <td name="td_combo_subtotal" class="text-end">
849 <span
850 t-if="not collapse_prices"
851 name="price_subtotal_combo"
852 t-out="line._get_combo_totals(price_field)"
853 class="text-nowrap"
854 t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"
855 >
856 27.00
857 </span>
858 </td>
859 </tr>
860 <tr t-else="" name="tr_product">
861 <td
862 name="td_product_name"
863 t-att-class="padding_class"
864 >
865 <span name="span_product_name" t-field="line.name"/>
866 </td>
867 <td name="td_product_quantity" class="text-end">
868 <div id="quote_qty">
869 <span t-field="line.product_uom_qty"/>
870 <span t-field="line.product_uom_id"/>
871 </div>
872 </td>
873 <td
874 name="td_product_priceunit"
875 t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}"
876 >
877 <t t-if="not collapse_prices">
878 <div
879 t-if="line.discount &gt;= 0"
880 t-field="line.price_unit"
881 t-att-style="line.discount and 'text-decoration: line-through' or None"
882 t-att-class="(line.discount and 'text-danger' or '') + ' text-end'"
883 t-options="{'widget': 'monetary', 'display_currency': line.currency_id}"
884 />
885 <div t-if="line.discount">
886 <t
887 t-out="(1-line.discount / 100.0) * line.price_unit"
888 t-options='{"widget": "float", "decimal_precision": "Product Price"}'
889 />
890 </div>
891 </t>
892 </td>
893 <td t-if="display_discount" name="td_product_discount" t-attf-class="text-end {{ 'd-none d-sm-table-cell' if report_type == 'html' else '' }}">
894 <t t-if="not collapse_prices">
895 <!-- ! Always check collapse_prices separately; keep discount condition below for XPath -->
896 <strong t-if="line.discount &gt; 0" class="text-info">
897 <t t-out="((line.discount % 1) and '%s' or '%d') % line.discount"/>%
898 </strong>
899 </t>
900 </td>
901 <td t-if="display_taxes" name="td_product_taxes" t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
902 <span t-out="', '.join(map(lambda x: (x.name), line.tax_ids))"/>
903 </td>
904 <td t-if="not line.is_downpayment" name="td_product_subtotal" class="text-end">
905 <t t-if="not collapse_prices">
906 <span
907 t-if="price_field == 'price_subtotal'"
908 t-field="line.price_subtotal"
909 />
910 <span t-else="" t-field="line.price_total"/>
911 </t>
912 </td>
913 </tr>
914 </t>
915 <t t-else="">
916 <!-- Displaying the section inner content, grouped by taxes -->
917 <tr
918 t-foreach="line._get_grouped_section_summary(display_taxes)"
919 t-as="section_line"
920 name="tr_section_group"
921 class="o_line_section"
922 >
923 <td name="td_section_group_name" t-att-class="padding_class">
924 <span t-field="line.name">
925 Section Summary
926 </span>
927 </td>
928 <td name="td_section_group_quantity" class="text-end text-nowrap">
929 <span>1.00 Units</span>
930 </td>
931 <td name="td_section_group_priceunit" class="text-end text-nowrap">
932 <span
933 t-out="section_line['price_subtotal']"
934 t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"
935 />
936 </td>
937 <td t-if="display_discount" name="td_section_group_discount"/>
938 <td
939 t-if="display_taxes"
940 name="td_section_group_taxes"
941 t-attf-class="text-end {{ 'text-nowrap' if len(section_line['tax_labels']) &lt; 10 else '' }}"
942 >
943 <span t-out="', '.join(section_line['tax_labels'])">
944 Tax 15%
945 </span>
946 </td>
947 <td name="td_section_group_total" class="text-end o_price_total">
948 <span
949 name="price_subtotal_section_grouped"
950 t-out="section_line[price_field]"
951 t-options="{'widget': 'monetary', 'display_currency': sale_order.currency_id}"
952 >
953 31.05
954 </span>
955 </td>
956 </tr>
957 </t>
958 </t>
959 </tbody>
960 </table>
961 </div>
962
963 <div id="total" name="total" style="page-break-inside: avoid;">
964 <div class="col-xs-7 col-md-5 ms-auto">
965 <t t-call="sale.sale_order_portal_content_totals_table"/>
966 </div>
967 </div>
968 </section>
969
970 <section t-if="sale_order.signature" id="signature" name="Signature">
971 <div class="row mt-4" name="signature">
972 <div t-attf-class="#{'col-3' if report_type != 'html' else 'col-sm-7 col-md-4'} ms-auto text-center">
973 <h5>Signature</h5>
974 <img t-att-src="image_data_uri(sale_order.signature)" style="max-height: 6rem; max-width: 100%;"/>
975 <p t-field="sale_order.signed_by"/>
976 </div>
977 </div>
978 </section>
979
980 <section t-if="not is_html_empty(sale_order.note)" id="terms" class="mt-4">
981 <h4 class="">Terms &amp; Conditions</h4>
982 <hr class="mt-0 mb-1"/>
983 <em t-field="sale_order.note"/>
984 </section>
985
986 <section t-if="sale_order.payment_term_id" class="mt-4">
987 <h4 class="">Payment terms</h4>
988 <hr class="mt-0 mb-1"/>
989 <span t-field="sale_order.payment_term_id.note"/>
990 </section>
991 </div>
992 </template>
993
994 <template id="sale_order_portal_content_totals_table">
995 <table class="table table-sm" name="sale_order_totals_table">
996 <t t-call="#{sale_order._get_name_tax_totals_view()}">
997 <t t-set="tax_totals" t-value="sale_order.tax_totals"/>
998 <t t-set="currency" t-value="sale_order.currency_id"/>
999 <!--
1000 NOTE: This variable should not be used in templates before version 19.1, as it might
1001 not be available in earlier versions if customer does not upgrade the `sale` module.
1002 -->
1003 <t t-set="doc" t-value="sale_order"/>
1004 </t>
1005 </table>
1006 </template>
1007 </odoo>