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
=== modified file 'sourcing/sale_order_line.py'
--- sourcing/sale_order_line.py 2014-10-22 08:44:42 +0000
+++ sourcing/sale_order_line.py 2015-03-02 20:31:41 +0000
@@ -48,32 +48,6 @@
48 _inherit = 'sale.order.line'48 _inherit = 'sale.order.line'
49 _description = 'Sales Order Line'49 _description = 'Sales Order Line'
5050
51 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
52 if context is None:
53 context = {}
54
55 '''
56 !!!!! ATTENTION ATTENTION!!!!!!
57 UTP-1021: This solution is NOT stable and could be dangerous!!!!
58 need to have a proper fix for this,
59 currently we have only 3 tree views for sale.order.line
60 so I use the value in the context to identify that it is not the
61 view of wizard, but this assumption could be totally WRONG!
62 But in this current version, it works!
63 '''
64 if not context.get('search_default_need_sourcing', False) and \
65 view_type == 'tree':
66 if '_terp_view_name' in context:
67 '''
68 UFTP-346: HACK ON HACK UTP-1021
69 '_terp_view_name' not set if grouping
70 and we do not want special view when grouping
71 '''
72 view_id = self.pool.get('ir.model.data').get_object_reference(
73 cr, uid, 'sourcing', 'sourcing_line_special_tree_view')[1]
74 return super(sale_order_line, self).fields_view_get(cr, uid, view_id,
75 view_type, context, toolbar, submenu)
76
77 """51 """
78 Other methods52 Other methods
79 """53 """
8054
=== modified file 'sourcing/wizard/multiple_sourcing.py'
--- sourcing/wizard/multiple_sourcing.py 2014-10-10 12:26:59 +0000
+++ sourcing/wizard/multiple_sourcing.py 2015-03-02 20:31:41 +0000
@@ -53,7 +53,7 @@
53 'stock.location',53 'stock.location',
54 string='Location',54 string='Location',
55 ),55 ),
56 'supplier': fields.many2one(56 'supplier_id': fields.many2one(
57 'res.partner',57 'res.partner',
58 string='Supplier',58 string='Supplier',
59 help="If you have choose lines coming from Field Orders, only External/ESC suppliers will be available.",59 help="If you have choose lines coming from Field Orders, only External/ESC suppliers will be available.",
@@ -124,7 +124,7 @@
124 if loc != -1:124 if loc != -1:
125 res['location_id'] = loc125 res['location_id'] = loc
126 if supplier != -1:126 if supplier != -1:
127 res['supplier'] = supplier127 res['supplier_id'] = supplier
128128
129 if not res['line_ids']:129 if not res['line_ids']:
130 raise osv.except_osv(_('Error'), _('No non-sourced lines are selected. Please select non-sourced lines'))130 raise osv.except_osv(_('Error'), _('No non-sourced lines are selected. Please select non-sourced lines'))
@@ -146,7 +146,7 @@
146 if wiz.type == 'make_to_order':146 if wiz.type == 'make_to_order':
147 if not wiz.po_cft:147 if not wiz.po_cft:
148 raise osv.except_osv(_('Error'), _('The Procurement method should be filled !'))148 raise osv.except_osv(_('Error'), _('The Procurement method should be filled !'))
149 elif wiz.po_cft != 'cft' and not wiz.supplier:149 elif wiz.po_cft != 'cft' and not wiz.supplier_id:
150 raise osv.except_osv(_('Error'), _('You should select a supplier !'))150 raise osv.except_osv(_('Error'), _('You should select a supplier !'))
151151
152 errors = {}152 errors = {}
@@ -159,7 +159,7 @@
159 try:159 try:
160 line_obj.write(cr, uid, [line.id], {'type': wiz.type,160 line_obj.write(cr, uid, [line.id], {'type': wiz.type,
161 'po_cft': wiz.po_cft,161 'po_cft': wiz.po_cft,
162 'supplier': wiz.supplier and wiz.supplier.id or False,162 'supplier': wiz.supplier_id and wiz.supplier_id.id or False,
163 'location_id': wiz.location_id.id and wiz.location_id.id or False},163 'location_id': wiz.location_id.id and wiz.location_id.id or False},
164 context=context)164 context=context)
165 except osv.except_osv, e:165 except osv.except_osv, e:
@@ -227,7 +227,7 @@
227 if l_type == 'make_to_order':227 if l_type == 'make_to_order':
228 return {'value': {'location_id': False}}228 return {'value': {'location_id': False}}
229229
230 res = {'value': {'po_cft': False, 'supplier': False}}230 res = {'value': {'po_cft': False, 'supplier_id': False}}
231 if not context or not context[0] or not context[0][2]:231 if not context or not context[0] or not context[0][2]:
232 return res232 return res
233233
@@ -248,15 +248,15 @@
248 all_line_empty = False248 all_line_empty = False
249249
250 if all_line_empty: # by default, and if all lines has no location, then set by default Stock250 if all_line_empty: # by default, and if all lines has no location, then set by default Stock
251 return {'value': {'po_cft': False, 'supplier': False, 'location_id': stock_loc}}251 return {'value': {'po_cft': False, 'supplier_id': False, 'location_id': stock_loc}}
252 return {'value': {'po_cft': False, 'supplier': False}}252 return {'value': {'po_cft': False, 'supplier_id': False}}
253253
254 def change_po_cft(self, cr, uid, ids, po_cft, context=None):254 def change_po_cft(self, cr, uid, ids, po_cft, context=None):
255 '''255 '''
256 Unset the supplier if tender is choosen256 Unset the supplier if tender is choosen
257 '''257 '''
258 if po_cft == 'cft':258 if po_cft == 'cft':
259 return {'value': {'supplier': False}}259 return {'value': {'supplier_id': False}}
260260
261 return {}261 return {}
262262
@@ -278,16 +278,16 @@
278 }278 }
279 return result279 return result
280280
281 def change_location(self, cr, uid, ids, location_id, context=None):281 def change_location(self, cr, uid, ids, location_id, line_ids, context=None):
282 res = {'value': {}}282 res = {'value': {}}
283 if not location_id:283 if not location_id:
284 return res284 return res
285285
286 if not context or not context[0] or not context[0][2]:286 if not line_ids or not line_ids[0] or not line_ids[0][2]:
287 return res287 return res
288288
289 line_obj = self.pool.get('sale.order.line')289 line_obj = self.pool.get('sale.order.line')
290 active_ids = context[0][2]290 active_ids = line_ids[0][2]
291291
292 context = {}292 context = {}
293 context.update({'from_multiple_line_sourcing': False})293 context.update({'from_multiple_line_sourcing': False})
294294
=== modified file 'sourcing/wizard/multiple_sourcing_view.xml'
--- sourcing/wizard/multiple_sourcing_view.xml 2014-10-09 13:19:51 +0000
+++ sourcing/wizard/multiple_sourcing_view.xml 2015-03-02 20:31:41 +0000
@@ -15,35 +15,24 @@
15 </group>15 </group>
16 <group colspan="4" col="4">16 <group colspan="4" col="4">
17 <separator colspan="4" string="Selected lines to source" />17 <separator colspan="4" string="Selected lines to source" />
18 <field name="line_ids" nolabel="1" colspan="4">18 <field name="line_ids" nolabel="1" colspan="4" />
19 <tree string="Lines to source" hide_new_button="True" noteditable="True">
20 <field name="order_id" string="Order reference" />
21 <field name="line_number" />
22 <field name="product_id" />
23 <field name="product_uom_qty" />
24 <field name="product_uom" />
25 <field name="real_stock" />
26 <field name="available_stock" />
27 <field name="virtual_stock" />
28 </tree>
29 </field>
30 <separator colspan="4" string="Procurement method" />19 <separator colspan="4" string="Procurement method" />
31 <field name="type" 20 <field name="type"
32 on_change="change_type(type, line_ids)"/>21 on_change="change_type(type)"/>
33 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"22 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"
34 on_change="change_po_cft(po_cft)"/>23 on_change="change_po_cft(po_cft)"/>
35 <separator colspan="4" string="Supplier selection" />24 <separator colspan="4" string="Supplier selection" />
36 <field name="supplier"25 <field name="supplier_id"
37 domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft), ('line_contains_fo', '=', line_ids)]"26 domain="[('id', '!=', company_id), ('available_for_dpo', '=', po_cft), ('line_contains_fo', '=', line_ids)]"
38 attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('type', '=', 'make_to_stock')]}"27 attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('type', '=', 'make_to_stock')]}"
39 on_change="change_supplier(supplier)"28 on_change="change_supplier(supplier_id)"
40 />29 />
4130
4231
43 <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False), 32 <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False),
44 ('scrap_location', '=', False), ('destruction_location', '=', False), 33 ('scrap_location', '=', False), ('destruction_location', '=', False),
45 ('output_ok', '=', False), ('input_ok', '=', False)]" 34 ('output_ok', '=', False), ('input_ok', '=', False)]"
46 attrs="{'readonly': [('type', '!=', 'make_to_stock')]}" 35 attrs="{'readonly': [('type', '!=', 'make_to_stock')]}"
47 on_change="change_location(location_id, line_ids)" />36 on_change="change_location(location_id, line_ids)" />
4837
49 </group>38 </group>
@@ -59,8 +48,8 @@
59 <record id="sourcing_line_special_tree_view" model="ir.ui.view">48 <record id="sourcing_line_special_tree_view" model="ir.ui.view">
60 <field name="name">sourcing.line.special.tree.view</field>49 <field name="name">sourcing.line.special.tree.view</field>
61 <field name="model">sale.order.line</field>50 <field name="model">sale.order.line</field>
62 <field name="type">form</field>51 <field name="type">tree</field>
63 <field name="priority" eval="5000" />52 <field name="priority" eval="10" />
64 <field name="arch" type="xml">53 <field name="arch" type="xml">
65 <tree string="Lines to source" hide_new_button="True" noteditable="True">54 <tree string="Lines to source" hide_new_button="True" noteditable="True">
66 <field name="order_id" string="Order reference" />55 <field name="order_id" string="Order reference" />

Subscribers

People subscribed via source and target branches