Skip to content

Commit

Permalink
[IMP] mrp_production_report: Change barcode with qr_code
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis committed Jan 24, 2025
1 parent cae4baa commit c48dfdd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 8 deletions.
6 changes: 5 additions & 1 deletion mrp_production_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"author": "AvanzOSC,",
"license": "AGPL-3",
"summary": "BoM notes",
"depends": ["mrp", "mrp_workorder_sequence"],
"depends": [
"mrp",
"mrp_workorder_sequence",
"mrp_workorder_qr_code",
],
"data": ["report/mrp_production_report.xml"],
"installable": True,
}
40 changes: 33 additions & 7 deletions mrp_production_report/report/mrp_production_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,52 @@
<xpath expr="//table/tr[1]/th[1]" position="before">
<th width="15%" class="text-center"><strong>Sequence</strong></th>
</xpath>
<!-- Añadir qr en cada línea -->
<xpath expr="//table/tr[2]/td[1]" position="before">
<td width="15%" class="text-center">
<span t-field="line2.sequence" />
<div
t-field="line2.sequence"
t-options="{'widget': 'barcode', 'width': 600, 'height': 100, 'img_style': 'width:100%;height:35px'}"
<t t-set="qr_code" t-value="line2._create_qr_code(line2.sequence)" />
<img
t-att-src="'data:image/png;base64,' + qr_code"
width="100px"
height="100px"
/>
</td>
</xpath>
<!-- Añadir QR del nombre -->
<xpath expr="//span[@t-field='o.name']/../.." position="after">
<t t-set="qr_code" t-value="o._create_qr_code(o.name)" />
<div style="position: absolute; top: -1px; left: 700px;">
<img
t-att-src="'data:image/png;base64,' + qr_code"
width="100px"
height="100px"
/>
</div>
</xpath>
<!-- Quitar código de barras -->
<xpath expr="//div[@t-field='o.name']/.." position="attributes">
<attribute name="t-if">False</attribute>
</xpath>
</template>

<template
id="report_mrp_production_components"
inherit_id="mrp.report_mrp_production_components"
>
<th t-if="o.state in ('progress', 'to_close','done')" position="replace" />
<xpath expr="//tbody//td[2]" position="replace" />
<th t-if="o.state in ('progress', 'to_close','done')" position="attributes">
<attribute name="t-if">False</attribute>
</th>
<xpath expr="//tbody//td[2]" position="attributes">
<attribute name="t-if">False</attribute>
</xpath>
<th t-if="has_product_barcode" position="before">
<th t-if="o.state in ('progress', 'confirmed')">Reserved</th>
<th t-if="o.state == 'done'">done</th>
</th>
<th t-if="has_product_barcode" position="replace" />
<th t-if="has_product_barcode" position="attributes">
<attribute name="t-if">False</attribute>
</th>
<td t-if="has_product_barcode" position="before">
<td
t-if="o.state in ('confirmed','progress')"
Expand All @@ -92,7 +116,9 @@
<span t-field="raw_line.product_uom" groups="uom.group_uom" />
</td>
</td>
<td t-if="has_product_barcode" position="replace" />
<td t-if="has_product_barcode" position="attributes">
<attribute name="t-if">False</attribute>
</td>

<span t-field="raw_line.product_id" position="after">
<t t-foreach="raw_line.move_line_ids" t-as="move_line">
Expand Down

0 comments on commit c48dfdd

Please sign in to comment.