Merge lp:~unifield-team/unifield-wm/us-31 into lp:unifield-wm

Proposed by Quentin THEURET @Amaris
Status: Merged
Merged at revision: 2417
Proposed branch: lp:~unifield-team/unifield-wm/us-31
Merge into: lp:unifield-wm
Diff against target: 180 lines (+18/-55)
3 files modified
sourcing/sale_order_line.py (+0/-26)
sourcing/wizard/multiple_sourcing.py (+11/-11)
sourcing/wizard/multiple_sourcing_view.xml (+7/-18)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-31
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+251498@code.launchpad.net
To post a comment you must log in.
lp:~unifield-team/unifield-wm/us-31 updated
2405. By Quentin THEURET @Amaris

US-31 [FIX] On multiple line OST, the supplier can not be choosen

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sourcing/sale_order_line.py'
2--- sourcing/sale_order_line.py 2014-10-22 08:44:42 +0000
3+++ sourcing/sale_order_line.py 2015-03-02 20:31:41 +0000
4@@ -48,32 +48,6 @@
5 _inherit = 'sale.order.line'
6 _description = 'Sales Order Line'
7
8- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
9- if context is None:
10- context = {}
11-
12- '''
13- !!!!! ATTENTION ATTENTION!!!!!!
14- UTP-1021: This solution is NOT stable and could be dangerous!!!!
15- need to have a proper fix for this,
16- currently we have only 3 tree views for sale.order.line
17- so I use the value in the context to identify that it is not the
18- view of wizard, but this assumption could be totally WRONG!
19- But in this current version, it works!
20- '''
21- if not context.get('search_default_need_sourcing', False) and \
22- view_type == 'tree':
23- if '_terp_view_name' in context:
24- '''
25- UFTP-346: HACK ON HACK UTP-1021
26- '_terp_view_name' not set if grouping
27- and we do not want special view when grouping
28- '''
29- view_id = self.pool.get('ir.model.data').get_object_reference(
30- cr, uid, 'sourcing', 'sourcing_line_special_tree_view')[1]
31- return super(sale_order_line, self).fields_view_get(cr, uid, view_id,
32- view_type, context, toolbar, submenu)
33-
34 """
35 Other methods
36 """
37
38=== modified file 'sourcing/wizard/multiple_sourcing.py'
39--- sourcing/wizard/multiple_sourcing.py 2014-10-10 12:26:59 +0000
40+++ sourcing/wizard/multiple_sourcing.py 2015-03-02 20:31:41 +0000
41@@ -53,7 +53,7 @@
42 'stock.location',
43 string='Location',
44 ),
45- 'supplier': fields.many2one(
46+ 'supplier_id': fields.many2one(
47 'res.partner',
48 string='Supplier',
49 help="If you have choose lines coming from Field Orders, only External/ESC suppliers will be available.",
50@@ -124,7 +124,7 @@
51 if loc != -1:
52 res['location_id'] = loc
53 if supplier != -1:
54- res['supplier'] = supplier
55+ res['supplier_id'] = supplier
56
57 if not res['line_ids']:
58 raise osv.except_osv(_('Error'), _('No non-sourced lines are selected. Please select non-sourced lines'))
59@@ -146,7 +146,7 @@
60 if wiz.type == 'make_to_order':
61 if not wiz.po_cft:
62 raise osv.except_osv(_('Error'), _('The Procurement method should be filled !'))
63- elif wiz.po_cft != 'cft' and not wiz.supplier:
64+ elif wiz.po_cft != 'cft' and not wiz.supplier_id:
65 raise osv.except_osv(_('Error'), _('You should select a supplier !'))
66
67 errors = {}
68@@ -159,7 +159,7 @@
69 try:
70 line_obj.write(cr, uid, [line.id], {'type': wiz.type,
71 'po_cft': wiz.po_cft,
72- 'supplier': wiz.supplier and wiz.supplier.id or False,
73+ 'supplier': wiz.supplier_id and wiz.supplier_id.id or False,
74 'location_id': wiz.location_id.id and wiz.location_id.id or False},
75 context=context)
76 except osv.except_osv, e:
77@@ -227,7 +227,7 @@
78 if l_type == 'make_to_order':
79 return {'value': {'location_id': False}}
80
81- res = {'value': {'po_cft': False, 'supplier': False}}
82+ res = {'value': {'po_cft': False, 'supplier_id': False}}
83 if not context or not context[0] or not context[0][2]:
84 return res
85
86@@ -248,15 +248,15 @@
87 all_line_empty = False
88
89 if all_line_empty: # by default, and if all lines has no location, then set by default Stock
90- return {'value': {'po_cft': False, 'supplier': False, 'location_id': stock_loc}}
91- return {'value': {'po_cft': False, 'supplier': False}}
92+ return {'value': {'po_cft': False, 'supplier_id': False, 'location_id': stock_loc}}
93+ return {'value': {'po_cft': False, 'supplier_id': False}}
94
95 def change_po_cft(self, cr, uid, ids, po_cft, context=None):
96 '''
97 Unset the supplier if tender is choosen
98 '''
99 if po_cft == 'cft':
100- return {'value': {'supplier': False}}
101+ return {'value': {'supplier_id': False}}
102
103 return {}
104
105@@ -278,16 +278,16 @@
106 }
107 return result
108
109- def change_location(self, cr, uid, ids, location_id, context=None):
110+ def change_location(self, cr, uid, ids, location_id, line_ids, context=None):
111 res = {'value': {}}
112 if not location_id:
113 return res
114
115- if not context or not context[0] or not context[0][2]:
116+ if not line_ids or not line_ids[0] or not line_ids[0][2]:
117 return res
118
119 line_obj = self.pool.get('sale.order.line')
120- active_ids = context[0][2]
121+ active_ids = line_ids[0][2]
122
123 context = {}
124 context.update({'from_multiple_line_sourcing': False})
125
126=== modified file 'sourcing/wizard/multiple_sourcing_view.xml'
127--- sourcing/wizard/multiple_sourcing_view.xml 2014-10-09 13:19:51 +0000
128+++ sourcing/wizard/multiple_sourcing_view.xml 2015-03-02 20:31:41 +0000
129@@ -15,35 +15,24 @@
130 </group>
131 <group colspan="4" col="4">
132 <separator colspan="4" string="Selected lines to source" />
133- <field name="line_ids" nolabel="1" colspan="4">
134- <tree string="Lines to source" hide_new_button="True" noteditable="True">
135- <field name="order_id" string="Order reference" />
136- <field name="line_number" />
137- <field name="product_id" />
138- <field name="product_uom_qty" />
139- <field name="product_uom" />
140- <field name="real_stock" />
141- <field name="available_stock" />
142- <field name="virtual_stock" />
143- </tree>
144- </field>
145+ <field name="line_ids" nolabel="1" colspan="4" />
146 <separator colspan="4" string="Procurement method" />
147 <field name="type"
148- on_change="change_type(type, line_ids)"/>
149+ on_change="change_type(type)"/>
150 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"
151 on_change="change_po_cft(po_cft)"/>
152 <separator colspan="4" string="Supplier selection" />
153- <field name="supplier"
154+ <field name="supplier_id"
155 domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft), ('line_contains_fo', '=', line_ids)]"
156 attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('type', '=', 'make_to_stock')]}"
157- on_change="change_supplier(supplier)"
158+ on_change="change_supplier(supplier_id)"
159 />
160
161
162 <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False),
163 ('scrap_location', '=', False), ('destruction_location', '=', False),
164 ('output_ok', '=', False), ('input_ok', '=', False)]"
165- attrs="{'readonly': [('type', '!=', 'make_to_stock')]}"
166+ attrs="{'readonly': [('type', '!=', 'make_to_stock')]}"
167 on_change="change_location(location_id, line_ids)" />
168
169 </group>
170@@ -59,8 +48,8 @@
171 <record id="sourcing_line_special_tree_view" model="ir.ui.view">
172 <field name="name">sourcing.line.special.tree.view</field>
173 <field name="model">sale.order.line</field>
174- <field name="type">form</field>
175- <field name="priority" eval="5000" />
176+ <field name="type">tree</field>
177+ <field name="priority" eval="10" />
178 <field name="arch" type="xml">
179 <tree string="Lines to source" hide_new_button="True" noteditable="True">
180 <field name="order_id" string="Order reference" />

Subscribers

People subscribed via source and target branches