Merge lp:~unifield-team/unifield-wm/us-422-453 into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/us-422-453
Merge into: lp:unifield-wm
Diff against target: 69 lines (+46/-2)
2 files modified
product_list/product_list.py (+32/-1)
sale_override/sale.py (+14/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-422-453
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+267146@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2573. By Quentin THEURET @Amaris

US-422 [FIX] Bad statement

2572. By Quentin THEURET @Amaris

Merge US-453 :: lp:~unifield-team/unifield-wm/us-453

2571. By Quentin THEURET @Amaris

Merge US-422 :: lp:~unifield-team/unifield-wm/us-422

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product_list/product_list.py'
2--- product_list/product_list.py 2015-04-13 07:16:11 +0000
3+++ product_list/product_list.py 2015-08-06 07:06:03 +0000
4@@ -273,7 +273,38 @@
5 ('default_code', "unique(default_code)", 'The "Product Code" must be unique'),
6 ('xmlid_code', "unique(xmlid_code)", 'The xmlid_code must be unique'),
7 ]
8-
9+
10+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
11+ """
12+ Customize the search() method to include the search of products in a specific list
13+ """
14+ pl_obj = self.pool.get('product.list')
15+ pll_obj = self.pool.get('product.list.line')
16+
17+ iargs = -1
18+ for a in args:
19+ iargs += 1
20+ if a[0] == 'sublist':
21+ prd_domain = set()
22+ pl_ids = pl_obj.search(cr, uid, [
23+ ('name', a[1], a[2])
24+ ], context=context)
25+ pll_ids = pll_obj.search(cr, uid, [
26+ ('list_id', 'in', pl_ids),
27+ ], context=context)
28+ for line in pll_obj.browse(cr, uid, pll_ids, context=context):
29+ prd_domain.add(line.name.id)
30+
31+ del args[iargs]
32+ args.append(('id', 'in', list(prd_domain)))
33+
34+ # In case of no list found or no line in lists, empty list
35+ if not prd_domain:
36+ return []
37+
38+ return super(product_product, self).search(cr, uid, args, offset, limit, order, context, count)
39+
40+
41 def write(self, cr, uid, ids, value, context=None):
42 single = False
43 if isinstance(ids, (long, int)):
44
45=== modified file 'sale_override/sale.py'
46--- sale_override/sale.py 2015-06-03 10:24:22 +0000
47+++ sale_override/sale.py 2015-08-06 07:06:03 +0000
48@@ -2614,7 +2614,20 @@
49 '''
50 context = context is None and {} or context
51
52- if not context.get('noraise') and not context.get('import_in_progress'):
53+ if context.get('button') in ['button_remove_lines', 'check_lines_to_fix', 'add_multiple_lines', 'wizard_import_ir_lines']:
54+ return True
55+
56+ btns = [
57+ 'button_remove_lines',
58+ 'check_lines_to_fix',
59+ 'add_multiple_lines',
60+ 'wizard_import_ir_lines',
61+ ]
62+ cond1 = context.get('button') not in btns
63+ cond2 = not context.get('noraise')
64+ cond3 = not context.get('import_in_progress')
65+
66+ if cond1 and cond2 and cond3:
67 empty_lines = False
68 if ids and not 'product_uom_qty' in vals:
69 empty_lines = self.search(cr, uid, [

Subscribers

People subscribed via source and target branches