Skip to content

Commit 6fa6b75

Browse files
tfrancoirobinkeunen
authored andcommitted
[ADD] beesdoo_product: Add label pdf
- Horizontal version - Vertical Version
1 parent fa7306c commit 6fa6b75

2 files changed

Lines changed: 145 additions & 0 deletions

File tree

beesdoo_product/__manifest__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"views/sale_views.xml",
3535
"views/assets.xml",
3636
"views/res_config_settings.xml",
37+
"report/label.xml",
3738
"wizard/views/adapt_sales_price_wizard_view.xml",
3839
"wizard/views/label_printing_utils.xml",
3940
"security/ir.model.access.csv",

beesdoo_product/report/label.xml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<odoo>
2+
<report id="report_product_label" string="Etiquettes H" model="product.template"
3+
report_type="qweb-pdf" file="beesdoo_product.product_label"
4+
name="beesdoo_product.product_label"/>
5+
6+
<template id="product_label">
7+
<t t-call="web.basic_layout">
8+
<div class="page">
9+
<t t-foreach="docs" t-as="template">
10+
<t t-foreach="template.product_variant_ids" t-as="product">
11+
<t t-call="beesdoo_product.report_simple_label">
12+
<t t-set="product" t-value="product"/>
13+
</t>
14+
</t>
15+
</t>
16+
</div>
17+
</t>
18+
</template>
19+
20+
<template id="report_simple_label">
21+
<div style="width: 80%; display: inline-table;height:12rem;" >
22+
<table class="table table-bordered mb-0" style="border: 2px solid black;">
23+
<tr>
24+
<th class="table-active text-left" colspan="2">
25+
<strong t-field="product.display_name"/>
26+
</th>
27+
</tr>
28+
<tr>
29+
<td style="border: 2px solid black;" >
30+
<strong style="font-size:1.5em" t-field="product.total_with_vat" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}"/>
31+
<span style="margin-left:30px">
32+
<t t-esc="round(product.display_weight, 3)"/>
33+
<t t-esc="product.display_unit.name"/>
34+
</span>
35+
<span style="margin-left:30px">
36+
<span t-field="product.total_with_vat_by_unit" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}"/>
37+
/
38+
<t t-esc="product.default_reference_unit.name"/>
39+
</span>
40+
<div t-if="product.main_seller_id or product.total_deposit &gt; 0" style="margin-top:10px;">
41+
<i t-if="product.main_seller_id" class="fa fa-user" aria-hidden="true">
42+
<strong t-esc="product.main_seller_id.name"/>
43+
</i>
44+
<span t-if="product.total_deposit &gt; 0" style="margin-left:15px">
45+
Cons.: <span t-field="product.total_deposit" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}" />
46+
</span>
47+
</div>
48+
</td>
49+
<td t-if="product.eco_label or product.local_label or product.fair_label or product.origin_label">
50+
<div t-if="product.eco_label">
51+
<i class="fa fa-leaf" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.eco_label.color_code"/>
52+
<strong t-esc="product.eco_label.name"/>
53+
</div>
54+
<div t-if="product.local_label">
55+
<i class="fa fa-map-marker" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.local_label.color_code"/>
56+
<strong t-esc="product.local_label.name"/>
57+
</div>
58+
<div t-if="product.fair_label">
59+
<i class="fa fa-balance-scale" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.fair_label.color_code"/>
60+
<strong t-esc="product.fair_label.name"/>
61+
</div>
62+
<div t-if="product.origin_label">
63+
<i class="fa fa-globe" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.origin_label.color_code"/>
64+
<strong t-esc="product.origin_label.name"/>
65+
</div>
66+
</td>
67+
</tr>
68+
</table>
69+
</div>
70+
</template>
71+
72+
<report id="report_product_label_v" string="Etiquette V" model="product.template"
73+
report_type="qweb-pdf" file="beesdoo_product.product_label_v"
74+
name="beesdoo_product.product_label_v"/>
75+
76+
<template id="product_label_v">
77+
<t t-call="web.basic_layout">
78+
<div class="page">
79+
<t t-foreach="docs" t-as="template">
80+
<t t-foreach="template.product_variant_ids" t-as="product">
81+
<t t-call="beesdoo_product.report_simple_label_v">
82+
<t t-set="product" t-value="product"/>
83+
</t>
84+
</t>
85+
</t>
86+
</div>
87+
</t>
88+
</template>
89+
90+
<template id="report_simple_label_v">
91+
<div style="width: 40%; display: inline-table;height:12rem;margin-right:20px">
92+
<table class="table table-bordered mb-0" style="border: 2px solid black;">
93+
<tr>
94+
<th class="table-active text-left">
95+
<strong t-field="product.display_name"/>
96+
</th>
97+
</tr>
98+
<tr>
99+
<td>
100+
<strong style="font-size:1.5em" t-field="product.total_with_vat" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}"/>
101+
<br />
102+
<span style="margin-left:30px">
103+
<t t-esc="round(product.display_weight, 3)"/>
104+
<t t-esc="product.display_unit.name"/>
105+
</span>
106+
<span style="margin-left:30px">
107+
<span t-field="product.total_with_vat_by_unit" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}"/>
108+
/
109+
<t t-esc="product.default_reference_unit.name"/>
110+
</span>
111+
<div t-if="product.total_deposit &gt; 0" style="margin-left:30px">
112+
Cons.: <span t-field="product.total_deposit" t-options="{'widget': 'monetary', 'display_currency': product.company_id.currency_id}" />
113+
</div>
114+
<div t-if="product.main_seller_id" style="margin-top:10px;">
115+
<i class="fa fa-user" aria-hidden="true">
116+
<strong t-esc="product.main_seller_id.name"/>
117+
</i>
118+
</div>
119+
</td>
120+
</tr>
121+
<tr t-if="product.eco_label or product.local_label or product.fair_label or product.origin_label">
122+
<td>
123+
<div t-if="product.eco_label">
124+
<i class="fa fa-leaf" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.eco_label.color_code"/>
125+
<strong t-esc="product.eco_label.name"/>
126+
</div>
127+
<div t-if="product.local_label">
128+
<i class="fa fa-map-marker" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.local_label.color_code"/>
129+
<strong t-esc="product.local_label.name"/>
130+
</div>
131+
<div t-if="product.fair_label">
132+
<i class="fa fa-balance-scale" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.fair_label.color_code"/>
133+
<strong t-esc="product.fair_label.name"/>
134+
</div>
135+
<div t-if="product.origin_label">
136+
<i class="fa fa-globe" aria-hidden="true" t-att-style="'color:%s;width:18px' % product.origin_label.color_code"/>
137+
<strong t-esc="product.origin_label.name"/>
138+
</div>
139+
</td>
140+
</tr>
141+
</table>
142+
</div>
143+
</template>
144+
</odoo>

0 commit comments

Comments
 (0)