summaryrefslogtreecommitdiff
path: root/addons/stock/report/report_stock_rule.xml
blob: 21cd39aefa3b02a92b06e80cf7f4aa16db7e2a7a (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
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
    <template id="assets_common" name="report_stock_rule assets" inherit_id="web.report_assets_common">
        <xpath expr="." position="inside">
            <link rel="stylesheet" type="text/scss" href="/stock/static/src/scss/report_stock_rule.scss"/>
        </xpath>
    </template>

    <template id="report_stock_rule">
        <t t-set="data_report_landscape" t-value="True"/>
        <t t-set="full_width" t-value="True"/>
        <t t-call="web.html_container">
            <t t-foreach="docs" t-as="o">
                <div class="article o_report_stock_rule">
                    <div class="page">
                        <h2 t-field="o.name"/>

                        <table class="table table-condensed table-bordered">
                            <thead>
                                <tr>
                                    <t t-foreach="locations" t-as="location">
                                        <th class="o_report_stock_rule_location_header">
                                            <div t-att-res-id="location.id" t-att-res-model="location._name" view-type="form">
                                                <t t-esc="location.display_name"/>
                                            </div>
                                            <t t-if="header_lines.get(location.id)">
                                                <t t-foreach="header_lines[location.id]['putaway']" t-as="lines">
                                                    <t t-foreach="lines" t-as="line">
                                                        <div class="o_report_stock_rule_putaway" t-att-res-id="location.id" t-att-res-model="location._name" view-type="form">
                                                            <p>Putaway: <t t-esc="line.location_out_id.display_name"/></p>
                                                        </div>
                                                    </t>
                                                </t>
                                                <t t-foreach="header_lines[location.id]['orderpoint']" t-as="lines">
                                                    <t t-foreach="lines" t-as="line">
                                                        <div class="o_report_stock_rule_putaway" t-att-res-id="line.id" t-att-res-model="line._name" view-type="form">
                                                            <p>[<t t-esc="line.display_name"/>]<br/>min: <t t-esc="line.product_min_qty"/>, max:<t t-esc="line.product_max_qty"/></p>
                                                        </div>
                                                    </t>
                                                </t>
                                            </t>
                                        </th>
                                    </t>
                                </tr>
                            </thead>
                            <tbody>
                                <t t-foreach="route_lines" t-as="route_line">
                                    <tr>
                                        <t t-set="acc" t-value="0"/>
                                        <t t-foreach="route_line" t-as="rule">
                                            <t t-if="rule">
                                                <t t-if="rule[0]._name == 'stock.rule'">
                                                    <t t-set="color" t-value="rule[2]"/>
                                                    <t t-if="acc > 0">
                                                        <t t-set="acc" t-value="acc+1"/>
                                                        <td t-att-colspan="acc" class="o_report_stock_rule_rule_cell">
                                                            <t t-set="padding" t-value="50.0/acc"/>
                                                            <div class="o_report_stock_rule_rule_main" t-att-res-id="rule[0].id" t-att-res-model="rule[0]._name" view-type="form" t-att-title="rule[0].route_id.display_name">
                                                                <div class="o_report_stock_rule_rule"  t-attf-style="padding-left: #{padding}%; padding-right: #{padding}%;">
                                                                    <t t-if="rule[1] == 'destination'">
                                                                        <t t-if="rule[0].procure_method == 'make_to_order'">
                                                                            <t t-call="stock.report_stock_rule_suspension_points"/>
                                                                        </t>
                                                                        <t t-if="rule[0].procure_method == 'mts_else_mto'">
                                                                            <t t-call="stock.report_stock_rule_suspension_points"/>
                                                                            <t t-call="stock.report_stock_rule_vertical_bar"/>
                                                                        </t>
                                                                        <t t-if="rule[0].action in ('push', 'pull_push')">
                                                                            <t t-call="stock.report_stock_rule_right_arrow"/>
                                                                        </t>
                                                                    </t>
                                                                    <t t-if="rule[1] == 'origin' and rule[0].action in ('pull', 'pull_push')">
                                                                        <t t-call="stock.report_stock_rule_left_arrow"/>
                                                                    </t>
                                                                    <t t-call="stock.report_stock_rule_line"/>
                                                                    <t t-if="rule[1] == 'destination' and rule[0].action in ('pull', 'pull_push')">
                                                                        <t t-call="stock.report_stock_rule_right_arrow"/>
                                                                    </t>
                                                                    <t t-if="rule[1] == 'origin'">
                                                                        <t t-if="rule[0].action in ('push', 'pull_push')">
                                                                            <t t-call="stock.report_stock_rule_left_arrow"/>
                                                                        </t>
                                                                        <t t-if="rule[0].procure_method == 'make_to_order'">
                                                                            <t t-call="stock.report_stock_rule_suspension_points"/>
                                                                        </t>
                                                                    </t>
                                                                </div>
                                                                <div class="o_report_stock_rule_rule_name">
                                                                    <span t-attf-style="color: #{color};"><t t-esc="rule[0].picking_type_id.name"/></span>
                                                                </div>
                                                            </div>
                                                        </td>
                                                        <t t-set="acc" t-value="0"/>
                                                    </t>
                                                    <t t-else="">
                                                        <t t-set="acc" t-value="acc+1"/>
                                                    </t>
                                                </t>
                                            </t>
                                            <t t-else="">
                                                <t t-if="acc > 0">
                                                    <t t-set="acc" t-value="acc+1"/>
                                                </t>
                                                <t t-if="acc == 0">
                                                    <td>
                                                    </td>
                                                </t>
                                            </t>
                                        </t>
                                    </tr>
                                </t>
                            </tbody>
                        </table>
                        <h3>Legend</h3>
                        <div class="o_report_stock_rule_legend">
                            <t t-set="color" t-value="'black'"/>
                            <div class="o_report_stock_rule_legend_line">
                                <div class="o_report_stock_rule_legend_label">Push Rule</div>
                                <div class="o_report_stock_rule_rule o_report_stock_rule_legend_symbol">
                                    <t t-call="stock.report_stock_rule_right_arrow"/>
                                    <t t-call="stock.report_stock_rule_line"/>
                                </div>
                            </div>
                            <div class="o_report_stock_rule_legend_line">
                                <div class="o_report_stock_rule_legend_label">Pull Rule</div>
                                <div class="o_report_stock_rule_rule o_report_stock_rule_legend_symbol">
                                    <t t-call="stock.report_stock_rule_line"/>
                                    <t t-call="stock.report_stock_rule_right_arrow"/>
                                </div>
                            </div>
                            <div class="o_report_stock_rule_legend_line">
                                <div class="o_report_stock_rule_legend_label">Trigger Another Rule</div>
                                <div class="o_report_stock_rule_rule o_report_stock_rule_legend_symbol">
                                    <t t-call="stock.report_stock_rule_suspension_points"/>
                                    <t t-call="stock.report_stock_rule_line"/>
                                </div>
                            </div>
                            <div class="o_report_stock_rule_legend_line">
                                <div class="o_report_stock_rule_legend_label">Trigger Another Rule If No Stock</div>
                                <div class="o_report_stock_rule_rule o_report_stock_rule_legend_symbol">
                                    <t t-call="stock.report_stock_rule_suspension_points"/>
                                    <t t-call="stock.report_stock_rule_vertical_bar"/>
                                    <t t-call="stock.report_stock_rule_line"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </t>
        </t>
    </template>
    <template id="report_stock_rule_line">
        <div class="o_report_stock_rule_line">
            <svg width="100%" height="100%" viewBox="0 0 100 10" preserveAspectRatio="none">
                <line x1="0" y1="5" x2="100" y2="5" t-attf-style="stroke: #{color};"/>
            </svg>
        </div>
    </template>
    <template id="report_stock_rule_vertical_bar">
        <div class="o_report_stock_rule_vertical_bar">
            <svg width="100%" height="100%" viewBox="0 0 1 1">
                <line y1="-12" x2="0" y2="12" x1="0" t-attf-style="stroke: #{color};"/>
            </svg>
        </div>
    </template>
    <template id="report_stock_rule_right_arrow">
        <div class="o_report_stock_rule_arrow">
            <svg width="100%" height="100%" viewBox="0 0 10 10">
                <polygon points="0,0 0,10 10,5" t-attf-style="stroke: #{color}; fill: #{color};"/>
            </svg>
        </div>
    </template>
    <template id="report_stock_rule_left_arrow">
        <div class="o_report_stock_rule_arrow">
            <svg width="100%" height="100%" viewBox="0 0 10 10">
                <polygon points="0,5 10,10 10,0" t-attf-style="stroke: #{color}; fill: #{color};"/>
            </svg>
        </div>
    </template>
    <template id="report_stock_rule_suspension_points">
        <div class="o_report_stock_rule_arrow">
            <svg width="100%" height="100%" viewBox="0 0 10 10" >
                <line x1="1" y1="5" x2="4.5" y2="5" t-attf-style="stroke: #{color};"/>
                <line x1="5.5" y1="5" x2="9" y2="5" t-attf-style="stroke: #{color};"/>
            </svg>
        </div>
    </template>
</odoo>