~tempo-openerp/+junk/axima_stock

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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
    <!-- Ajout de la prise en compte de la date d'expiration dans le calendrier -->
        <record id="view_sale_order_calendar" model="ir.ui.view">
            <field name="name">order.calendar</field>
            <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_sale_order_calendar" />
            <field name="arch" type="xml">
        <xpath expr="//calendar" position="attributes" >
            <attribute name="date_stop">expiration_date</attribute>
        </xpath>
            </field>
        </record>

        <!-- Ajout de filtres par défaut sur les champs de recherche -->
        <record id="sale.action_orders" model="ir.actions.act_window">
            <field name="name">Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="search_view_id" ref="sale.view_sales_order_filter"/>
            <field name="context">{'search_default_office_quotes':1}</field>
            <field name="domain">[('state','not in',('invoice_except', ))]</field>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a quotation that can be converted into a sales
                order.
              </p><p>
                OpenERP will help you efficiently handle the complete sales flow:
                quotation, sales order, delivery, invoicing and payment.
              </p>
            </field>
        </record>

        <record id="sale.action_orders_in_progress" model="ir.actions.act_window">
            <field name="name">Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="context">{'search_default_office_quotes':1}</field>
            <field name="domain">[('state','in',('progress','waiting_date','manual'))]</field>
            <field name="search_view_id" ref="sale.view_sales_order_filter"/>
        </record>

        <record id="sale.action_quotations" model="ir.actions.act_window">
            <field name="name">Quotations</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">sale.order</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="sale.view_quotation_tree"/>
            <field name="view_mode">tree,form,calendar,graph</field>
            <field name="context">{'search_default_office_quotes':1}</field>
            <!-- Faire figurer toutes les ventes dans devis -->
            <field name="domain">[('state','not in',('invoice_except', ))]</field>
            <field name="search_view_id" ref="sale.view_sales_order_filter"/>
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to create a quotation, the first step of a new sale.
              </p><p>
                OpenERP will help you handle efficiently the complete sale flow:
                from the quotation to the sales order, the
                delivery, the invoicing and the payment collection.
              </p><p>
                The social feature helps you organize discussions on each sales
                order, and allow your customers to keep track of the evolution
                of the sales order.
              </p>
            </field>
        </record>

        <!-- Add axima fields to existing view     -->
        <record model="ir.ui.view" id="partner_axima_form_view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form" />
            <field name="arch" type="xml">

                <field name="partner_id" position="after" >
                        <field name="final_recipient" />
                        <field name="contact"
                            domain="[ ('is_company','=', False), ('customer', '=', False), ('user_of_company','=',uid) ]"
                            />
                </field>

                <field name="client_order_ref" position="before" >
                        <field name="internal_order_ref" />
                        <field name="sap_order_ref" />
                </field>

                <field name="date_order" position="replace" >
                    <field name="date_order" string="Date d’émission"/>
                </field>

                <field name="shop_id" position="after" >
                    <field name="expiration_date" />
                </field>

                <field name="pricelist_id" position="after" >
                        <!-- FIXME le domaine s'applique bien à la liste mais il
                            ne devrait pas empêcher de rechercher des membres
                            d'autres agences
                            -->
<!--                            on_change="onchange_signature(signature1, context)" -->
                        <field name="signature1"
                            domain="[ ('is_company','=', False), ('customer', '=', False), ('user_of_company','=',uid) ]"
                            context="{'search_default_signatories':1 }"
                            />
                        <field name="signature2"
                            domain="[ ('is_company','=', False), ('customer', '=', False), ('user_of_company','=',uid) ]"
                            context="{'search_default_signatories':1 }"
                            />
                </field>

                <!-- déplacement du champ payment_term sur le panneau principal -->
                <field name="payment_term" position="replace" />
                <field name="contact" position="after" >
                <field name="payment_term" domain="[('type', '=', 'axima')]"
                    widget="selection" />
                </field>


                <!-- Efface le champ note pour le déplacer en
                     en-tête -->
                <field name="note" position="replace" />


                <!--
                <field name="note" position="replace" >
                        <label for="note" string="Corps du message" />
                        <field name="note" string="Corps du message" />
                </field>
