Merge lp:~sandi-dirntis/openerpsl/openerpsl_20140326_2 into lp:openerpsl/7.0

Proposed by Aleksander Dirntiš
Status: Merged
Merged at revision: 375
Proposed branch: lp:~sandi-dirntis/openerpsl/openerpsl_20140326_2
Merge into: lp:openerpsl/7.0
Diff against target: 34 lines (+6/-5)
1 file modified
purchase_recalculation/product_product.py (+6/-5)
To merge this branch: bzr merge lp:~sandi-dirntis/openerpsl/openerpsl_20140326_2
Reviewer Review Type Date Requested Status
Mentis Pending
Review via email: mp+212841@code.launchpad.net

Description of the change

[FIX] Bug fixes

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 'purchase_recalculation/product_product.py'
2--- purchase_recalculation/product_product.py 2014-03-26 08:11:13 +0000
3+++ purchase_recalculation/product_product.py 2014-03-26 13:19:26 +0000
4@@ -45,9 +45,10 @@
5 if _move_line.product_id.id == ids[0]:
6 _stock = _stock + _move_line.product_qty
7 _acc_move_line_id = self.pool.get('account.move.line').search(cr, uid, [('stock_move_id','=',_move_line.id)], limit=1)
8- _acc_move_line = self.pool.get('account.move.line').browse(cr, uid, _acc_move_line_id[0], context)
9- if _acc_move_line:
10- _cost = _acc_move_line.debit + _acc_move_line.credit
11+ if len(_acc_move_line_id) <> 0:
12+ _acc_move_line = self.pool.get('account.move.line').browse(cr, uid, _acc_move_line_id[0], context)
13+ if _acc_move_line:
14+ _cost = _acc_move_line.debit + _acc_move_line.credit
15 return [_stock, _cost]
16
17 def _get_stock_and_cost(self, cr, uid, ids, dates, context):
18@@ -86,14 +87,14 @@
19 ' FROM stock_move AS sm \n' \
20 ' WHERE sm.product_id = {product} \n' \
21 ' AND sm.date >= \'{date_from}\' \n' \
22- ' AND sm.date <= \'{date_to}\' \n' \
23+ ' AND sm.date < \'{date_to}\' \n' \
24 ' AND sm.state = \'done\' \n' \
25 ' AND NOT EXISTS (SELECT inv.move_id \n' \
26 ' FROM stock_inventory_move_rel AS inv \n' \
27 ' WHERE inv.move_id = sm.id) \n ' \
28 'ORDER BY sm.date'.format(product = ids[0],
29 date_from = _date_from,
30- date_to = _period.date_stop + ' 23:59:59').replace(',)', ')')
31+ date_to = _date_to).replace(',)', ')')
32 cr.execute(_sql_string)
33 _move_tups = cr.fetchall()
34 _move_ids = []

Subscribers

People subscribed via source and target branches