~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
<?xml version="1.0" encoding="utf-8"?>
<openerp>
	<data>

		<!-- sale.order.line embedded in sale.order -->
		<record id="view_order_form" model="ir.ui.view">
			<field name="name">sale.order.form</field>
			<field name="model">sale.order</field>
			<field name="type">form</field>
			<field name="inherit_id" ref="sale.view_order_form" />
			<field name="arch" type="xml">
				<data>

					<field name="price_unit" position="after">
						<field name="supplier" invisible="True" />
						<field name="po_cft" invisible="True" />
					</field>

				</data>
			</field>
		</record>

		<record id="sourcing_line_normal_form_view" model="ir.ui.view">
			<field name="name">sourcing.line.form</field>
			<field name="model">sourcing.line</field>
			<field name="type">form</field>
			<field name="arch" type="xml">
				<form string="Sourcing Line">
					<field name="name" />
					<field name="sale_order_id" />
					<field name="sale_order_line_id" />
					<field name="reference" />
					<field name="state" />
				</form>
			</field>
		</record>

		<record id="sourcing_line_normal_tree_view" model="ir.ui.view">
			<field name="name">sourcing.line.tree</field>
			<field name="model">sourcing.line</field>
			<field name="type">tree</field>
			<field name="arch" type="xml">
				<tree string="Sourcing Lines" editable="top" hide_new_button="1" hide_delete_button="1" colors="red:priority=='emergency';darkgreen:priority=='urgent';blue:priority=='medium'">

					<field name="name" invisible="True" />
					<field name="sale_order_id" />
					<field name="priority" />
					<field name="categ" />
					<field name="line_number" />
					<field name="sale_order_state" />
					<field name="state" invisible="True" />
					<field name="product_id" />
					<field name="qty" string="Qty" />
					<field name="uom_id" />
					<field name="rts" />
					<field name="type" string="Proc. Method" on_change="onChangeType(type)" attrs="{'readonly': [('state', '!=', 'draft')]}" />
					<field name="po_cft" attrs="{'readonly': ['|', ('type', '=', 'make_to_stock'), ('state', '!=', 'draft')], 'required': [('type', '=', 'make_to_order')]}" />
					<field name="real_stock" />
					<field name="available_stock" />
					<field name="virtual_stock" />
					<!-- do not work: attrs="{'readonly': ['|', '|', ('type', '=', 'make_to_stock'), '&amp;', ('type', '=', 'make_to_order'), ('po_cft', '=', 'cft'), ('state', '!=', 'draft')]}" -->
					<field name="supplier" colspan="2"
						context="{'product_id': product_id, 'choose_supplier': True}"
						attrs="{'readonly': ['|', ('type', '=', 'make_to_stock'), ('state', '!=', 'draft')]}"
						on_change="onChangeSupplier(supplier)" />
					<field name="estimated_delivery_date" />
					<button name="confirmLine" string="Confirm line" icon="gtk-go-forward" type="object" attrs="{'invisible':[('state', '!=', 'draft')]}" />
					<!-- does not work. openerp bug ? <button name="unconfirmLine" string="Unconfirm Line" icon="gtk-cancel" type="object" attrs="{'invisible':['|', ('state', '!=', 'confirmed'), ('sale_order_state', '!=', 'draft')]}" />--> 

				</tree>
			</field>
		</record>

		<record id="sourcing_line_search_form_view" model="ir.ui.view">
			<field name="name">sourcing.line.search.form</field>
			<field name="model">sourcing.line</field>
			<field name="type">search</field>
			<field name="arch" type="xml">
				<search string="Sourcing Line">
					<field name="sale_order_id" />
					<field name="priority" />
					<field name="categ" />
					<field name="sale_order_state" />
					<field name="product_id" />
					<field name="type" />
					<newline />
					<group expand="0" string="Group By..." colspan="11" col="11"
						groups="base.group_extended">
						<filter string="Sale Order" icon="terp-accessories-archiver" domain="[]"
							context="{'group_by':'sale_order_id'}" />
						<filter string="Priority" icon="terp-emblem-important"
							domain="[]" context="{'group_by':'priority'}" />
						<filter string="Category" icon="terp-stock_symbol-selection"
							domain="[]" context="{'group_by':'categ'}" />
						<filter string="Order State" icon="terp-rating-rated"
							domain="[]" context="{'group_by':'sale_order_state'}" />
						<filter string="Product" icon="terp-product"
							domain="[]" context="{'group_by':'product_id'}" />
					</group>
				</search>
			</field>
		</record>

		<record id="sourcing_line_action" model="ir.actions.act_window">
			<field name="name">Orders Sourcing Tool</field>
			<field name="res_model">sourcing.line</field>
			<field name="view_type">form</field>
			<field name="view_mode">tree,form</field>
			<field name="domain">[('sale_order_state','!=','procurement')]</field>
			<field name="search_view_id" ref="sourcing_line_search_form_view" />
		</record>

		<menuitem icon="STOCK_INDENT" action="sourcing_line_action"
			id="menu_sourcing_line" parent="base.menu_sales" />

	</data>
</openerp>