Debian Codegraph @

addons/sale/report/ir_actions_report_templates.xml

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <odoo>
3 <template id="report_saleorder_document">
4 <t t-call="web.external_layout">
5 <t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)" />
6 <t t-set="forced_vat" t-value="doc.fiscal_position_id.foreign_vat"/> <!-- So that it appears in the footer of the report instead of the company VAT if it's set -->
7 <t t-set="address">
8 <div t-field="doc.partner_id" class="mb-0"
9 t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
10 <p t-if="doc.partner_id.vat" class="mb-0">
11 <t t-if="doc.company_id.account_fiscal_country_id.vat_label" t-out="doc.company_id.account_fiscal_country_id.vat_label"/>
12 <t t-else="">Tax ID</t>: <span t-field="doc.partner_id.vat"/>
13 </p>
14 </t>
15 <t t-if="doc.partner_shipping_id == doc.partner_invoice_id
16 and doc.partner_invoice_id != doc.partner_id
17 or doc.partner_shipping_id != doc.partner_invoice_id">
18 <t t-set="information_block">
19 <strong>
20 <t t-if="doc.partner_shipping_id == doc.partner_invoice_id">
21 Invoicing and Shipping Address
22 </t>
23 <t t-else="">
24 Invoicing Address
25 </t>
26 </strong>
27 <div t-field="doc.partner_invoice_id"
28 t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
29 <t t-if="doc.partner_shipping_id != doc.partner_invoice_id">
30 <strong class="d-block mt-3">Shipping Address</strong>
31 <div t-field="doc.partner_shipping_id"
32 t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
33 </t>
34 </t>
35 </t>
36 <div class="page">
37 <div class="oe_structure"/>
38
39 <t t-set="is_proforma" t-value="env.context.get('proforma', False) or is_pro_forma"/>
40 <t t-set="layout_document_title">
41 <span t-if="is_proforma">Pro-Forma Invoice # </span>
42 <span t-elif="doc.state in ['draft','sent']">Quotation # </span>
43 <span t-else="">Order # </span>
44 <span t-field="doc.name">SO0000</span>
45 </t>
46
47 <div class="row mb-4" id="informations">
48 <div t-if="doc.client_order_ref" class="col" name="informations_reference">
49 <strong>Your Reference</strong>
50 <div t-field="doc.client_order_ref">SO0000</div>
51 </div>
52 <div t-if="doc.date_order" class="col" name="informations_date">
53 <strong t-if="is_proforma">Issued Date</strong>
54 <strong t-elif="doc.state in ['draft', 'sent']">Quotation Date</strong>
55 <strong t-else="">Order Date</strong>
56 <div t-field="doc.date_order" t-options='{"widget": "date"}'>2023-12-31</div>
57 </div>
58 <div t-if="doc.validity_date and doc.state in ['draft', 'sent']"
59 class="col"
60 name="expiration_date">
61 <strong>Expiration</strong>
62 <div t-field="doc.validity_date">2023-12-31</div>
63 </div>
64 <div t-if="doc.commitment_date" class="col" name="delivery_date">
65 <strong>Delivery Date</strong>
66 <div
67 t-field="doc.commitment_date"
68 t-options="{'widget': 'date'}"
69 >
70 2023-12-31
71 </div>
72 </div>
73 <div t-if="doc.user_id.name" class="col">
74 <strong>Salesperson</strong>
75 <div t-field="doc.user_id">Mitchell Admin</div>
76 </div>
77 </div>
78
79 <!-- Is there a discount on at least one line? -->
80 <t t-set="lines_to_report" t-value="doc._get_order_lines_to_report()"/>
81 <t t-set="display_discount" t-value="any(l.discount for l in lines_to_report)"/>
82 <!-- Hide taxes AND show taxed amounts on lines -->
83 <t t-set="hide_taxes_details" t-value="False"/>
84 <t t-set="display_taxes" t-value="not hide_taxes_details and any(l._has_taxes() for l in lines_to_report)"/>
85
86 <div class="oe_structure"></div>
87 <table class="o_has_total_table table o_main_table table-borderless">
88 <!-- In case we want to repeat the header, remove "display: table-row-group" -->
89 <thead style="display: table-row-group">
90 <tr>
91 <th name="th_description" class="text-start">Description</th>
92 <th name="th_quantity" class="text-end text-nowrap">Quantity</th>
93 <th name="th_priceunit" class="text-end text-nowrap">Unit Price</th>
94 <th name="th_discount" t-if="display_discount" class="text-end">
95 <span>Disc.%</span>
96 </th>
97 <th name="th_taxes" t-if="display_taxes" class="text-end">
98 <span>Taxes</span>
99 </th>
100 <th name="th_subtotal" class="text-end">
101 <span>Amount</span>
102 </th>
103 </tr>
104 </thead>
105 <tbody class="sale_tbody">
106
107 <t t-set="current_section" t-value="None"/>
108 <t t-set="current_subsection" t-value="None"/>
109 <t t-set="price_field" t-value="'price_total' if hide_taxes_details else 'price_subtotal'"/>
110
111 <t t-foreach="lines_to_report" t-as="line">
112
113 <t t-set="is_note" t-value="line.display_type == 'line_note'"/>
114 <t t-set="is_section" t-value="line.display_type == 'line_section'"/>
115 <t t-set="is_subsection" t-value="line.display_type == 'line_subsection'"/>
116 <t t-set="is_combo" t-value="line.product_type == 'combo'"/>
117
118 <t t-if="is_section">
119 <t t-set="current_section" t-value="line"/>
120 <t t-set="current_subsection" t-value="None"/>
121 <t t-set="line_padding" t-value="0"/>
122 <t t-set="collapse_prices" t-value="line.collapse_prices"/>
123 </t>
124 <t t-elif="is_subsection">
125 <t t-set="current_subsection" t-value="line"/>
126 <t t-set="line_padding" t-value="2"/>
127 <t t-set="collapse_prices" t-value="collapse_prices or line.collapse_prices"/>
128 </t>
129 <t t-else="">
130 <t
131 t-set="line_padding"
132 t-value="3 if current_subsection else (2 if current_section else 0)"
133 />
134 </t>
135
136 <t t-if="line.combo_item_id">
137 <t t-set="line_padding" t-value="line_padding + 1"/>
138 </t>
139
140 <t t-set="padding_class" t-value="line_padding and ('px-' + str(line_padding)) or ''"/>
141
142 <t t-if="not line.collapse_composition">
143 <tr
144 t-if="is_section or is_subsection"
145 name="tr_section"
146 t-att-class="'fw-bolder o_line_section' if is_section else 'fw-bold o_line_subsection'"
147 >
148 <t t-set="show_section_total" t-value="is_section or not line.parent_id.collapse_prices"/>
149 <t
150 t-set="section_name_colspan"
151 t-value="3 + (1 if display_discount else 0) + (1 if display_taxes else 0)"
152 />
153 <t t-if="not show_section_total">
154 <t t-set="section_name_colspan" t-value="99"/>
155 </t>
156 <td
157 name="td_section_name"
158 t-att-colspan="section_name_colspan"
159 t-att-class="padding_class"
160 >
161 <span t-field="line.name">A section title</span>
162 </td>
163 <td t-if="show_section_total" name="td_section_price" class="text-end o_price_total">
164 <span
165 name="price_subtotal_section"
166 t-out="line._get_section_totals(price_field)"
167 class="text-nowrap"
168 t-options="{'widget': 'monetary', 'display_currency': doc.currency_id}"
169 >
170 27.00
171 </span>
172 </td>
173 </tr>
174 <tr t-elif="is_note" name="tr_note" class="fst-italic o_line_note">
175 <td
176 name="td_note_name"
177 colspan="99"
178 t-att-class="padding_class"
179 >
180 <span t-field="line.name">A note, whose content usually applies to the section or product above.</span>
181 </td>
182 </tr>
183 <tr t-elif="is_combo" name="tr_combo" class="fw-bold o_line_subsection">
184 <td
185 name="td_combo_name"
186 t-att-colspan="3 + (1 if display_discount else 0) + (1 if display_taxes else 0)"
187 t-att-class="padding_class"
188 >
189 <span t-field="line.name">Combo Product</span>
190 x <span t-field="line.product_uom_qty" t-options="{'widget': 'integer'}"/>
191 </td>
192 <td name="td_combo_price" class="text-end o_price_total">
193 <span
194 t-if="not collapse_prices"
195 name="price_subtotal_combo"
196 t-out="line._get_combo_totals(price_field)"
197 class="text-nowrap"
198 t-options="{'widget': 'monetary', 'display_currency': doc.currency_id}"
199 >
200 27.00
201 </span>
202 </td>
203 </tr>
204 <tr t-else="" name="tr_product">
205 <td
206 name="td_product_name"
207 t-att-class="padding_class"
208 >
209 <span t-field="line.name">Bacon Burger</span>
210 </td>
211 <td name="td_product_quantity" class="o_td_quantity text-end">
212 <span t-field="line.product_uom_qty" class="text-nowrap">3</span>
213 <span t-field="line.product_uom_id">units</span>
214 <span t-if="line.product_uom_id != line.product_id.uom_id" class="text-muted small">
215 <t t-set="quantity_in_product_uom" t-value="line.product_uom_id._compute_quantity(line.product_uom_qty, line.product_id.uom_id)"/>
216 <br/><span t-esc="quantity_in_product_uom" t-options="{'widget': 'float', 'decimal_precision': 'Product Unit'}"/> <span t-field="line.product_id.uom_id"/>
217 </span>
218 </td>
219 <td name="td_product_priceunit" class="text-end text-nowrap">
220 <span
221 t-if="not collapse_prices"
222 t-field="line.price_unit"
223 >
224 25.00
225 </span>
226 </td>
227 <td t-if="display_discount" name="td_product_discount" class="text-end">
228 <t t-if="not collapse_prices">
229 <!-- ! Always check collapse_prices separately; keep discount condition below for XPath -->
230 <span t-field="line.discount">-</span>
231 </t>
232 </td>
233 <t t-set="taxes" t-value="', '.join(tax.tax_label for tax in line.tax_ids if tax.tax_label)"/>
234 <td t-if="display_taxes" name="td_product_taxes" t-attf-class="text-end {{ 'text-nowrap' if len(taxes) &lt; 10 else '' }}">
235 <span t-out="taxes">Tax 15%</span>
236 </td>
237 <td t-if="not line.is_downpayment" name="td_product_subtotal" class="text-end o_price_total">
238 <t t-if="not collapse_prices">
239 <span
240 t-if="price_field == 'price_subtotal'"
241 t-field="line.price_subtotal"
242 >
243 27.00
244 </span>
245 <span t-else="" t-field="line.price_total">
246 27.00
247 </span>
248 </t>
249 </td>
250 </tr>
251 </t>
252 <t t-else="">
253 <!-- Displaying the section inner content, grouped by taxes -->
254 <tr
255 t-foreach="line._get_grouped_section_summary(display_taxes)"
256 t-as="section_line"
257 name="tr_section_group"
258 class="o_line_section"
259 >
260 <td name="td_section_group_name" t-att-class="padding_class">
261 <span t-field="line.name">
262 Section Summary
263 </span>
264 </td>
265 <td name="td_section_group_quantity" class="text-end text-nowrap">
266 <span>1.00 Units</span>
267 </td>
268 <td name="td_section_group_priceunit" class="text-end text-nowrap">
269 <span
270 name="price_subtotal_section_grouped"
271 t-out="section_line['price_subtotal']"
272 t-options="{'widget': 'monetary', 'display_currency': doc.currency_id}"
273 >
274 25.00
275 </span>
276 </td>
277 <td t-if="display_discount" name="td_section_group_discount">
278 <!-- NOTE: not computed atm, but at least provides the API for it if needed in the future -->
279 <t t-set="aggregated_discount" t-value="section_line.get('discount', 0)"/>
280 <span t-if="aggregated_discount" t-out="aggregated_discount">-</span>
281 </td>
282 <td
283 t-if="display_taxes"
284 name="td_section_group_taxes"
285 t-attf-class="text-end {{ 'text-nowrap' if len(section_line['tax_labels']) &lt; 10 else '' }}"
286 >
287 <span t-out="', '.join(section_line['tax_labels'])">
288 Tax 15%
289 </span>
290 </td>
291 <td name="td_section_group_total" class="text-end o_price_total">
292 <span
293 t-out="section_line[price_field]"
294 t-options="{'widget': 'monetary', 'display_currency': doc.currency_id}"
295 >
296 30.00
297 </span>
298 </td>
299 </tr>
300 </t>
301 </t>
302 </tbody>
303 </table>
304 <div class="clearfix" name="so_total_summary">
305 <div id="total" class="row mt-n3" name="total">
306 <div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ms-auto">
307 <table class="o_total_table table table-borderless">
308 <!-- Tax totals -->
309 <t t-call="sale.document_tax_totals">
310 <t t-set="tax_totals" t-value="doc.tax_totals"/>
311 <t t-set="currency" t-value="doc.currency_id"/>
312 </t>
313 </table>
314 </div>
315 </div>
316 </div>
317 <div class="oe_structure"></div>
318
319 <div t-if="not doc.signature" class="oe_structure"></div>
320 <div t-else="" class="mt-4 ml64 mr4" name="signature">
321 <div class="offset-8">
322 <strong>Signature</strong>
323 </div>
324 <div class="offset-8">
325 <img t-att-src="image_data_uri(doc.signature)" style="max-height: 4cm; max-width: 8cm;"/>
326 </div>
327 <div class="offset-8 text-center">
328 <span t-field="doc.signed_by">Oscar Morgan</span>
329 </div>
330 </div>
331 <div>
332 <span t-field="doc.note" t-attf-style="#{'text-align:justify;text-justify:inter-word;' if doc.company_id.terms_type != 'html' else ''}" name="order_note"/>
333 <p t-if="not is_html_empty(doc.payment_term_id.note)">
334 <span t-field="doc.payment_term_id.note">The payment should also be transmitted with love</span>
335 </p>
336 <div class="oe_structure"/>
337 <p t-if="doc.fiscal_position_id and not is_html_empty(doc.fiscal_position_id.sudo().note)"
338 id="fiscal_position_remark">
339 <strong>Fiscal Position Remark:</strong>
340 <span t-field="doc.fiscal_position_id.sudo().note">No further requirements for this payment</span>
341 </p>
342 </div>
343 <div class="oe_structure"/>
344 <t t-set="base_address" t-value="doc.env['ir.config_parameter'].sudo().get_param('web.base.url')"/>
345 <t t-set="portal_url" t-value="base_address + '/my/orders/' + str(doc.id) + '#portal_connect_software_modal_btn'"/>
346 <div t-if="any(u._is_portal() for u in doc.partner_id.user_ids) and doc._get_edi_builders()" class="text-center">
347 <a t-att-href="portal_url">Connect your software</a> with <t t-out="doc.company_id.name"/> to create quotes automatically.
348 </div>
349 </div>
350 </t>
351 </template>
352
353 <template id="report_saleorder_raw">
354 <t t-call="web.html_container">
355 <t t-foreach="docs" t-as="doc">
356 <t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
357 </t>
358 </t>
359 </template>
360
361 <template id="report_saleorder">
362 <t t-call="sale.report_saleorder_raw"/>
363 </template>
364
365 <template id="report_saleorder_pro_forma">
366 <t t-call="web.html_container">
367 <t t-set="is_pro_forma" t-value="True"/>
368 <t t-set="docs" t-value="docs.with_context(proforma=True)"/>
369 <t t-foreach="docs" t-as="doc">
370 <t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>
371 </t>
372 </t>
373 </template>
374
375 <!-- Allow edits (e.g. studio) without changing the often inherited base template -->
376 <template id="document_tax_totals" inherit_id="account.document_tax_totals_template" primary="True"></template>
377
378 <template id="quote_document_layout_preview">
379 <t t-call="web.html_preview_container">
380 <t t-call="sale.report_saleorder_document"/>
381 </t>
382 </template>
383
384 </odoo>