~savoirfairelinux-openerp/purchase-wkfl/pallet-delivery-optimized

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
<?xml version="1.0" encoding="utf-8"?>
<openerp>
  <data>
    <!-- Purchase Order -->
    <record id="purchase_order_hidden" model="ir.actions.act_window">
      <field name="name">Purchase Orders</field>
      <field name="type">ir.actions.act_window</field>
      <field name="res_model">purchase.order</field>
      <field name="view_mode">tree,form,graph,calendar</field>
      <field name="context">{}</field>
      <field name="domain">['&amp;', ('state','not in',('draft','sent','confirmed')), ('hidden', '!=', True)]</field>
      <field name="search_view_id" ref="purchase.view_purchase_order_filter"/>
      <field name="help" type="html">
        <p class="oe_view_nocontent_create">
          Click to create a quotation that will be converted into a purchase order. 
        </p><p>
          Use this menu to search within your purchase orders by
          references, supplier, products, etc. For each purchase order,
          you can track the related discussion with the supplier, control
          the products received and control the supplier invoices.
        </p>
      </field>
    </record>

    <menuitem
      id="purchase.menu_purchase_form_action"
      action="purchase_order_hidden"
      parent="purchase.menu_procurement_management"
      sequence="6" />

    <!-- Truck -->
    <record id="truck_tree" model="ir.ui.view">
      <field name="name">stock.truck.tree</field>
      <field name="model">stock.truck</field>
      <field name="arch" type="xml">
        <tree string="Truck">
          <field name="name" />
          <field name="truck_sn" />
          <field name="supplier" />
          <field name="arrival" />
        </tree>
      </field>
    </record>

    <record id="truck_form" model="ir.ui.view">
      <field name="name">stock.truck.form</field>
      <field name="model">stock.truck</field>
      <field eval="1" name="priority" />
      <field name="arch" type="xml">
        <form string="Truck" version="7.0">
          <header>
            <button
              name="action_done"
              type="object"
              states="draft"
              string="Confirm"
              class="oe_highlight" />

            <field
              name="state"
              widget="statusbar"
              statusbar_visible="draft,done"
              statusbar_colors='{"draft":"blue","done":"blue"}' />
          </header>

          <sheet>
            <group>
              <group name="pedigree" string="Details" colspan="4" col="4">
                <group>
                  <field name="truck_sn" />
                  <field name="supplier" />
                  <field name="arrival" on_change="onchange_arrival(arrival)" />
                </group>

                <group>
                  <field name="front_temperature" on_change="validate_temperature(front_temperature, 'front_temperature')" />
                  <field name="back_temperature" on_change="validate_temperature(back_temperature, 'back_temperature')" />
                </group>
              </group>

              <group name="purchase_orders" string="Purchase Orders" colspan="4">
                <field name="purchase_order_ids" nolabel="1" domain="[('state', 'not in', ['draft', 'done']), ('assigned', '=', True)]">
                  <tree>
                    <field name="name" />
                  </tree>
                </field>
              </group>

              <group name="pallets" string="Truck Composition" colspan="4">
                <group>
                  <field name="left_pallet_ids" nolabel="1">
                    <tree editable="bottom">
                      <field name="pallet" string="Left Pallets" context="{'nice':'nice','parent':parent}" />
                      <field name="crates" string="Crates" />
                    </tree>
                  </field>
                </group>

                <group>
                  <field name="right_pallet_ids" nolabel="1">
                    <tree editable="bottom">
                      <field name="pallet" string="Right Pallets" context="{'nice':'nice','parent':parent}" />
                      <field name="crates" string="Crates" />
                    </tree>
                  </field>
                </group>
              </group>
            </group>
          </sheet>
        </form>
      </field>
    </record>

    <record id="view_truck_filter" model="ir.ui.view">
      <field name="name">stock.truck.select</field>
      <field name="model">stock.truck</field>
      <field name="arch" type="xml">
        <search string="Search Truck">
          <field name="truck_sn" string="Serial Number" filter_domain="[('truck_sn', '=', self)]" />
        </search>
      </field>
    </record>

    <!-- Menu -->
    <record id="action_truck_pending" model="ir.actions.act_window">
      <field name="name">On Draft Truck</field>
      <field name="res_model">stock.truck</field>
      <field name="view_type">form</field>
      <field name="view_mode">tree,form</field>
      <field eval="False" name="view_id" />
      <field name="search_view_id" ref="pallet_delivery.view_truck_filter" />
      <field name="help" type="html">
        <p class="oe_view_nocontent_create">Click to create a draft truck</p>

        <p>The truck contains an incoming, physical shipment. With it you can
          register the truck's details, such as its serial number, sampled
          temperatures, and other information. Also, the truck serves you as a
          map of what your company received.</p>

        <p>When you confirm the truck, it will act as an “Incoming Shipment”
          confirmation, and the products will be moved from your Suppliers (as
          listed in Purchase Orders) to your Stock.</p>
      </field>
    </record>

    <menuitem
      name="Incoming Truck"
      id="menu_truck_purchase"
      action="action_truck_pending"
      parent="purchase.menu_procurement_management_inventory"
      sequence="8" />

    <menuitem
      name="Incoming Truck"
      id="menu_truck_stock"
      action="action_truck_pending"
      parent="stock.menu_stock_warehouse_mgmt"
      sequence="0" />
  </data>
</openerp>