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

Proposed by jftempo
Status: Merged
Merged at revision: 4973
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-4805
Merge into: lp:unifield-server
Diff against target: 43 lines (+9/-13)
1 file modified
bin/addons/kit/kit.py (+9/-13)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-4805
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+349476@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/kit/kit.py'
2--- bin/addons/kit/kit.py 2017-11-28 17:01:08 +0000
3+++ bin/addons/kit/kit.py 2018-07-13 15:36:41 +0000
4@@ -303,22 +303,18 @@
5
6 for kit in self.browse(cr, uid, ids, context=context):
7
8- def qty_available(id_):
9- request_context = context.copy()
10- request_context.update({ 'states': ('done',),
11- 'what': ('in', 'out'),
12- 'location_usage': ['internal'],
13- 'location_category': ['stock', 'consumption_unit'] })
14- return self.pool.get("product.product").get_product_available(cr, uid, [id_], context=request_context)[id_]
15
16 # For kits with a batch, take the stock of the batch
17 # Otherwise, take the global stock of the product
18- if kit.composition_reference:
19- product_id = kit.composition_product_id.id
20- else:
21- product_id = kit.composition_lot_id.id
22+ request_context = context.copy()
23+ request_context.update({ 'states': ('done',),
24+ 'what': ('in', 'out'),
25+ 'location_usage': ['internal'],
26+ 'location_category': ['stock', 'consumption_unit'] })
27+ if not kit.composition_reference and kit.composition_lot_id:
28+ request_context['prodlot_id'] = kit.composition_lot_id.id
29
30- stock = qty_available(product_id)
31+ stock = self.pool.get("product.product").get_product_available(cr, uid, [kit.composition_product_id.id], context=request_context)[kit.composition_product_id.id]
32
33 if stock <= 0:
34 raise osv.except_osv(_('Error'),
35@@ -1020,7 +1016,7 @@
36 if context.get('composition_type', False) == 'theoretical':
37 # load the xml tree
38 root = etree.fromstring(result['arch'])
39- # get the original empty separator ref and hide it
40+ # get the original empty separator ref and hide it
41 # fields to be modified
42 list = ['//field[@name="item_lot"]', '//field[@name="item_exp"]', '//field[@name="item_asset_id"]']
43 fields = []

Subscribers

People subscribed via source and target branches