-->

                <field name="payment_term" position="before" >
                        <field name="supply_period" />
                        <field name="execution_period" />
                </field>
                <field name="payment_term" position="after" >
                        <field name="client_note" />
                        <field name="commercial_note" />
                        <field name="show_discount" />
                </field>

                <xpath expr="//sheet/group[1]" position="after" >
                    <group colspan="4">
                       <field name="object" />
                       <field name="note" string="Corps du message"
                           colspan="4"    />
                    </group>
                    <group col="4">
                        <field name="set_price_on" colspan="2" />
                        <field name="set_price_name" colspan="2" />
                    </group>
                </xpath>

                <xpath expr="//group[@name='sale_total']" position="replace" >
                    <group >

                        <group >
                            <label for="extra_note"
                                colspan="2"
                                />
                            <field name="extra_note"
                                nolabel="1"
                            />
                        </group>

                        <group
                            name="sale_total">
                            <field name="amount_untaxed" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                            <field name="amount_tax" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                            <div class="oe_subtotal_footer_separator oe_inline">
                            <label for="amount_total" />
                            <button name="button_dummy"
                                states="draft,sent" string="(update)" type="object" class="oe_edit_only oe_link"/>
                            </div>
                            <field name="amount_total" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' options="{'currency_field': 'currency_id'}"/>
                        </group>
                    </group>
                </xpath>
                
                <!--
                keep for archive: treeview reviewed in sale_margin.xml
                for AX-50
                <xpath expr="//tree[@string='Sales Order Lines']/field[@name='price_unit']"
                    position="attributes">
                        <attribute name="on_change">
                            onchange_discount(price_unit, discount)
                        </attribute>
                 </xpath>

                <xpath expr="//tree[@string='Sales Order Lines']/field[@name='discount']"
                    position="attributes">
                        <attribute name="on_change">
                            onchange_discount(price_unit, discount)
                        </attribute>
                 </xpath>

                <field name="price_subtotal" position="before" >
                        <field name="discount_price" />
                </field>-->

                <!--
                    Limite la vue aux clients de l'agence courante
                    et mise à jour des infos clients lors de la sélection
                -->
                <field name="partner_id" position="replace" >
                    <field name="partner_id"
                        on_change="onchange_partner_id(partner_id, client_note, commercial_note, context)"
                        domain="[('customer','=',True), ('user_of_company','=',uid)]"
                        context="{'search_default_office_customer': 1, 'search_default_customer': 0, 'show_address': 1, 'search_default_partners': 0}"
                        options='{"always_reload": True}'
                        />
                </field>

                <!-- retrait des boutons liés à la facturation
                <xpath expr="//button[@string='View Invoice']"
                    position="replace" />
                -->
                <xpath expr="//button[@string='Create Invoice']"
                    position="replace" />

                <xpath expr="//field[@name='order_line']" position="attributes">
                        <attribute name="on_change">
                            onchange_order_line(order_line)
                        </attribute>
                </xpath>
                
                <xpath expr="//label[@string='Sales Order ']" position="attributes">
                    <!--
                    afficher 'devis' à la place de 'bons de commande'
                    le token source de traduction à un espace à la fin 'Quotation '
                    -->
                    <attribute name="string">Quotation </attribute>
                </xpath>
                
                <!-- remise globale -->
                <xpath expr="/form//field[@name='amount_untaxed']" position="before">
                    <field name="global_discount" widget="monetary" options="{'currency_field': 'currency_id'}" />
                </xpath>
                
               <!-- éléments inutilisés masqués -->
                <xpath expr="//field[@name='shop_id']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <!--
                <xpath expr="//field[@name='picking_policy']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='order_policy']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='shipped']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='invoiced']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>
                <xpath expr="//field[@name='fiscal_position']" position="attributes">
                    <attribute name="invisible">1</attribute>
                </xpath>-->

            </field>
        </record>

    <!-- Reprise des entrées du formulaire sale_view.xml où apparaît
         "cancel" et ajout de la prise ne compte de "refuse" -->
        <record id="view_order_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">3</field>
            <field name="inherit_id" ref="sale.view_order_tree" />
            <field name="arch" type="xml">
                <xpath expr="//tree[@string='Sales Orders']"
                    position="attributes">
                        <attribute name="colors">grey:state=='refuse';grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')</attribute>
                 </xpath>
            </field>
        </record>

        <record id="view_quotation_tree" model="ir.ui.view">
            <field name="name">sale.order.tree</field>
            <field name="model">sale.order</field>
            <field name="priority">5</field>
            <field name="inherit_id" ref="sale.view_quotation_tree" />
            <field name="arch" type="xml">
                <xpath expr="//tree[@string='Quotation']"
                    position="attributes">
                        <attribute name="colors">grey:state=='refuse';grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')</attribute>
                </xpath>
                <!-- HT vs TTC -->
                <xpath expr="//field[@name='amount_total']" position="replace">
                    <field name="amount_untaxed" string="Total HT" sum="Total HT"/>
                </xpath>
            </field>
        </record>
        
        <!-- surcharge vue search -->       
        <record id="axima_view_sales_order_filter" model="ir.ui.view">
            <field name="name">sale.order.list.select</field>
            <field name="model">sale.order</field>
			<field name="inherit_id" ref="sale.view_sales_order_filter" />
            <field name="arch" type="xml">
            	<xpath expr="//filter[@name='my_sale_orders_filter']"
                    position="after">
                    <field name="user_of_company" select="1" invisible="1" />
                    <filter name="office_quotes"
                            help="Devis de l'agence"
                            icon="terp-personal+"
                            domain="[('user_of_company','=',uid)]"/>
            	</xpath>
            </field>
        </record>

        <record id="view_order_form" model="ir.ui.view">
            <field name="name">sale.order.form</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form" />
            <field name="arch" type="xml">
                <xpath expr="//button[@name='copy_quotation']"
                       position="replace">
               <button name="copy_quotation"
                   states="cancel,refuse"
                            string="New Copy of Quotation"
                            type="object"/>
                </xpath>
                <xpath expr="//button[@name='copy_quotation']"
                       position="after">
               <button name="refuse"
                   states="draft,sent"
                   string="Devis refusé"
                   groups="base.group_user"/>
                </xpath>
                <xpath expr="//button[@name='action_cancel']"
                       position="after">
               <button name="action_refuse"
                   states="manual,progress"
                   string="Commande refusée"
                   type="object"
                   groups="base.group_user"/>
                </xpath>
                <xpath expr="//button[@name='invoice_cancel']"
                       position="after">
                     <button name="invoice_refuse"
                             states="invoice_except"
                             string="Facture refusée"
                             groups="base.group_user"/>
                </xpath>

                <xpath expr="//field[@name='state']"
                       position="replace">
                    <field name="state"
                        widget="statusbar"
                        statusbar_visible="draft,confirmed,done"
                        statusbar_colors='{"exception":"red","cancel":"red","refuse":"red"}'/>
                </xpath>

            </field>
        </record>

        <record id="view_order_line_form2" model="ir.ui.view">
            <field name="name">sale.order.line.form2</field>
            <field name="model">sale.order.line</field>
            <field name="inherit_id" ref="sale.view_order_line_form2" />
            <field name="arch" type="xml">
                <xpath expr="//button[@name='button_cancel']"
                       position="after">
                        <button name="button_refuse"
                                string="Ligne refusée"
                                type="object"
                                states="confirmed,exception" groups="base.group_user"/>
                </xpath>

                <xpath expr="//field[@name='state']"
                       position="replace">
                       <field name="state" widget="statusbar"
                              statusbar_visible="draft,confirmed,done"
                              statusbar_colors='{"exception":"red","cancel":"red","refuse":"red"}'/>
                </xpath>
            </field>
        </record>



        <record id="view_sales_order_uninvoiced_line_filter" model="ir.ui.view">
            <field name="name">sale.order.uninvoiced.line</field>
            <field name="model">sale.order.line</field>
            <field name="inherit_id" ref="sale.view_sales_order_uninvoiced_line_filter" />
            <field name="arch" type="xml">
                <xpath expr="//filter[@name='uninvoiced']"
                       position="attributes">
                       <attribute name="domain">[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','refuse'),(('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]</attribute>
                </xpath>
            </field>
        </record>

    </data>
</openerp>