summaryrefslogtreecommitdiff
path: root/addons/mrp/report/mrp_production_templates.xml
blob: 650123b8e359b42a719919b7d227127ef5d912a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_mrporder">
    <t t-call="web.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="web.internal_layout">
                <div class="page">
                    <div class="oe_structure"/>
                    <div class="row">
                        <div class="col-7">
                            <h2><span t-field="o.name"/></h2>
                        </div>
                        <div class="col-5">
                            <span class="text-right">
                                <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', o.name, 600, 100)" style="width:350px;height:60px"/>
                            </span>
                        </div>
                    </div>
                    <div class="row mt32 mb32">
                        <div class="col-3" t-if="o.origin">
                            <strong>Source Document:</strong><br/>
                            <span t-field="o.origin"/>
                        </div>
                        <div class="col-3">
                            <strong>Responsible:</strong><br/>
                            <span t-field="o.user_id"/>
                        </div>
                    </div>

                    <div class="row mt32 mb32">
                        <div class="col-3">
                            <strong>Finished Product:</strong><br/>
                            <span t-field="o.product_id"/>
                        </div>
                        <div class="col-3" t-if="o.product_description_variants">
                            <strong>Description:</strong><br/>
                            <span t-field="o.product_description_variants"/>
                        </div>
                        <div class="col-3">
                            <strong>Quantity to Produce:</strong><br/>
                            <span t-field="o.product_qty"/>
                            <span t-field="o.product_uom_id.name" groups="uom.group_uom"/>
                        </div>
                    </div>

                    <div t-if="o.workorder_ids">
                        <h3>
                            <span t-if="o.state == 'done'">Operations Done</span>
                            <span t-else="">Operations Planned</span>
                        </h3>
                        <table class="table table-sm">
                            <tr>
                                <th><strong>Operation</strong></th>
                                <th><strong>WorkCenter</strong></th>
                                <th><strong>No. Of Minutes</strong></th>
                            </tr>
                            <tr t-foreach="o.workorder_ids" t-as="line2">
                                <td><span t-field="line2.name"/></td>
                                <td><span t-field="line2.workcenter_id.name"/></td>
                                <td>
                                    <span t-if="o.state != 'done'" t-field="line2.duration_expected"/>
                                    <span t-if="o.state == 'done'" t-field="line2.duration"/>
                                </td>
                            </tr>
                        </table>
                    </div>

                    <h3 t-if="o.move_raw_ids">
                        <span t-if="o.state == 'done'">
                            Consumed Products
                        </span>
                        <span t-else="">
                            Products to Consume
                        </span>
                    </h3>

                    <table class="table table-sm" t-if="o.move_raw_ids">
                        <t t-set="has_product_barcode" t-value="any(m.product_id.barcode for m in o.move_raw_ids)"/>
                        <thead>
                            <tr>
                                <th>Product</th>
                                <th t-attf-class="{{ 'text-right' if not has_product_barcode else '' }}">Quantity</th>
                                <th t-if="has_product_barcode" width="15%" class="text-center">Barcode</th>
                            </tr>
                        </thead>
                        <tbody>
                            <t t-if="o.move_raw_ids">
                                <tr t-foreach="o.move_raw_ids" t-as="raw_line">
                                    <td>
                                        <span t-field="raw_line.product_id"/>
                                    </td>
                                    <td t-attf-class="{{ 'text-right' if not has_product_barcode else '' }}">
                                        <span t-field="raw_line.product_uom_qty"/>
                                        <span t-field="raw_line.product_uom" groups="uom.group_uom"/>
                                    </td>
                                    <td t-if="has_product_barcode" width="15%" class="text-center">
                                        <t t-if="raw_line.product_id.barcode">
                                            <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', raw_line.product_id.barcode, 600, 100)" style="width:100%;height:35px" alt="Barcode"/>
                                        </t>
                                    </td>
                                </tr>
                            </t>
                        </tbody>
                    </table>
                    <div class="oe_structure"/>
                </div>
            </t>
        </t>
    </t>
