Merge lp:~unifield-team/unifield-server/us-3478 into lp:~jfb-tempo-consulting/unifield-server/partial
- us-3478
- Merge into partial
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 4665 |
Proposed branch: | lp:~unifield-team/unifield-server/us-3478 |
Merge into: | lp:~jfb-tempo-consulting/unifield-server/partial |
Diff against target: |
375 lines (+123/-14) 15 files modified
bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv (+1/-1) bin/addons/procurement_request/procurement_request.py (+23/-0) bin/addons/procurement_request/procurement_request_view.xml (+1/-0) bin/addons/purchase/purchase_line.py (+32/-4) bin/addons/purchase/purchase_view.xml (+11/-1) bin/addons/purchase/purchase_workflow.py (+19/-0) bin/addons/purchase_override/purchase.py (+0/-1) bin/addons/purchase_override/wizard/split_order_line.py (+1/-1) bin/addons/sale/sale_order.py (+5/-0) bin/addons/sale/sale_view.xml (+1/-0) bin/addons/sale/sale_workflow.py (+5/-2) bin/addons/sale/wizard/split_order_line.py (+1/-1) bin/addons/sourcing/procurement_order.py (+4/-0) bin/addons/sourcing/sale_order_line.py (+18/-2) bin/addons/sync_so/purchase.py (+1/-1) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-server/us-3478 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
jftempo | Pending | ||
Review via email: mp+331725@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv' |
2 | --- bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2017-09-14 08:41:12 +0000 |
3 | +++ bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2017-10-03 16:52:18 +0000 |
4 | @@ -6,7 +6,7 @@ |
5 | msf_sync_data_server.fo_updates_po_ref,TRUE,TRUE,"['name','state','client_order_ref']","['&','&','&',('partner_type','!=','external'),('client_order_ref','!=',False),('split_type_sale_order','=','original_sale_order'),'!',('client_order_ref', 'like', 'invalid_by_recovery')]",partner_id,MISSION,purchase.order.update_fo_ref,sale.order,FO updates PO ref,9,Valid |
6 | msf_sync_data_server.update_in_ref,TRUE,TRUE,"['name','shipment_ref']","['&',('shipment_ref','!=',False),'!',('shipment_ref', 'like', 'invalid_by_recovery')]",partner_id,MISSION,stock.picking.update_in_ref,stock.picking,IN updates ref to OUT SHIP,10,Valid |
7 | msf_sync_data_server.pol_create_sol,TRUE,TRUE,"['sync_local_id', 'order_id/name','product_id/id', 'product_id/name', 'name', 'state', 'product_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','is_line_split','date_planned', 'stock_take_date']","[('sync_linked_sol', '=', False), ('order_id.partner_type', 'not in',['external','esc']), ('state', 'in', ['validated', 'confirmed', 'done']), ('order_id.state', 'not in', ['draft', 'cancel'])]",partner_id,MISSION,sale.order.line.create_so_line,purchase.order.line,PO line creates FO line,11,Valid |
8 | -msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,Valid |
9 | +msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok', 'modification_comment']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,Valid |
10 | msf_sync_data_server.partial_shipped_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/usage', 'move_lines/comment']","['&','&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['standard', 'packing']), ('state', '=', 'done'), ('already_shipped', '=', True), ('do_not_sync', '=', False), ('claim', '=', False)]",partner_id,MISSION,stock.picking.partial_shipped_fo_updates_in_po,stock.picking,Partial shipped at Coordo updates IN at Project,19,Valid |
11 | msf_sync_data_server.moves_from_dpo_closed_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'subtype', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/dpo_line_id', 'move_lines/comment']","['&', '&', '&', ('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['picking', 'standard']), ('dpo_out', '=', True)]",partner_id,MISSION,stock.picking.partial_shippped_dpo_updates_in_po,stock.picking,Moves from DPO closed at Coordo updates IN at Project,20,Valid |
12 | msf_sync_data_server.dpo_service_lines_update_in_at_project,FALSE,TRUE,"['order_id/name', 'order_id/delivery_confirmed_date', 'sync_local_id', 'origin', 'confirmed_delivery_date', 'name', 'product_uom/id', 'product_uom/name', 'link_sol_id/line_number', 'notes', 'product_qty', 'product_id/name', 'product_id/id', 'comment']","[('dest_partner_id.partner_type', '=', 'internal'), ('order_id.order_type', '=', 'direct'), ('order_id.state', 'in', ['approved', 'done']), ('product_id.type', 'in', ['service', 'service_recep'])]",dest_partner_id,MISSION,purchase.order.line.confirmed_dpo_service_lines_update_in_po,purchase.order.line,DPO service lines update IN at Project,21,Valid |
13 | |
14 | === modified file 'bin/addons/procurement_request/procurement_request.py' |
15 | --- bin/addons/procurement_request/procurement_request.py 2017-09-14 08:41:12 +0000 |
16 | +++ bin/addons/procurement_request/procurement_request.py 2017-10-03 16:52:18 +0000 |
17 | @@ -684,6 +684,25 @@ |
18 | res[pol['id']] = False |
19 | return res |
20 | |
21 | + def _check_changed(self, cr, uid, ids, name, arg, context=None): |
22 | + ''' |
23 | + Check if an original value has been changed |
24 | + ''' |
25 | + if context is None: |
26 | + context = {} |
27 | + res = {} |
28 | + |
29 | + for line in self.browse(cr, uid, ids, context=context): |
30 | + changed = False |
31 | + if line.modification_comment or (line.original_qty and line.original_price and line.original_uom): |
32 | + if line.modification_comment or line.product_uom_qty != line.original_qty \ |
33 | + or line.price_unit != line.original_price or line.product_uom != line.original_uom: |
34 | + changed = True |
35 | + |
36 | + res[line.id] = changed |
37 | + |
38 | + return res |
39 | + |
40 | _columns = { |
41 | 'cost_price': fields.float(string='Cost price', digits_compute=dp.get_precision('Sale Price Computation')), |
42 | 'procurement_request': fields.boolean(string='Internal Request', readonly=True), |
43 | @@ -696,6 +715,10 @@ |
44 | 'product_id_ok': fields.function(_get_product_id_ok, type="boolean", method=True, string='Product defined?', help='for if true the button "configurator" is hidden'), |
45 | 'product_ok': fields.boolean('Product selected'), |
46 | 'comment_ok': fields.boolean('Comment written'), |
47 | + 'original_qty': fields.float('Original Qty'), |
48 | + 'original_price': fields.float('Original Price'), |
49 | + 'original_uom': fields.many2one('product.uom', 'Original UOM'), |
50 | + 'original_changed': fields.function(_check_changed, method=True, string='Changed', type='boolean'), |
51 | } |
52 | |
53 | def _get_planned_date(self, cr, uid, c=None): |
54 | |
55 | === modified file 'bin/addons/procurement_request/procurement_request_view.xml' |
56 | --- bin/addons/procurement_request/procurement_request_view.xml 2017-10-02 12:27:20 +0000 |
57 | +++ bin/addons/procurement_request/procurement_request_view.xml 2017-10-03 16:52:18 +0000 |
58 | @@ -90,6 +90,7 @@ |
59 | attrs="{'invisible': ['|', ('product_id_ok', '=', True), ('state', 'not in', ['draft', 'draft_p', 'validated', 'validated_p'])]}" |
60 | icon="terp-go-week" /> |
61 | <field name="product_uom_qty" on_change="onchange_uom(product_id, product_uom, product_uom_qty)" /> |
62 | + <field name="original_changed" readonly="1"/> |
63 | <field name="price_unit"/> |
64 | <field name="notes" /> |
65 | <field name="display_resourced_orig_line" /> |
66 | |
67 | === modified file 'bin/addons/purchase/purchase_line.py' |
68 | --- bin/addons/purchase/purchase_line.py 2017-10-02 07:09:09 +0000 |
69 | +++ bin/addons/purchase/purchase_line.py 2017-10-03 16:52:18 +0000 |
70 | @@ -203,6 +203,29 @@ |
71 | |
72 | return res |
73 | |
74 | + def _check_changed(self, cr, uid, ids, name, arg, context=None): |
75 | + ''' |
76 | + Check if an original value has been changed |
77 | + ''' |
78 | + if context is None: |
79 | + context = {} |
80 | + res = {} |
81 | + |
82 | + for line in self.browse(cr, uid, ids, context=context): |
83 | + changed = False |
84 | + if line.modification_comment\ |
85 | + or (line.original_qty and line.original_price and line.original_uom and line.original_currency_id): |
86 | + if line.modification_comment or line.product_qty != line.original_qty \ |
87 | + or line.price_unit != line.original_price or line.product_uom != line.original_uom\ |
88 | + or line.currency_id != line.original_currency_id: |
89 | + changed = True |
90 | + elif line.original_qty and line.original_uom and not line.original_price: # From IR |
91 | + if line.original_qty != line.product_qty or line.original_uom.id != line.product_uom.id: |
92 | + changed = True |
93 | + |
94 | + res[line.id] = changed |
95 | + |
96 | + return res |
97 | |
98 | _columns = { |
99 | 'set_as_sourced_n': fields.boolean(string='Set as Sourced-n', help='Line has been created further and has to be created back in preceding documents'), |
100 | @@ -288,6 +311,12 @@ |
101 | 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner", store=True), |
102 | 'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date"), |
103 | 'stock_take_date': fields.date(string='Date of Stock Take', required=False), |
104 | + 'original_qty': fields.float('Original Qty'), |
105 | + 'original_price': fields.float('Original Price'), |
106 | + 'original_uom': fields.many2one('product.uom', 'Original UOM'), |
107 | + 'original_currency_id': fields.many2one('res.currency', 'Original Currency'), |
108 | + 'modification_comment': fields.char('Modification Comment', size=1024), |
109 | + 'original_changed': fields.function(_check_changed, method=True, string='Changed', type='boolean'), |
110 | } |
111 | _defaults = { |
112 | 'set_as_sourced_n': lambda *a: False, |
113 | @@ -896,11 +925,10 @@ |
114 | default = {} |
115 | |
116 | default.update({'state': 'draft', 'move_ids': [], 'invoiced': 0, 'invoice_lines': []}) |
117 | - if 'origin' not in default: |
118 | - default.update({'origin': False}) |
119 | |
120 | - if 'move_dest_id' not in default: |
121 | - default.update({'move_dest_id': False}) |
122 | + for field in ['origin', 'move_dest_id', 'original_qty', 'original_price', 'original_uom', 'original_currency_id', 'modification_comment']: |
123 | + if field not in default: |
124 | + default[field]= False |
125 | |
126 | default.update({'sync_order_line_db_id': False, 'set_as_sourced_n': False, 'set_as_validated_n': False, 'linked_sol_id': False}) |
127 | return super(purchase_order_line, self).copy_data(cr, uid, p_id, default=default, context=context) |
128 | |
129 | === modified file 'bin/addons/purchase/purchase_view.xml' |
130 | --- bin/addons/purchase/purchase_view.xml 2017-10-02 12:27:20 +0000 |
131 | +++ bin/addons/purchase/purchase_view.xml 2017-10-03 16:52:18 +0000 |
132 | @@ -205,6 +205,7 @@ |
133 | <field name="date_planned"/> |
134 | <field name="name"/> |
135 | <field name="product_qty"/> |
136 | + <field name="original_changed" readonly="1"/> |
137 | <field name="product_uom"/> |
138 | <field name="price_unit"/> |
139 | <field name="price_subtotal"/> |
140 | @@ -539,8 +540,17 @@ |
141 | <label string=" " /> |
142 | <field name="account_4_distribution" invisible="1"/> |
143 | </group> |
144 | + <group colspan="4"> |
145 | + <group colspan="2"> |
146 | + <field name="original_qty" colspan="1" readonly="1"/> |
147 | + <field name="original_price" colspan="1" readonly="1"/> |
148 | + <field name="original_uom" colspan="1" readonly="1"/> |
149 | + <field name="original_currency_id" colspan="1" readonly="1"/> |
150 | + </group> |
151 | + <field name="modification_comment" colspan="2"/> |
152 | + </group> |
153 | <field name="vat_ok" invisible="1" /> |
154 | - <group colspan="4" col="4" groups="base.group_extended" attrs="{'invisible': [('vat_ok', '=', False)]}"> |
155 | + <group colspan="4" col="4" attrs="{'invisible': [('vat_ok', '=', False)]}"> |
156 | <separator colspan="4" string="Taxes"/> |
157 | <field colspan="4" nolabel="1" name="taxes_id" |
158 | domain="[('parent_id','=',False),('type_tax_use','!=','sale')]"/> |
159 | |
160 | === modified file 'bin/addons/purchase/purchase_workflow.py' |
161 | --- bin/addons/purchase/purchase_workflow.py 2017-10-02 07:11:25 +0000 |
162 | +++ bin/addons/purchase/purchase_workflow.py 2017-10-03 16:52:18 +0000 |
163 | @@ -107,6 +107,11 @@ |
164 | 'sync_sourced_origin': pol.instance_sync_order_ref and pol.instance_sync_order_ref.name or False, |
165 | 'type': 'make_to_order', |
166 | } |
167 | + |
168 | + # update modification comment if it is set |
169 | + if pol.modification_comment: |
170 | + sol_values['modification_comment'] = pol.modification_comment |
171 | + |
172 | if create_line: |
173 | sol_values.update({ |
174 | 'order_id': so_id, |
175 | @@ -284,6 +289,20 @@ |
176 | po_to_check[pol.order_id.id] = True |
177 | if pol.linked_sol_id: |
178 | wf_service.trg_validate(uid, 'sale.order.line', pol.linked_sol_id.id, 'sourced_v', cr) |
179 | + # update original qty, unit price, uom and currency on line level |
180 | + # doesn't update original qty and uom if already set (from IR) |
181 | + line_update = { |
182 | + 'original_price': pol.price_unit, |
183 | + 'original_currency_id': pol.currency_id.id |
184 | + } |
185 | + if not pol.original_qty: |
186 | + line_update['original_qty'] = pol.product_qty |
187 | + |
188 | + if not pol.original_uom: |
189 | + line_update['original_uom'] = pol.product_uom.id |
190 | + |
191 | + self.write(cr, uid, pol.id, line_update, context=context) |
192 | + |
193 | |
194 | if po_to_check: |
195 | self.pool.get('purchase.order').check_if_stock_take_date_with_esc_partner(cr, uid, po_to_check.keys(), context=context) |
196 | |
197 | === modified file 'bin/addons/purchase_override/purchase.py' |
198 | --- bin/addons/purchase_override/purchase.py 2017-09-14 08:41:12 +0000 |
199 | +++ bin/addons/purchase_override/purchase.py 2017-10-03 16:52:18 +0000 |
200 | @@ -159,7 +159,6 @@ |
201 | |
202 | purchase_order_merged_line() |
203 | |
204 | - |
205 | class purchase_order_group(osv.osv_memory): |
206 | _name = "purchase.order.group" |
207 | _inherit = "purchase.order.group" |
208 | |
209 | === modified file 'bin/addons/purchase_override/wizard/split_order_line.py' |
210 | --- bin/addons/purchase_override/wizard/split_order_line.py 2017-08-29 12:55:18 +0000 |
211 | +++ bin/addons/purchase_override/wizard/split_order_line.py 2017-10-03 16:52:18 +0000 |
212 | @@ -51,7 +51,7 @@ |
213 | |
214 | _columns = { |
215 | 'purchase_line_id': fields.many2one('purchase.order.line', string='Line Id', readonly=True), |
216 | - 'original_qty': fields.float(digits=(16,2), string='Original Quantity', readonly=True), |
217 | + 'original_qty': fields.float(string='Original Quantity', readonly=True), |
218 | 'old_line_qty': fields.float(digits=(16,2), string='Old line quantity', readonly=True), |
219 | 'new_line_qty': fields.float(digits=(16,2), string='New line quantity', required=True), |
220 | 'impact_so_split_po_line_wizard': fields.boolean('Impact Field Order', help='Impact corresponding Field Order by creating a corresponding Field Order line.'), |
221 | |
222 | === modified file 'bin/addons/sale/sale_order.py' |
223 | --- bin/addons/sale/sale_order.py 2017-10-02 12:27:20 +0000 |
224 | +++ bin/addons/sale/sale_order.py 2017-10-03 16:52:18 +0000 |
225 | @@ -1936,6 +1936,7 @@ |
226 | 'vat_ok': fields.function(_get_vat_ok, method=True, type='boolean', string='VAT OK', store=False, readonly=True), |
227 | 'soq_updated': fields.boolean(string='SoQ updated', readonly=True), |
228 | 'set_as_sourced_n': fields.boolean(string='Sourced-n line', help='Line created in a further PO, so we have to create it back in the flow'), # used for wkf transition |
229 | + 'modification_comment': fields.char('Modification Comment', size=1024), |
230 | } |
231 | _order = 'sequence, id desc' |
232 | _defaults = { |
233 | @@ -2060,6 +2061,10 @@ |
234 | 'set_as_sourced_n': False, |
235 | }) |
236 | |
237 | + for x in ['modification_comment', 'original_qty', 'original_price', 'original_uom']: |
238 | + if x not in default: |
239 | + default[x] = False |
240 | + |
241 | return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) |
242 | |
243 | def product_id_change_orig(self, cr, uid, ids, pricelist, product, qty=0, |
244 | |
245 | === modified file 'bin/addons/sale/sale_view.xml' |
246 | --- bin/addons/sale/sale_view.xml 2017-10-02 17:36:43 +0000 |
247 | +++ bin/addons/sale/sale_view.xml 2017-10-03 16:52:18 +0000 |
248 | @@ -179,6 +179,7 @@ |
249 | <field name="type" groups="base.group_extended"/> |
250 | <field name="delay" groups="base.group_extended"/> |
251 | <field name="display_resourced_orig_line"/> |
252 | + <field name="modification_comment"/> |
253 | <newline/> |
254 | <separator colspan="5" string="Taxes"/> |
255 | <field colspan="4" name="tax_id" nolabel="1" domain="[('parent_id','=',False),('type_tax_use','<>','purchase')]"/> |
256 | |
257 | === modified file 'bin/addons/sale/sale_workflow.py' |
258 | --- bin/addons/sale/sale_workflow.py 2017-09-29 11:06:54 +0000 |
259 | +++ bin/addons/sale/sale_workflow.py 2017-10-03 16:52:18 +0000 |
260 | @@ -327,8 +327,11 @@ |
261 | if sol.order_id.order_type in ['loan', 'donation_st', 'donation_exp'] and sol.type != 'make_to_stock': |
262 | to_write['type'] = 'make_to_stock' |
263 | |
264 | - elif sol.procurement_request: # in case of IR |
265 | - pass #TODO |
266 | + elif sol.procurement_request: # in case of IR |
267 | + to_write['original_qty'] = sol.product_uom_qty |
268 | + to_write['original_price'] = sol.price_unit |
269 | + to_write['original_uom'] = sol.product_uom.id |
270 | + # pass #TODO |
271 | |
272 | if to_write: |
273 | self.write(cr, uid, sol.id, to_write, context=context) |
274 | |
275 | === modified file 'bin/addons/sale/wizard/split_order_line.py' |
276 | --- bin/addons/sale/wizard/split_order_line.py 2017-09-05 12:48:12 +0000 |
277 | +++ bin/addons/sale/wizard/split_order_line.py 2017-10-03 16:52:18 +0000 |
278 | @@ -32,7 +32,7 @@ |
279 | |
280 | _columns = { |
281 | 'sale_line_id': fields.many2one('sale.order.line', string='Line Id', readonly=True), |
282 | - 'original_qty': fields.float(digits=(16,2), string='Original Quantity', readonly=True), |
283 | + 'original_qty': fields.float(string='Original Quantity', readonly=True), |
284 | 'old_line_qty': fields.float(digits=(16,2), string='Old line quantity', readonly=True), |
285 | 'new_line_qty': fields.float(digits=(16,2), string='New line quantity', required=True), |
286 | } |
287 | |
288 | === removed directory 'bin/addons/sale_override' |
289 | === removed directory 'bin/addons/sale_override/wizard' |
290 | === modified file 'bin/addons/sourcing/procurement_order.py' |
291 | --- bin/addons/sourcing/procurement_order.py 2017-08-03 15:16:40 +0000 |
292 | +++ bin/addons/sourcing/procurement_order.py 2017-10-03 16:52:18 +0000 |
293 | @@ -114,6 +114,10 @@ |
294 | line.update({'origin': origin_line.order_id.name}) |
295 | if origin_line.stock_take_date: |
296 | line.update({'stock_take_date': origin_line.stock_take_date}) |
297 | + if origin_line.original_qty: |
298 | + line.update({'original_qty': origin_line.original_qty}) |
299 | + if origin_line.original_uom: |
300 | + line.update({'original_uom': origin_line.original_uom.id}) |
301 | else: |
302 | # Update the link to the original FO to create new line on it at PO confirmation |
303 | procurement = kwargs['procurement'] |
304 | |
305 | === modified file 'bin/addons/sourcing/sale_order_line.py' |
306 | --- bin/addons/sourcing/sale_order_line.py 2017-09-25 08:50:10 +0000 |
307 | +++ bin/addons/sourcing/sale_order_line.py 2017-10-03 16:52:18 +0000 |
308 | @@ -1617,6 +1617,11 @@ |
309 | 'analytic_distribution_id': anal_dist, |
310 | 'link_so_id': sourcing_line.order_id.id, |
311 | } |
312 | + if sourcing_line.procurement_request: |
313 | + pol_values.update({ |
314 | + 'original_qty': sourcing_line.original_qty, |
315 | + 'original_uom': sourcing_line.original_uom.id, |
316 | + }) |
317 | self.pool.get('purchase.order.line').create(cr, uid, pol_values, context=context) |
318 | self.pool.get('purchase.order').write(cr, uid, po_to_use, {'dest_partner_ids': [(4, sourcing_line.order_id.partner_id.id, 0)]}, context=context) |
319 | |
320 | @@ -1645,6 +1650,11 @@ |
321 | 'analytic_distribution_id': anal_dist, |
322 | 'link_so_id': sourcing_line.order_id.id, |
323 | } |
324 | + if sourcing_line.procurement_request: |
325 | + rfq_line_values.update({ |
326 | + 'original_qty': sourcing_line.original_qty, |
327 | + 'original_uom': sourcing_line.original_uom.id, |
328 | + }) |
329 | self.pool.get('purchase.order.line').create(cr, uid, rfq_line_values, context=context) |
330 | |
331 | elif sourcing_line.po_cft == 'cft': |
332 | @@ -1658,7 +1668,7 @@ |
333 | # attach tender line: |
334 | proc_location_id = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'procurement')], context=context) |
335 | proc_location_id = proc_location_id[0] if proc_location_id else False |
336 | - self.pool.get('tender.line').create(cr, uid, { |
337 | + tender_values = { |
338 | 'product_id': sourcing_line.product_id.id, |
339 | 'comment': sourcing_line.comment, |
340 | 'qty': sourcing_line.product_uom_qty, |
341 | @@ -1666,7 +1676,13 @@ |
342 | 'tender_id': tender_to_use, |
343 | 'sale_order_line_id': sourcing_line.id, |
344 | 'location_id': proc_location_id, |
345 | - }, context=context) |
346 | + } |
347 | + if sourcing_line.procurement_request: |
348 | + tender_values.update({ |
349 | + 'original_qty': sourcing_line.original_qty, |
350 | + 'original_uom': sourcing_line.original_uom.id, |
351 | + }) |
352 | + self.pool.get('tender.line').create(cr, uid, tender_values, context=context) |
353 | |
354 | wf_service.trg_validate(uid, 'sale.order.line', sourcing_line.id, 'sourced', cr) |
355 | |
356 | |
357 | === modified file 'bin/addons/sync_so/purchase.py' |
358 | --- bin/addons/sync_so/purchase.py 2017-09-20 15:04:19 +0000 |
359 | +++ bin/addons/sync_so/purchase.py 2017-10-03 16:52:18 +0000 |
360 | @@ -74,6 +74,7 @@ |
361 | order_name = sol_dict['order_id']['name'] |
362 | pol_values['order_id'] = po_ids[0] |
363 | pol_values['sync_linked_sol'] = sol_dict['sync_local_id'] |
364 | + pol_values['modification_comment'] = sol_dict.get('modification_comment', False) |
365 | if 'line_number' in pol_values: |
366 | del(pol_values['line_number']) |
367 | |
368 | @@ -210,7 +211,6 @@ |
369 | ondelete='cascade', |
370 | ), |
371 | 'original_qty': fields.float( |
372 | - digits=(16,2), |
373 | string='Original qty', |
374 | required=False, |
375 | readonly=True, |