11 changed files with 270 additions and 169 deletions
@ -1,95 +1,133 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<template id="top_selling_reports"> |
|||
<t t-call="web.html_container"> |
|||
<t t-call="top_selling_product_report.internal_layout"> |
|||
<div class="page"> |
|||
<div class="oe_structure"/> |
|||
<center> |
|||
<t t-if="other['least']"> |
|||
<h2 style="font-size:35px;"><b>Least Selling Products</b></h2> |
|||
</t> |
|||
<t t-if="not other['least']"> |
|||
<h2 style="font-size:35px;"><b>Top Selling Products</b></h2> |
|||
</t> |
|||
</center> |
|||
<div class="oe_structure"/> |
|||
<br /> |
|||
<span> |
|||
<t t-if="other['range']"> |
|||
<b>Top Product of :</b> <t t-esc="other['range']"/><br /> |
|||
</t> |
|||
<t t-if="other['date_selected_from']"> |
|||
<b>Top Product of :</b> <t t-esc="other['date_selected_from']"/> To <t t-esc="other['date_selected_to']"/><br /> |
|||
</t> |
|||
<t t-if="other['limit']"> |
|||
<b>Product Range :</b> <t t-esc="other['limit']"/> Products<br /> |
|||
</t> |
|||
</span> |
|||
</div> |
|||
<br /> |
|||
<table class="table table-bordered" style="border: 1px solid #000;"> |
|||
<tbody> |
|||
<tr> |
|||
<th style="text-align: center;color: #000;text-color: #000;">Product</th> |
|||
<th style="text-align: center;color: #000;text-color: #000;">Sold Quantity</th> |
|||
<th style="text-align: center;color: #000;text-color: #000;">UoM</th> |
|||
</tr> |
|||
<tr t-foreach="data" t-as="value"> |
|||
<td style="height:5px;color: #000;text-color: #000"><t t-esc="value['product_name']"/></td> |
|||
<td style="height:5px;text-align: center;color: #000;text-color: #000;"><t t-esc="value['sum']"/></td> |
|||
<td style="height:5x;text-align: center;color: #000;text-color: #000;"><t t-esc="value['name']"/></td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
<template id="internal_layout"> |
|||
<t t-if="not o and doc"> |
|||
<t t-set="o" t-value="doc"/> |
|||
</t> |
|||
|
|||
<t t-if="o and 'company_id' in o"> |
|||
<t t-set="company" t-value="o.company_id.sudo()"/> |
|||
</t> |
|||
<t t-if="not o or not 'company_id' in o"> |
|||
<t t-set="company" t-value="res_company"/> |
|||
</t> |
|||
<div class="header o_boxed_header"> |
|||
<div class="row mb8"> |
|||
<div class="col-xs-6"> |
|||
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" alt="Logo"/> |
|||
</div> |
|||
<div class="col-xs-6 text-right mb4"> |
|||
<h4 class="mt0" t-field="company.report_header"/> |
|||
<div name="company_address" class="mb4"> |
|||
<span style="color: #000;font-color:#000000;" class="company_address" t-field="company.partner_id" |
|||
<!-- Template for Top Selling Products Report --> |
|||
<template id="top_selling_reports"> |
|||
<t t-call="web.html_container"> |
|||
<!-- The "top_selling_product_report.internal_layout" template is used as the main layout for the report --> |
|||
<t t-call="top_selling_product_report.internal_layout"> |
|||
<div class="page"> |
|||
<div class="oe_structure"/> |
|||
<center> |
|||
<!-- Display report title based on whether it shows top-selling or least selling products --> |
|||
<t t-if="other['least']"> |
|||
<h2 style="font-size:35px;"> |
|||
<b>Least Selling Products</b> |
|||
</h2> |
|||
</t> |
|||
<t t-if="not other['least']"> |
|||
<h2 style="font-size:35px;"> |
|||
<b>Top Selling Products</b> |
|||
</h2> |
|||
</t> |
|||
</center> |
|||
<div class="oe_structure"/> |
|||
<br /> |
|||
<span> |
|||
<!-- Display the date range or selected period for the report --> |
|||
<t t-if="other['range']"> |
|||
<b>Top Product of :</b> |
|||
<t t-esc="other['range']"/> |
|||
<br /> |
|||
</t> |
|||
<t t-if="other['date_selected_from']"> |
|||
<b>Top Product of :</b> |
|||
<t t-esc="other['date_selected_from']"/> To |
|||
<t t-esc="other['date_selected_to']"/> |
|||
<br /> |
|||
</t> |
|||
<!-- Display the number of products to show in the report --> |
|||
<t t-if="other['limit']"> |
|||
<b>Product Range :</b> |
|||
<t t-esc="other['limit']"/> Products |
|||
<br /> |
|||
</t> |
|||
</span> |
|||
</div> |
|||
<br /> |
|||
<!-- Display the table containing the top-selling products data --> |
|||
<table class="table table-bordered" style="border: 1px solid #000;"> |
|||
<tbody> |
|||
<tr> |
|||
<th style="text-align: center;color: #000;text-color: #000;">Product</th> |
|||
<th style="text-align: center;color: #000;text-color: #000;">Sold Quantity</th> |
|||
<th style="text-align: center;color: #000;text-color: #000;">UoM</th> |
|||
</tr> |
|||
<!-- Loop through the data to display product information --> |
|||
<tr t-foreach="data" t-as="value"> |
|||
<td style="height:5px;color: #000;text-color: #000"> |
|||
<t t-esc="value['product_name']"/> |
|||
</td> |
|||
<td style="height:5px;text-align: center;color: #000;text-color: #000;"> |
|||
<t t-esc="value['sold_quantity']"/> |
|||
</td> |
|||
<td style="height:5x;text-align: center;color: #000;text-color: #000;"> |
|||
<t t-esc="value['uom']"/> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
<!-- Template for the Internal Layout of the Report --> |
|||
<template id="internal_layout"> |
|||
<t t-if="not o and doc"> |
|||
<t t-set="o" t-value="doc"/></t> |
|||
<!-- Set the company variable based on the document's company_id if available --> |
|||
<t t-if="o and 'company_id' in o"> |
|||
<t t-set="company" t-value="o.company_id.sudo()"/></t> |
|||
<!-- If company_id is not available, use the default company from "res_company" --> |
|||
<t t-if="not o or not 'company_id' in o"> |
|||
<t t-set="company" t-value="res_company"/></t> |
|||
<!-- Header section of the report layout --> |
|||
<div class="header o_boxed_header"> |
|||
<div class="row mb8"> |
|||
<div class="col-xs-6"> |
|||
<!-- Display the company logo if available --> |
|||
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" alt="Logo"/> |
|||
</div> |
|||
<div class="col-xs-6 text-right mb4"> |
|||
<!-- Display the company name and address --> |
|||
<h4 class="mt0" t-field="company.report_header"/> |
|||
<div name="company_address" class="mb4"> |
|||
<span style="color: #000;font-color:#000000;" class="company_address" t-field="company.partner_id" |
|||
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}'/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div style="border-bottom: 1px solid black;"/> |
|||
</div> |
|||
<div class="article o_report_layout_background"> |
|||
<t t-raw="0" /> |
|||
</div> |
|||
<div class="footer"> |
|||
<div class="text-center" style="border-top: 1px solid black;"> |
|||
<ul class="list-inline mb4"> |
|||
<li t-if="company.phone">Phone: <span t-field="company.phone"/></li> |
|||
<li t-if="company.email">Email: <span t-field="company.email"/></li> |
|||
<li t-if="company.website">Web: <span t-field="company.website"/></li> |
|||
<li t-if="company.vat"><t t-esc="company.country_id.vat_label or 'TIN'"/>: <span t-field="company.vat"/></li> |
|||
</ul> |
|||
<div name="financial_infos"> |
|||
<span t-field="company.report_footer"/> |
|||
</div> |
|||
<div class="text-muted"> |
|||
Page: <span class="page"/> / <span class="topage"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
</odoo> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div style="border-bottom: 1px solid black;"/></div> |
|||
<div class="article o_report_layout_background"> |
|||
<t t-raw="0" /> |
|||
</div> |
|||
<div class="footer"> |
|||
<div class="text-center" style="border-top: 1px solid black;"> |
|||
<ul class="list-inline mb4"> |
|||
<!-- Display company contact information --> |
|||
<li t-if="company.phone">Phone: |
|||
<span t-field="company.phone"/> |
|||
</li> |
|||
<li t-if="company.email">Email: |
|||
<span t-field="company.email"/> |
|||
</li> |
|||
<li t-if="company.website">Web: |
|||
<span t-field="company.website"/> |
|||
</li> |
|||
<li t-if="company.vat"> |
|||
<t t-esc="company.country_id.vat_label or 'TIN'"/>: |
|||
<span t-field="company.vat"/> |
|||
</li> |
|||
</ul> |
|||
<div name="financial_infos"> |
|||
<!-- Display additional financial information if available --> |
|||
<span t-field="company.report_footer"/> |
|||
</div> |
|||
<div class="text-muted"> |
|||
<!-- Display the current page and total pages of the report --> |
|||
Page: |
|||
<span class="page"/> / |
|||
<span class="topage"/> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
</odoo> |
|||
|
|
Loading…
Reference in new issue