</template>

<template id="label_production_view_pdf">
    <t t-call="web.basic_layout">
        <div class="page">
            <t t-set="uom_categ_unit" t-value="env.ref('uom.product_uom_categ_unit')"/>
            <t t-foreach="docs" t-as="production">
                <t t-foreach="production.move_finished_ids" t-as="move">
                    <t t-if="production.state == 'done'">
                        <t t-set="move_lines" t-value="move.move_line_ids.filtered(lambda x: x.state == 'done' and x.qty_done)"/>
                    </t>
                    <t t-else="">
                        <t t-set="move_lines" t-value="move.move_line_ids.filtered(lambda x: x.state != 'done' and x.product_qty)"/>
                    </t>
                    <t t-foreach="move_lines" t-as="move_line">
                        <t t-if="move_line.product_uom_id.category_id == uom_categ_unit">
                            <t t-set="qty" t-value="int(move_line.qty_done)"/>
                        </t>
                        <t t-else="">
                            <t t-set="qty" t-value="1"/>
                        </t>
                        <t t-foreach="range(qty)" t-as="item">
                            <t t-translation="off">
                                <div style="display: inline-table; height: 10rem; width: 32%;">
                                    <table class="table table-bordered" style="border: 2px solid black;" t-if="production.move_finished_ids">
                                        <tr>
                                            <th class="table-active text-left" style="height:4rem;">
                                                <span t-esc="move.product_id.display_name"/>
                                                <br/>
                                                <span>Quantity:</span>
                                                <t t-if="move_line.product_uom_id.category_id == uom_categ_unit">
                                                    <span>1.0</span>
                                                    <span t-field="move_line.product_uom_id" groups="uom.group_uom"/>
                                                </t>
                                                <t t-else="">
                                                    <span t-esc="move_line.product_uom_qty" t-if="move_line.state !='done'"/>
                                                    <span t-esc="move_line.qty_done"  t-if="move_line.state =='done'"/>
                                                    <span t-field="move_line.product_uom_id" groups="uom.group_uom"/>
                                                </t>
                                            </th>
                                        </tr>
                                        <t t-if="move_line.product_id.tracking != 'none'">
                                            <tr>
                                                <td class="text-center align-middle">
                                                    <t t-if="move_line.lot_name or move_line.lot_id">
                                                        <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move_line.lot_name or move_line.lot_id.name, 600, 150)" style="width:100%;height:4rem" alt="Barcode"/>
                                                        <span t-esc="move_line.lot_name or move_line.lot_id.name"/>
                                                    </t>
                                                    <t t-else="">
                                                        <span class="text-muted">No barcode available</span>
                                                    </t>
                                                </td>
                                            </tr>
                                        </t>
                                        <t t-if="move_line.product_id.tracking == 'none'">
                                            <tr>
                                                <td class="text-center align-middle" style="height: 6rem;">
                                                    <t t-if="move_line.product_id.barcode">
                                                            <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', move_line.product_id.barcode, 600, 150)" style="width:100%;height:4rem" alt="Barcode"/>
                                                            <span t-esc="move_line.product_id.barcode"/>
                                                    </t>
                                                    <t t-else="">
                                                        <span class="text-muted">No barcode available</span>
                                                    </t>
                                                </td>
                                            </tr>
                                        </t>
                                    </table>
                                </div>
                            </t>
                        </t>
                    </t>
                </t>
            </t>
        </div>
    </t>
</template>

<template id="production_message">
    <t t-if="move.move_id.raw_material_production_id">
        <t t-set="message">Consumed</t>
    </t>
    <t t-if="move.move_id.production_id">
        <t t-set="message">Produced</t>
    </t>
    <strong><t t-esc="message"/> quantity has been updated.</strong>
</template>

<template id="track_production_move_template">
    <div>
        <t t-call="mrp.production_message"/>
        <t t-call="stock.message_body"/>
    </div>
</template>
</odoo>