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

Proposed by jftempo
Status: Merged
Merged at revision: 5351
Proposed branch: lp:~dorian-kemps/unifield-server/US-5728
Merge into: lp:unifield-server
Diff against target: 77 lines (+23/-15)
2 files modified
bin/addons/msf_doc_import/check_line.py (+19/-12)
bin/addons/msf_doc_import/wizard/wizard_import_po_line.py (+4/-3)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-5728
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+365335@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/msf_doc_import/check_line.py'
2--- bin/addons/msf_doc_import/check_line.py 2018-12-11 11:31:10 +0000
3+++ bin/addons/msf_doc_import/check_line.py 2019-05-09 10:21:20 +0000
4@@ -448,22 +448,29 @@
5 # with warning_list: the line does not appear in red, it is just informative
6 warning_list = kwargs['to_write']['warning_list']
7 price = kwargs['price'] or 'Price'
8+ is_rfq = kwargs['is_rfq']
9 price_unit_defined = False
10 cell_nb = kwargs.get('cell_nb', 3)
11 try:
12- if not row.cells[cell_nb] or not row.cells[cell_nb].data:
13- if default_code:
14- warning_list.append(_('The Price Unit was not set, we have taken the default "%s" of the product.') % price)
15+ if is_rfq:
16+ if row.cells[cell_nb].type in ['int', 'float']:
17+ price_unit_defined = True
18+ price_unit = row.cells[cell_nb].data
19+ cost_price = row.cells[cell_nb].data
20+ else:
21+ if not row.cells[cell_nb] or not row.cells[cell_nb].data:
22+ if default_code:
23+ warning_list.append(_('The Price Unit was not set, we have taken the default "%s" of the product.') % price)
24+ else:
25+ error_list.append(_('The Price and Product were not found.'))
26+ elif row.cells[cell_nb].type not in ['int', 'float'] and not default_code:
27+ error_list.append(_('The Price Unit was not a number and no product was found.'))
28+ elif row.cells[cell_nb].type in ['int', 'float']:
29+ price_unit_defined = True
30+ price_unit = row.cells[cell_nb].data
31+ cost_price = row.cells[cell_nb].data
32 else:
33- error_list.append(_('The Price and Product were not found.'))
34- elif row.cells[cell_nb].type not in ['int', 'float'] and not default_code:
35- error_list.append(_('The Price Unit was not a number and no product was found.'))
36- elif row.cells[cell_nb].type in ['int', 'float']:
37- price_unit_defined = True
38- price_unit = row.cells[cell_nb].data
39- cost_price = row.cells[cell_nb].data
40- else:
41- error_list.append(_('The Price Unit was not defined properly.'))
42+ error_list.append(_('The Price Unit was not defined properly.'))
43 # if nothing is found at the line index (empty cell)
44 except IndexError:
45 if default_code:
46
47=== modified file 'bin/addons/msf_doc_import/wizard/wizard_import_po_line.py'
48--- bin/addons/msf_doc_import/wizard/wizard_import_po_line.py 2017-12-08 16:17:02 +0000
49+++ bin/addons/msf_doc_import/wizard/wizard_import_po_line.py 2019-05-09 10:21:20 +0000
50@@ -101,7 +101,7 @@
51 error_log, message = '', ''
52 header_index = context['header_index']
53 template_col_count = len(header_index)
54- is_rfq = wiz.po_id.rfq_ok and wiz.po_id.state == 'rfq_sent'
55+ is_rfq = wiz.po_id.rfq_ok
56 mandatory_col_count = 9 if is_rfq else 7
57
58 file_obj = SpreadsheetXML(xmlstring=base64.decodestring(wiz.file))
59@@ -237,7 +237,8 @@
60
61 # Cell 4: Price
62 price_value = check_line.compute_price_value(
63- row=row, to_write=to_write, cell_nb=header_index[_('Price')], price='Cost Price', context=context)
64+ row=row, to_write=to_write, cell_nb=header_index[_('Price')], price='Cost Price',
65+ is_rfq=is_rfq, context=context)
66 to_write.update(
67 price_unit=price_value['price_unit'],
68 error_list=price_value['error_list'],
69@@ -449,7 +450,7 @@
70 cr, uid, ids, first_row, error_list=[], line_num=0, context=context)
71 context.update({'po_id': po_id, 'header_index': header_index})
72 rfq = purchase_obj.read(cr, uid, po_id, ['state', 'rfq_ok'], context=context)
73- is_rfq = rfq['rfq_ok'] and rfq['state'] == 'rfq_sent'
74+ is_rfq = rfq['rfq_ok']
75 res, res1 = wiz_common_import.check_header_values(
76 cr, uid, ids, context, header_index, is_rfq and columns_for_po_line_import + [_('Delivery confirmed date')] \
77 or columns_for_po_line_import[1:], origin='PO')

Subscribers

People subscribed via source and target branches