Merge lp:~dorian-kemps/unifield-server/US-5761 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5300
Proposed branch: lp:~dorian-kemps/unifield-server/US-5761
Merge into: lp:unifield-server
Diff against target: 72 lines (+13/-12)
3 files modified
bin/addons/specific_rules/report/report_stock_inventory.py (+3/-3)
bin/addons/stock/report/stock_expired_damaged_report.py (+9/-8)
bin/addons/stock_override/stock_view.xml (+1/-1)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5761
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+363622@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/specific_rules/report/report_stock_inventory.py'
2--- bin/addons/specific_rules/report/report_stock_inventory.py 2019-02-25 09:43:25 +0000
3+++ bin/addons/specific_rules/report/report_stock_inventory.py 2019-02-26 09:54:52 +0000
4@@ -403,12 +403,12 @@
5
6 cost_price_at_date = {}
7 if report.stock_level_date and product_ids_to_fetch:
8- self.cr.execute("""select distinct on (product_id) product_id, new_standard_price
9+ self.cr.execute("""select distinct on (product_id) product_id, old_standard_price
10 from standard_price_track_changes
11 where
12 product_id in %s and
13- create_date <= %s
14- order by product_id, create_date desc""", (tuple(product_ids_to_fetch), values['stock_level_date']))
15+ create_date >= %s
16+ order by product_id, create_date asc""", (tuple(product_ids_to_fetch), values['stock_level_date']))
17
18 for x in self.cr.fetchall():
19 cost_price_at_date[x[0]] = x[1]
20
21=== modified file 'bin/addons/stock/report/stock_expired_damaged_report.py'
22--- bin/addons/stock/report/stock_expired_damaged_report.py 2019-02-11 09:51:38 +0000
23+++ bin/addons/stock/report/stock_expired_damaged_report.py 2019-02-26 09:54:52 +0000
24@@ -247,14 +247,16 @@
25 res = []
26
27 for move in move_obj.browse(self.cr, self.uid, self.datas['moves_ids'], context=self.localcontext):
28- price_at_date = False
29- self.cr.execute("""SELECT distinct on (product_id) product_id, new_standard_price
30+ prod_price = False
31+ self.cr.execute("""SELECT distinct on (product_id) product_id, old_standard_price
32 FROM standard_price_track_changes
33- WHERE product_id = %s AND change_date <= %s
34- ORDER BY product_id, change_date desc
35+ WHERE product_id = %s AND change_date >= %s
36+ ORDER BY product_id, change_date asc
37 """, (move.product_id.id, move.date))
38 for x in self.cr.fetchall():
39- price_at_date = x[1]
40+ prod_price = x[1]
41+ if not prod_price:
42+ prod_price = move.product_id.standard_price or move.price_unit
43 res.append({
44 'ref': move.picking_id.name,
45 'reason_type': move.reason_type_id and move.reason_type_id.complete_name or '',
46@@ -265,11 +267,10 @@
47 'qty': move.product_qty,
48 'batch': move.prodlot_id and move.prodlot_id.name or '',
49 'exp_date': move.expired_date,
50- 'unit_price': price_at_date or move.price_unit,
51+ 'unit_price': prod_price,
52 'currency': move.price_currency_id and move.price_currency_id.name or
53 move.product_id.currency_id and move.product_id.currency_id.name or '',
54- 'total_price': price_at_date and move.product_qty * price_at_date or
55- move.product_qty * move.price_unit,
56+ 'total_price': move.product_qty * prod_price,
57 'src_loc': move.location_id and move.location_id.name or '',
58 'dest_loc': move.location_dest_id and move.location_dest_id.name or '',
59 'crea_date': move.picking_id.date,
60
61=== modified file 'bin/addons/stock_override/stock_view.xml'
62--- bin/addons/stock_override/stock_view.xml 2018-11-12 11:26:37 +0000
63+++ bin/addons/stock_override/stock_view.xml 2019-02-26 09:54:52 +0000
64@@ -481,7 +481,7 @@
65 <field name="from_manage_expired" invisible="1" />
66 <!-- <button name="return_to_state" string="Return to initial state" states="import" icon="gtk-execute" type="object" />-->
67 <button name="call_cancel_wizard" states="assigned,confirmed,draft" string="_Cancel" icon="gtk-cancel" type="object" context="{'from_button': True}"/>
68- <button name="draft_force_assign" states="draft,confirmed,assigned" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': ['|', '&amp;', ('state', 'in', ['done', 'cancel', 'import']), ('state', '!=', 'draft'), ('has_draft_moves', '=', False)]}" />
69+ <button name="draft_force_assign" states="draft,confirmed,assigned" string="Confirm" type="object" icon="gtk-apply" attrs="{'invisible': ['|', ('state', 'in', ['done', 'cancel', 'import']), '&amp;', ('state', '!=', 'draft'), ('has_draft_moves', '=', False)]}" />
70 <button name="expired_assign" states="confirmed,assigned" string="Check Expired Products' Availability" type="object" icon="gtk-find" context="{'from_button': True}" attrs="{'invisible': ['|', ('state', 'not in', ['confirmed', 'assigned']), ('from_manage_expired', '=', False)]}" />
71 <button name="check_availability_manually" states="confirmed,assigned" string="Check Availability" type="object" icon="gtk-find" context="{'from_button': True}" attrs="{'invisible': [('from_manage_expired', '=', True)]}"/>
72 <button name="force_assign" states="confirmed,assigned" string="Force Availability" type="object" icon="gtk-jump-to" context="{'from_button': True}" />

Subscribers

People subscribed via source and target branches