Merge lp:~unifield-team/unifield-wm/us-31 into lp:unifield-wm
- us-31
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+251498@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
- 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 | 48 | _inherit = 'sale.order.line' | 48 | _inherit = 'sale.order.line' |
6 | 49 | _description = 'Sales Order Line' | 49 | _description = 'Sales Order Line' |
7 | 50 | 50 | ||
8 | 51 | def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): | ||
9 | 52 | if context is None: | ||
10 | 53 | context = {} | ||
11 | 54 | |||
12 | 55 | ''' | ||
13 | 56 | !!!!! ATTENTION ATTENTION!!!!!! | ||
14 | 57 | UTP-1021: This solution is NOT stable and could be dangerous!!!! | ||
15 | 58 | need to have a proper fix for this, | ||
16 | 59 | currently we have only 3 tree views for sale.order.line | ||
17 | 60 | so I use the value in the context to identify that it is not the | ||
18 | 61 | view of wizard, but this assumption could be totally WRONG! | ||
19 | 62 | But in this current version, it works! | ||
20 | 63 | ''' | ||
21 | 64 | if not context.get('search_default_need_sourcing', False) and \ | ||
22 | 65 | view_type == 'tree': | ||
23 | 66 | if '_terp_view_name' in context: | ||
24 | 67 | ''' | ||
25 | 68 | UFTP-346: HACK ON HACK UTP-1021 | ||
26 | 69 | '_terp_view_name' not set if grouping | ||
27 | 70 | and we do not want special view when grouping | ||
28 | 71 | ''' | ||
29 | 72 | view_id = self.pool.get('ir.model.data').get_object_reference( | ||
30 | 73 | cr, uid, 'sourcing', 'sourcing_line_special_tree_view')[1] | ||
31 | 74 | return super(sale_order_line, self).fields_view_get(cr, uid, view_id, | ||
32 | 75 | view_type, context, toolbar, submenu) | ||
33 | 76 | |||
34 | 77 | """ | 51 | """ |
35 | 78 | Other methods | 52 | Other methods |
36 | 79 | """ | 53 | """ |
37 | 80 | 54 | ||
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 | 53 | 'stock.location', | 53 | 'stock.location', |
43 | 54 | string='Location', | 54 | string='Location', |
44 | 55 | ), | 55 | ), |
46 | 56 | 'supplier': fields.many2one( | 56 | 'supplier_id': fields.many2one( |
47 | 57 | 'res.partner', | 57 | 'res.partner', |
48 | 58 | string='Supplier', | 58 | string='Supplier', |
49 | 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.", |
50 | @@ -124,7 +124,7 @@ | |||
51 | 124 | if loc != -1: | 124 | if loc != -1: |
52 | 125 | res['location_id'] = loc | 125 | res['location_id'] = loc |
53 | 126 | if supplier != -1: | 126 | if supplier != -1: |
55 | 127 | res['supplier'] = supplier | 127 | res['supplier_id'] = supplier |
56 | 128 | 128 | ||
57 | 129 | if not res['line_ids']: | 129 | if not res['line_ids']: |
58 | 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')) |
59 | @@ -146,7 +146,7 @@ | |||
60 | 146 | if wiz.type == 'make_to_order': | 146 | if wiz.type == 'make_to_order': |
61 | 147 | if not wiz.po_cft: | 147 | if not wiz.po_cft: |
62 | 148 | raise osv.except_osv(_('Error'), _('The Procurement method should be filled !')) | 148 | raise osv.except_osv(_('Error'), _('The Procurement method should be filled !')) |
64 | 149 | elif wiz.po_cft != 'cft' and not wiz.supplier: | 149 | elif wiz.po_cft != 'cft' and not wiz.supplier_id: |
65 | 150 | raise osv.except_osv(_('Error'), _('You should select a supplier !')) | 150 | raise osv.except_osv(_('Error'), _('You should select a supplier !')) |
66 | 151 | 151 | ||
67 | 152 | errors = {} | 152 | errors = {} |
68 | @@ -159,7 +159,7 @@ | |||
69 | 159 | try: | 159 | try: |
70 | 160 | line_obj.write(cr, uid, [line.id], {'type': wiz.type, | 160 | line_obj.write(cr, uid, [line.id], {'type': wiz.type, |
71 | 161 | 'po_cft': wiz.po_cft, | 161 | 'po_cft': wiz.po_cft, |
73 | 162 | 'supplier': wiz.supplier and wiz.supplier.id or False, | 162 | 'supplier': wiz.supplier_id and wiz.supplier_id.id or False, |
74 | 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}, |
75 | 164 | context=context) | 164 | context=context) |
76 | 165 | except osv.except_osv, e: | 165 | except osv.except_osv, e: |
77 | @@ -227,7 +227,7 @@ | |||
78 | 227 | if l_type == 'make_to_order': | 227 | if l_type == 'make_to_order': |
79 | 228 | return {'value': {'location_id': False}} | 228 | return {'value': {'location_id': False}} |
80 | 229 | 229 | ||
82 | 230 | res = {'value': {'po_cft': False, 'supplier': False}} | 230 | res = {'value': {'po_cft': False, 'supplier_id': False}} |
83 | 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]: |
84 | 232 | return res | 232 | return res |
85 | 233 | 233 | ||
86 | @@ -248,15 +248,15 @@ | |||
87 | 248 | all_line_empty = False | 248 | all_line_empty = False |
88 | 249 | 249 | ||
89 | 250 | if all_line_empty: # by default, and if all lines has no location, then set by default Stock | 250 | if all_line_empty: # by default, and if all lines has no location, then set by default Stock |
92 | 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}} |
93 | 252 | return {'value': {'po_cft': False, 'supplier': False}} | 252 | return {'value': {'po_cft': False, 'supplier_id': False}} |
94 | 253 | 253 | ||
95 | 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): |
96 | 255 | ''' | 255 | ''' |
97 | 256 | Unset the supplier if tender is choosen | 256 | Unset the supplier if tender is choosen |
98 | 257 | ''' | 257 | ''' |
99 | 258 | if po_cft == 'cft': | 258 | if po_cft == 'cft': |
101 | 259 | return {'value': {'supplier': False}} | 259 | return {'value': {'supplier_id': False}} |
102 | 260 | 260 | ||
103 | 261 | return {} | 261 | return {} |
104 | 262 | 262 | ||
105 | @@ -278,16 +278,16 @@ | |||
106 | 278 | } | 278 | } |
107 | 279 | return result | 279 | return result |
108 | 280 | 280 | ||
110 | 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): |
111 | 282 | res = {'value': {}} | 282 | res = {'value': {}} |
112 | 283 | if not location_id: | 283 | if not location_id: |
113 | 284 | return res | 284 | return res |
114 | 285 | 285 | ||
116 | 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]: |
117 | 287 | return res | 287 | return res |
118 | 288 | 288 | ||
119 | 289 | line_obj = self.pool.get('sale.order.line') | 289 | line_obj = self.pool.get('sale.order.line') |
121 | 290 | active_ids = context[0][2] | 290 | active_ids = line_ids[0][2] |
122 | 291 | 291 | ||
123 | 292 | context = {} | 292 | context = {} |
124 | 293 | context.update({'from_multiple_line_sourcing': False}) | 293 | context.update({'from_multiple_line_sourcing': False}) |
125 | 294 | 294 | ||
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 | 15 | </group> | 15 | </group> |
131 | 16 | <group colspan="4" col="4"> | 16 | <group colspan="4" col="4"> |
132 | 17 | <separator colspan="4" string="Selected lines to source" /> | 17 | <separator colspan="4" string="Selected lines to source" /> |
145 | 18 | <field name="line_ids" nolabel="1" colspan="4"> | 18 | <field name="line_ids" nolabel="1" colspan="4" /> |
134 | 19 | <tree string="Lines to source" hide_new_button="True" noteditable="True"> | ||
135 | 20 | <field name="order_id" string="Order reference" /> | ||
136 | 21 | <field name="line_number" /> | ||
137 | 22 | <field name="product_id" /> | ||
138 | 23 | <field name="product_uom_qty" /> | ||
139 | 24 | <field name="product_uom" /> | ||
140 | 25 | <field name="real_stock" /> | ||
141 | 26 | <field name="available_stock" /> | ||
142 | 27 | <field name="virtual_stock" /> | ||
143 | 28 | </tree> | ||
144 | 29 | </field> | ||
146 | 30 | <separator colspan="4" string="Procurement method" /> | 19 | <separator colspan="4" string="Procurement method" /> |
147 | 31 | <field name="type" | 20 | <field name="type" |
149 | 32 | on_change="change_type(type, line_ids)"/> | 21 | on_change="change_type(type)"/> |
150 | 33 | <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}" | 22 | <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}" |
151 | 34 | on_change="change_po_cft(po_cft)"/> | 23 | on_change="change_po_cft(po_cft)"/> |
152 | 35 | <separator colspan="4" string="Supplier selection" /> | 24 | <separator colspan="4" string="Supplier selection" /> |
154 | 36 | <field name="supplier" | 25 | <field name="supplier_id" |
155 | 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)]" |
156 | 38 | attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('type', '=', 'make_to_stock')]}" | 27 | attrs="{'readonly': ['|', ('po_cft', '=', 'cft'), ('type', '=', 'make_to_stock')]}" |
158 | 39 | on_change="change_supplier(supplier)" | 28 | on_change="change_supplier(supplier_id)" |
159 | 40 | /> | 29 | /> |
160 | 41 | 30 | ||
161 | 42 | 31 | ||
162 | 43 | <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False), | 32 | <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False), |
163 | 44 | ('scrap_location', '=', False), ('destruction_location', '=', False), | 33 | ('scrap_location', '=', False), ('destruction_location', '=', False), |
164 | 45 | ('output_ok', '=', False), ('input_ok', '=', False)]" | 34 | ('output_ok', '=', False), ('input_ok', '=', False)]" |
166 | 46 | attrs="{'readonly': [('type', '!=', 'make_to_stock')]}" | 35 | attrs="{'readonly': [('type', '!=', 'make_to_stock')]}" |
167 | 47 | on_change="change_location(location_id, line_ids)" /> | 36 | on_change="change_location(location_id, line_ids)" /> |
168 | 48 | 37 | ||
169 | 49 | </group> | 38 | </group> |
170 | @@ -59,8 +48,8 @@ | |||
171 | 59 | <record id="sourcing_line_special_tree_view" model="ir.ui.view"> | 48 | <record id="sourcing_line_special_tree_view" model="ir.ui.view"> |
172 | 60 | <field name="name">sourcing.line.special.tree.view</field> | 49 | <field name="name">sourcing.line.special.tree.view</field> |
173 | 61 | <field name="model">sale.order.line</field> | 50 | <field name="model">sale.order.line</field> |
176 | 62 | <field name="type">form</field> | 51 | <field name="type">tree</field> |
177 | 63 | <field name="priority" eval="5000" /> | 52 | <field name="priority" eval="10" /> |
178 | 64 | <field name="arch" type="xml"> | 53 | <field name="arch" type="xml"> |
179 | 65 | <tree string="Lines to source" hide_new_button="True" noteditable="True"> | 54 | <tree string="Lines to source" hide_new_button="True" noteditable="True"> |
180 | 66 | <field name="order_id" string="Order reference" /> | 55 | <field name="order_id" string="Order reference" /> |