~unifield-team/unifield-wm/us-826

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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>

        <record model="ir.ui.view" id="msf_budget_view_tree">
            <field name="name">msf.budget.view.tree</field>
            <field name="model">msf.budget</field>
            <field name="type">tree</field>
            <field name="arch" type="xml">
               <tree colors="blue:state in ('draft');gray:state in ('done');black:state in ('valid')" string="Budget">
                    <field name="name" colspan="1"/>
                    <field name="code" colspan="1"/>
                    <field name="fiscalyear_id"/>
                    <field name="state"/>
                    <field name="decision_moment_id"/>
                    <field name="version"/>
                    <field name="total_budget_amount" digits="(24,0)"/>
                </tree>
            </field>
        </record>

        <record id="view_msf_budget_search" model="ir.ui.view">
           <field name="name">msf.budget.search</field>
           <field name="model">msf.budget</field>
           <field name="type">search</field>
           <field name="arch" type="xml">
               <search string="Budget">
                   <group col="20" colspan="4">
                       <filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help="Draft Budgets"/>
                       <filter name="validated" string="Validated" icon="terp-camera_test" domain="[('state','=','valid')]" help="Validated Budgets" />
                       <separator orientation="vertical"/>
                       <field name="name" select="1"/>
                       <field name="code" select="1" />
                       <field name="cost_center_id"/>
                       <field name="state"/>
                       <field name="fiscalyear_id"/>
                       <field name="currency_id"/>
                       <field name="decision_moment_id"/>
                       <field name="version"/>
                   </group>
               </search>
           </field>
        </record>

        <record model="ir.ui.view" id="msf_budget_view_form">
            <field name="name">msf.budget.view.form</field>
            <field name="model">msf.budget</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Budget">
                    <field name="name" readonly="1"/>
                    <field name="code" readonly="1"/>
                    <field name="fiscalyear_id" readonly="1"/>
                    <field name="cost_center_id" readonly="1"/>
                    <field name="decision_moment_id" readonly="1" attrs="{'invisible': [('type', '=', 'view')]}"/>
                    <field name="version" readonly="1" attrs="{'invisible': [('type', '=', 'view')]}"/>
                    <field name="type" readonly="1" invisible="1"/>
                    <group col="4" colspan="2">
                        <button name="button_display_type" string="Change display type" type="object" icon="terp-stock_zoom" context="context" colspan="1"/>
                        <field name="display_type" readonly="1" nolabel="1"/>
                    </group>
                    <field name="currency_id" readonly="1"/>
                    <field name="budget_line_ids" colspan="4" nolabel="1" readonly="1">
                        <tree string="Budget Lines" editable="top" colors="black:line_type in ('normal');blue:line_type in ('view')">
                            <field name="name"/>
                            <field name="budget_amount" real_sum="Budget Amount"/>
                            <field name="actual_amount" real_sum="Actual Amount"/>
                            <field name="balance" real_sum="Balance"/>
                            <field name="percentage"/>
                            <field name="line_type"/>
                        </tree>
                        <form string="Budget Line">
                            <group colspan="4">
                                <field name="name" colspan="2" readonly="1"/>
	                            <field name="budget_amount" colspan="1" readonly="1"/>
	                            <field name="actual_amount" colspan="1" readonly="1"/>
	                            <field name="balance" colspan="1" readonly="1"/>
	                            <field name="percentage" colspan="1" readonly="1"/>
                            </group>
                        </form>
                    </field>
                    <field name="state" select="1" readonly="1" attrs="{'invisible': [('type', '=', 'view')]}"/>
                    <group col="4" colspan="2">
                        <button string="Approve" name="validate" type="workflow" icon="gtk-ok" attrs="{'invisible': [('|'), ('type', '=', 'view'), ('state', '!=', 'draft')]}"/>
                        <button string="Done" name="done" type="workflow" icon="gtk-jump-to" attrs="{'invisible': [('|'), ('type', '=', 'view'), ('state', '!=', 'valid')]}"/>
                    </group>
                </form>
            </field>
        </record>

        <record model="ir.actions.act_window" id="act_crossovered_budget_view">
            <field name="name">Budgets</field>
            <field name="res_model">msf.budget</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="msf_budget_view_tree"/>
            <field name="search_view_id" ref="view_msf_budget_search"/>
            <field name="context">{'search_default_validated': 1}</field>
            <field name="help">A budget is a forecast of your company's income and expenses expected for a period in the future. With a budget, a company is able to carefully look at how much money they are taking in during a given period, and figure out the best way to divide it among various categories. By keeping track of where your money goes, you may be less likely to overspend, and more likely to meet your financial goals. Forecast a budget by detailing the expected revenue per analytic account and monitor its evolution based on the actuals realised during that period.</field>
        </record>
        
        <menuitem id="next_id_31" name="Budgets" parent="account.menu_finance" sequence="11"/>
        <menuitem parent="next_id_31"
            id="menu_act_crossovered_budget_view"
            action="act_crossovered_budget_view" sequence="1" />

        <record id="wizard_budget_criteria_export_view" model="ir.ui.view">
            <field name="name">Budget vs. Actuals Export</field>
            <field name="model">wizard.budget.criteria.export</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Budget vs. Actuals Export">
                    <field name="currency_table_id"/>
                    <field name="period_id"/>
                    <field name="commitment"/>
                    <field name="breakdown"/>
                    <field name="granularity"/>
                    <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button special="cancel" string="No" icon="gtk-cancel"/>
                        <button name="button_create_budget" string="Create report" type="object" icon="gtk-ok"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="wizard_budget_actual_export_view" model="ir.ui.view">
            <field name="name">Actuals by CC Export</field>
            <field name="model">wizard.actual.export</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Actuals by CC Export">
                    <field name="currency_table_id"/>
                    <newline/>
                    <field name="cost_center_ids"/>
                    <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button special="cancel" string="No" icon="gtk-cancel"/>
                        <button name="button_create_report" string="Create report" type="object" icon="gtk-ok"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="wizard_budget_import_view" model="ir.ui.view">
            <field name="name">Budget Import</field>
            <field name="model">wizard.budget.import</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Budget Import">
                    <label string="Select a .CSV file to import." align="0.0" colspan="3"/>
                    <field name="import_file"/>
                    <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button special="cancel" string="Cancel" icon="gtk-cancel"/>
                        <button name="import_csv_budget" string="Import Budget" type="object" icon="gtk-ok"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="wizard_budget_import_confirm_view" model="ir.ui.view">
            <field name="name">Budget Already Existing</field>
            <field name="model">wizard.budget.import.confirm</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Budget Already Existing">
                    <label string="Do you want to overwrite the following budgets:" align="0.0" colspan="3"/>
                    <field name="budget_list" colspan="4" nolabel="1" readonly="1"/>
                    <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button name="button_cancel" string="No" type="object" icon="gtk-cancel"/>
                        <button name="button_confirm" string="Yes" type="object" icon="gtk-ok"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="wizard_budget_import_finish_view" model="ir.ui.view">
            <field name="name">Budget Imported</field>
            <field name="model">wizard.budget.import.finish</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Budget Imported">
                    <label string="The budget has been correctly uploaded." align="0.0" colspan="3"/>
                    <separator colspan="4"/>
                    <button name="button_close" string="OK" type="object" icon="gtk-ok"/>
                </form>
            </field>
        </record>

        <record id="action_wizard_budget_import" model="ir.actions.act_window">
            <field name="name">Import Budget</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">wizard.budget.import</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="wizard_budget_import_view"/>
            <field name="target">new</field>
        </record>
        
        <record id="wizard_local_expenses_view" model="ir.ui.view">
            <field name="name">Local Expenses</field>
            <field name="model">wizard.local.expenses</field>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <form string="Local Expenses">
                    <field name="fiscalyear_id"/>
                    <field name="period_id"/>
                    <field name="breakdown"/>
                    <field name="granularity"/>
                    <field name="booking_currency_id"/>
                    <field name="output_currency_id"/>
                    <field name="cost_center_id"/>
                    <separator colspan="4"/>
                    <group colspan="4" col="6">
                        <button special="cancel" string="No" icon="gtk-cancel"/>
                        <button name="button_create_report" string="Create report" type="object" icon="gtk-ok"/>
                    </group>
                </form>
            </field>
        </record>

        <record id="action_wizard_local_expenses" model="ir.actions.act_window">
            <field name="name">Local Expenses</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">wizard.local.expenses</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="wizard_local_expenses_view"/>
            <field name="target">new</field>
        </record>


		<!-- Menu Item: Analytic Accounts which displays only Cost Center, and not allow: delete, new, edit
		hide_new_button="1" hide_delete_button="1"
		 -->
        
        <menuitem parent="account.menu_finance_generic_reporting"
            action="action_wizard_local_expenses"
            id="menu_action_wizard_local_expenses"/>
            
        <menuitem parent="next_id_31"
            action="action_wizard_budget_import"
            id="menu_action_wizard_budget_import"  sequence="2"/>
            
        <record id="view_msf_budget_summary_tree" model="ir.ui.view">
            <field name="name">msf.budget.summary.tree</field>
            <field name="model">msf.budget.summary</field>
            <field name="type">tree</field>
            <field name="field_parent">child_ids</field>
            <field name="arch" type="xml">
                <tree string="Budget Status">
                    <field name="code"/>
                    <field name="name"/>
                    <field name="budget_amount"/>
                    <field name="actual_amount"/>
                    <field name="parent_id" invisible="1"/>
                </tree>
            </field>
        </record>
        
        <record id="action_wizard_budget_summary_tree" model="ir.actions.server">
            <field name="name">Budget Status</field>
            <field name="model_id" ref="model_msf_budget"/>
            <field name="state">code</field>
            <field name="code">action = obj.budget_summary_open_window(context=context)</field>
        </record>

        <record id="ir_action_wizard_budget_summary_tree" model="ir.values">
            <field eval="'client_action_multi'" name="key2"/>
            <field eval="'msf.budget'" name="model"/>
            <field name="name">Budget Status</field>
            <field eval="'ir.actions.server,%d'%action_wizard_budget_summary_tree" name="value"/>
            <field eval="True" name="object"/>
        </record>


        <record id="view_account_analytic_account_budget_tree" model="ir.ui.view">
            <field name="name">account.analytic.account.budget.tree</field>
            <field name="model">account.analytic.account</field>
            <field name="type">tree</field>
            <field name="domain">[('category','=','OC')]</field>
            <field name="field_parent">child_complete_ids</field>
            <field name="arch" type="xml">
                <tree colors="red:(date&lt;current_date);black:(date&gt;=current_date);black:(date==False)" string="Analytic Accounts" 
                 toolbar="1" hide_new_button="1" hide_delete_button="1" editable="top" noteditable="1">
                    <field name="name"/>
                    <field name="code"/>
                    <field name="description"/>
                    <field name="category"/>
                    <field name="type" />
                    <field name="date_start"/>
                    <field name="date"/>
                    <field name="parent_id" invisible="1"/>
                    <button name="button_wiz_hard_posting" states="open" string="Hard Posting" type="object" icon="terp-camera_test" context="context"/>
                </tree>
            </field>
        </record>

        <record id="action_account_analytic_account_budget_form" model="ir.actions.act_window">
            <field name="name">Analytic Accounts</field>
            <field name="res_model">account.analytic.account</field>
            <field name="view_id" ref="view_account_analytic_account_budget_tree"/>
            <field name="domain">[('category','=','OC')]</field>
            <field name="context">{'search_default_active': 1, 'filter_inactive_accounts': 1}</field>
        </record>

        <menuitem action="action_account_analytic_account_budget_form" id="menu_action_account_analytic_account_budget_form" parent="next_id_31" />

    </data>
</openerp>