summaryrefslogtreecommitdiff
path: root/addons/stock/report/report_stock_forecasted.xml
blob: 61748f6c02028213fb19145ed86a09aea188cd11 (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
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Reports -->
    <record id="stock_replenishment_report_product_product_action" model="ir.actions.report">
        <field name="name">Forecasted Report</field>
        <field name="model">product.product</field>
        <field name="report_type">qweb-html</field>
        <field name="report_name">stock.report_product_product_replenishment</field>
    </record>

    <record id="stock_replenishment_report_product_template_action" model="ir.actions.report">
        <field name="name">Forecasted Report</field>
        <field name="model">product.template</field>
        <field name="report_type">qweb-html</field>
        <field name="report_name">stock.report_product_template_replenishment</field>
    </record>

    <record id="stock_replenishment_product_product_action" model="ir.actions.client">
        <field name="name">Forecasted Report</field>
        <field name="tag">replenish_report</field>
    </record>

<!-- Templates -->
    <template id="assets_common_replenishment_report" name="Forecasted Inventory CSS" inherit_id="web.report_assets_common">
        <xpath expr="." position="inside">
            <link rel="stylesheet" type="text/scss" href="/web/static/src/scss/graph_view.scss"/>
            <link rel="stylesheet" type="text/scss" href="/stock/static/src/scss/report_stock_forecasted.scss"/>
        </xpath>
    </template>

    <template id="report_replenishment_header">
        <div class="d-flex justify-content-between">
            <div class="o_product_name">
                <h3>
                    <t t-if="docs['product_templates']">
                        <t t-foreach="docs['product_templates']" t-as="product_template">
                            <a href="#" res-model="product.template" view-type="form" t-att-res-id="product_template.id">
                                <t t-esc="product_template.display_name"/>
                            </a>
                        </t>
                    </t>
                    <t t-elif="docs['product_variants']">
                        <t t-foreach="docs['product_variants']" t-as="product_variant">
                            <a href="#" res-model="product.product" view-type="form" t-att-res-id="product_variant.id">
                                <t t-esc="product_variant.display_name"/>
                            </a>
                        </t>
                    </t>
                </h3>
                <h6 t-if="docs['product_templates'] and docs['product_variants'] and len(docs['product_templates']) != len(docs['product_variants'])">
                    <t t-foreach="docs['product_variants']" t-as="product_variant">
                        <a href="#" res-model="product.product" view-type="form" t-att-res-id="product_variant.id">
                            <t t-esc="'[%s]' % product_variant.product_template_attribute_value_ids._get_combination_name()"/>
                        </a>
                    </t>
                </h6>
            </div>
            <div class="row">
                <div class="mx-3 text-center">
                    <div class="h3">
                        <t t-esc="docs['quantity_on_hand']"/>
                        <t t-esc="docs['uom']" groups="uom.group_uom"/>
                    </div>
                    <div>On Hand</div>
                </div>
                <div t-attf-class="mx-3 text-center #{docs['virtual_available'] &lt; 0 and 'text-danger'}">
                    <div class="h3">
                        <t t-esc="docs['virtual_available']"/>
                        <t t-esc="docs['uom']" groups="uom.group_uom"/>
                    </div>
                    <div>Forecasted</div>
                </div>
                <div name="pending_forecasted" t-attf-class="mx-3 text-center #{future_virtual_available &lt; 0 and 'text-danger'}">
                    <div class="h3">
                        <t t-esc="future_virtual_available"/>
                        <t t-esc="docs['uom']" groups="uom.group_uom"/>
                    </div>
                    <div>Forecasted<br/>+ Pending</div>
                </div>
            </div>
        </div>
    </template>

    <template id="report_product_product_replenishment">
        <t t-call="web.html_container">
            <div class="page pt-3 o_report_replenishment_page">
                <t t-set="future_virtual_available" t-value="docs['virtual_available'] + docs['qty']['in'] - docs['qty']['out']"/>
                <t t-call="stock.report_replenishment_header"/>
                <div class="o_report_graph"/>
                <table class="o_report_replenishment table table-bordered">
                    <thead>
                        <tr class="bg-light">
                            <td>Replenishment</td>
                            <td>Expected Receipt</td>
                            <td t-if="docs['multiple_product']">Product</td>
                            <td class="text-right">Quantity</td>
                            <td groups="uom.group_uom">UoM</td>
                            <td>Used by</td>
                            <td>Expected Delivery</td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr t-if="docs['lines'] and not any(line['document_in'] or line['replenishment_filled'] for line in docs['lines'])">
                            <td>Inventory On Hand</td>
                            <td/>
                            <td t-if="docs['multiple_product']"/>
                            <td class="text-right">0</td>
                            <td/>
                            <td/>
                            <td/>
                            <td/>
                        </tr>
                        <tr t-foreach="docs['lines']" t-as="line">
                            <td t-attf-class="#{line['is_late'] and 'o_grid_warning'}">
                                <a t-if="line['document_in']"
                                    t-attf-href="#" t-esc="line['document_in'].name"
                                    class="font-weight-bold" view-type="form"
                                    t-att-res-model="line['document_in']._name"
                                    t-att-res-id="line['document_in'].id"/>
                                <t t-elif="line['reservation']">
                                    Reserved from stock
                                </t>
                                <t t-elif="line['replenishment_filled']">
                                    <t t-if="line['document_out']">Inventory On Hand</t>
                                    <t t-else="">Free Stock</t>
                                </t>
                                <span t-else="" class="text-muted">Not Available</span>
                            </td>
                            <td t-esc="line['receipt_date'] or ''"
                                t-attf-class="#{line['is_late'] and 'o_grid_warning'}"/>
                            <td t-if="docs['multiple_product']" t-esc="line['product']['display_name']"/>
                            <td class="text-right"><t t-if="not line['replenishment_filled']">- </t><t t-esc="line['quantity']"/></td>
                            <td t-esc="line['uom_id'].name" groups="uom.group_uom"/>
                            <td t-attf-class="#{not line['replenishment_filled'] and 'o_grid_warning'}">
                                <a t-if="line['document_out']"
                                    t-attf-href="#" t-esc="line['document_out'].name"
                                    class="font-weight-bold" view-type="form"
                                    t-att-res-model="line['document_out']._name"
                                    t-att-res-id="line['document_out'].id"/>
                            </td>
                            <td t-esc="line['delivery_date'] or ''"
                                t-attf-class="#{not line['replenishment_filled'] and 'o_grid_warning'}"/>
                        </tr>
                    </tbody>
                    <thead>
                        <tr class="o_forecasted_row">
                            <td colspan="2">Forecasted Inventory</td>
                            <td t-esc="docs['virtual_available']" class="text-right"/>
                            <td t-esc="docs['uom']" groups="uom.group_uom"/>
                        </tr>
                    </thead>
                    <tbody t-if="docs['qty']['in']">
                        <tr t-if="docs['draft_picking_qty']['in']" name="draft_picking_in">
                            <td colspan="2">Incoming Draft Transfer</td>
                            <td t-esc="docs['draft_picking_qty']['in']" class="text-right"/>
                            <td t-esc="docs['uom']" groups="uom.group_uom"/>
                        </tr>
                        <tr t-if="docs['draft_picking_qty']['out']" name="draft_picking_out">
                            <td colspan="2">Outgoing Draft Transfer</td>
                            <td t-esc="-docs['draft_picking_qty']['out']" class="text-right"/>
                            <td t-esc="docs['uom']" groups="uom.group_uom"/>
                        </tr>
                    </tbody>
                    <thead>
                        <tr class="o_forecasted_row">
                            <td colspan="2">Forecasted with Pending</td>
                            <td t-esc="future_virtual_available" class="text-right"/>
                            <td t-esc="docs['uom']" groups="uom.group_uom"/>
                        </tr>
                    </thead>
                </table>
            </div>
        </t>
    </template>

    <template id="report_product_template_replenishment">
        <t t-call="stock.report_product_product_replenishment"/>
    </template>
</odoo>