Merge lp:~jfb-tempo-consulting/unifield-server/US-3235-unit_price into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4875
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-3235-unit_price
Merge into: lp:unifield-server
Diff against target: 80 lines (+18/-7)
3 files modified
bin/addons/delivery_mechanism/delivery_mechanism.py (+6/-7)
bin/addons/msf_profile/data/patches.xml (+3/-0)
bin/addons/msf_profile/msf_profile.py (+9/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-3235-unit_price
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+343412@code.launchpad.net
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/delivery_mechanism/delivery_mechanism.py'
2--- bin/addons/delivery_mechanism/delivery_mechanism.py 2018-02-08 09:19:55 +0000
3+++ bin/addons/delivery_mechanism/delivery_mechanism.py 2018-04-17 09:12:21 +0000
4@@ -1015,10 +1015,9 @@
5 values = self._get_values_from_line(cr, uid, move, line, db_data_dict, context=context)
6 if not values.get('product_qty', 0.00):
7 continue
8-
9 # Check if we must re-compute the price of the product
10- compute_average = picking_dict['type'] == 'in' and line.product_id.cost_method
11- if values.get('location_dest_id', False):
12+ compute_average = not sync_in and picking_dict['type'] == 'in' and line.product_id.cost_method
13+ if not sync_in and values.get('location_dest_id', False):
14 compute_average = picking_dict['type'] == 'in' and line.product_id.cost_method == 'average'
15
16 if compute_average:
17@@ -1196,7 +1195,7 @@
18 # If there is remaining quantity for the move, put the ID of the move
19 # and the remaining quantity to list of moves to put in backorder
20 if diff_qty > 0.00 and move.state != 'cancel':
21- backordered_moves.append((move, diff_qty, average_values, data_back, move_sptc_values))
22+ backordered_moves.append((move, diff_qty, average_values, data_back, move_sptc_values, line.product_id.id))
23 if not sync_in:
24 # decrement qty of linked INTernal move:
25 internal_move = self.pool.get('stock.move').search(cr, uid, [('linked_incoming_move', '=', move.id)], context=context)
26@@ -1206,7 +1205,7 @@
27 for sptc_values in move_sptc_values:
28 # track change that will be created:
29 track_changes_to_create.append({
30- 'product_id': move.product_id.id,
31+ 'product_id': line.product_id.id,
32 'transaction_name': _('Reception %s') % move.picking_id.name,
33 'sptc_values': sptc_values.copy(),
34 })
35@@ -1269,9 +1268,9 @@
36 if back_order_post_copy_vals:
37 self.write(cr, uid, backorder_id, back_order_post_copy_vals, context=context)
38
39- for bo_move, bo_qty, av_values, data_back, move_sptc_values in backordered_moves:
40+ for bo_move, bo_qty, av_values, data_back, move_sptc_values, p_id in backordered_moves:
41 for sptc_values in move_sptc_values:
42- sptc_obj.track_change(cr, uid, move.product_id.id,
43+ sptc_obj.track_change(cr, uid, p_id,
44 _('Reception %s') % backorder_name,
45 sptc_values, context=context)
46 if bo_move.product_qty != bo_qty:
47
48=== modified file 'bin/addons/msf_profile/data/patches.xml'
49--- bin/addons/msf_profile/data/patches.xml 2018-04-03 08:08:50 +0000
50+++ bin/addons/msf_profile/data/patches.xml 2018-04-17 09:12:21 +0000
51@@ -1,6 +1,9 @@
52 <?xml version="1.0" encoding="utf-8" ?>
53 <openerp>
54 <data>
55+ <record id="us_3319_product_track_price" model="patch.scripts">
56+ <field name="method">us_3319_product_track_price</field>
57+ </record>
58 <!-- UF8.1 -->
59 <record id="us-4454" model="patch.scripts">
60 <field name="method">cancel_extra_empty_draft_po</field>
61
62=== modified file 'bin/addons/msf_profile/msf_profile.py'
63--- bin/addons/msf_profile/msf_profile.py 2018-04-09 08:22:12 +0000
64+++ bin/addons/msf_profile/msf_profile.py 2018-04-17 09:12:21 +0000
65@@ -51,6 +51,15 @@
66 'model': lambda *a: 'patch.scripts',
67 }
68
69+ def us_3319_product_track_price(self, cr, uid, *a, **b):
70+ cr.execute('select count(*) from standard_price_track_changes')
71+ num = cr.fetchone()
72+ if num and num[0]:
73+ cr.execute("""insert into standard_price_track_changes ( create_uid, create_date, old_standard_price, new_standard_price, user_id, product_id, change_date, transaction_name)
74+ select 1, NOW(), t.standard_price, t.standard_price, 1, p.id, date_trunc('second', now()::timestamp), 'Price corrected' from product_product p, product_template t where p.product_tmpl_id=t.id and t.cost_method='average'
75+ """)
76+
77+ return True
78 # UF8.1
79 def cancel_extra_empty_draft_po(self, cr, uid, *a, **b):
80 rule_obj = self.pool.get('sync.client.message_rule')

Subscribers

People subscribed via source and target branches