Merge lp:~unifield-team/unifield-server/us-635-475-1168 into lp:unifield-server

Proposed by Quentin THEURET @Amaris
Status: Rejected
Rejected by: jftempo
Proposed branch: lp:~unifield-team/unifield-server/us-635-475-1168
Merge into: lp:unifield-server
Diff against target: 1929 lines (+789/-154)
25 files modified
bin/addons/msf_custom_settings/view/purchase_view.xml (+2/-0)
bin/addons/msf_doc_import/purchase_order.py (+26/-4)
bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako (+5/-1)
bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako (+14/-8)
bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml (+2/-0)
bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py (+68/-38)
bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml (+2/-0)
bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py (+143/-46)
bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml (+3/-1)
bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py (+3/-1)
bin/addons/msf_profile/data/patches.xml (+4/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+202/-22)
bin/addons/msf_profile/msf_profile.py (+20/-0)
bin/addons/msf_supply_doc_export/msf_supply_doc_export.py (+34/-0)
bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako (+3/-1)
bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako (+1/-0)
bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako (+80/-2)
bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako (+20/-0)
bin/addons/purchase_override/purchase.py (+108/-5)
bin/addons/purchase_override/purchase_view.xml (+2/-0)
bin/addons/purchase_override/report/merged_order.rml (+8/-7)
bin/addons/purchase_override/report/purchase_order.rml (+22/-9)
bin/addons/purchase_override/report/rfq.rml (+9/-8)
bin/addons/res_currency_functional/order_line_view.xml (+2/-1)
bin/addons/sourcing/procurement_order.py (+6/-0)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-635-475-1168
Reviewer Review Type Date Requested Status
Quentin THEURET @Amaris Pending
Review via email: mp+309026@code.launchpad.net
To post a comment you must log in.
3992. By Quentin THEURET @Amaris

US-635 [IMP] Create a patch.script to update old POs

3993. By Quentin THEURET @Amaris

 US-1168 [FIX] Make error message more explicit when imported line have both line no. and ext. ref

3994. By Quentin THEURET @Amaris

US-635 [IMP] Improve patch.script to update old POs

3995. By Quentin THEURET @Amaris

US-1168 [IMP] Manage translations

3996. By Quentin THEURET @Amaris

US-4745 [IMP] Manage translations

3997. By Quentin THEURET @Amaris

US-635 [IMP] Manage translations

3998. By Quentin THEURET @Amaris

US-635 [FIX] Purchase order: A split PO line shouldn't be count as a line in the number of lines for a PO

3999. By Quentin THEURET @Amaris

US-1168 [FIX] IN simulation screen report: Display both line number and external ref of lines

4000. By Quentin THEURET @Amaris

US-635 [IMP] Purchase order: Number of lines is computed by the number of distinct line number in a same order

4001. By Quentin THEURET @Amaris

US-635 [FIX] Fix NameErro: global name 'pol_obj' is not defined

4002. By Quentin THEURET @Amaris

US-1168 [FIX] IN simulation screen Excel report: Don't display '0' if there is no Ext. Ref. for a line

4003. By Quentin THEURET @Amaris

US-1168 [FIX] Incoming shipment simulation report: Don't display two times the line number

4004. By Quentin THEURET @Amaris

Merge latest trunk

4005. By Quentin THEURET @Amaris

US-1168 [FIX] Delete all lines with same number if one line is marked as [DELETE]

4006. By Quentin THEURET @Amaris

US-635 [FIX] FIx issue when open a PO line that have no sale order line attached

4007. By Quentin THEURET @Amaris

US-635 [FIX] FIx issue when open a PO line that have no sale order line attached

4008. By Quentin THEURET @Amaris

US-635 [FIX] Display the magnifying glasses next to the good field on PO line form view

Unmerged revisions

4008. By Quentin THEURET @Amaris

US-635 [FIX] Display the magnifying glasses next to the good field on PO line form view

4007. By Quentin THEURET @Amaris

US-635 [FIX] FIx issue when open a PO line that have no sale order line attached

4006. By Quentin THEURET @Amaris

US-635 [FIX] FIx issue when open a PO line that have no sale order line attached

4005. By Quentin THEURET @Amaris

US-1168 [FIX] Delete all lines with same number if one line is marked as [DELETE]

4004. By Quentin THEURET @Amaris

Merge latest trunk

4003. By Quentin THEURET @Amaris

US-1168 [FIX] Incoming shipment simulation report: Don't display two times the line number

4002. By Quentin THEURET @Amaris

US-1168 [FIX] IN simulation screen Excel report: Don't display '0' if there is no Ext. Ref. for a line

4001. By Quentin THEURET @Amaris

US-635 [FIX] Fix NameErro: global name 'pol_obj' is not defined

4000. By Quentin THEURET @Amaris

US-635 [IMP] Purchase order: Number of lines is computed by the number of distinct line number in a same order

3999. By Quentin THEURET @Amaris

US-1168 [FIX] IN simulation screen report: Display both line number and external ref of lines

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_custom_settings/view/purchase_view.xml'
2--- bin/addons/msf_custom_settings/view/purchase_view.xml 2016-04-19 08:57:07 +0000
3+++ bin/addons/msf_custom_settings/view/purchase_view.xml 2016-10-28 15:13:51 +0000
4@@ -40,6 +40,8 @@
5 <field name="partner_address_id" attrs="{'readonly': [('state', 'in', ['sourced', 'split', 'rfq_sent', 'rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>
6 <field name="origin" attrs="{'readonly': [('state', 'in', ['sourced', 'split', 'rfq_sent', 'rfq_updated', 'done', 'cancel', 'confirmed', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}" widget="char"/>
7 <field name="internal_type" string="Zone" />
8+ <field name="customer_ref" widget="char" />
9+ <label colspan="2"></label>
10 <field name="pricelist_id" string="Currency" domain="[('type', '=', 'purchase'), ('in_search', '=', partner_type)]"
11 colspan="3" attrs="{'readonly': [('state', 'in', ['rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>
12 </group>
13
14=== modified file 'bin/addons/msf_doc_import/purchase_order.py'
15--- bin/addons/msf_doc_import/purchase_order.py 2016-08-18 08:32:03 +0000
16+++ bin/addons/msf_doc_import/purchase_order.py 2016-10-28 15:13:51 +0000
17@@ -160,6 +160,7 @@
18 for l in self.pool.get('purchase.order').browse(cr, uid, ids[0], context=context).order_line:
19 export_line_obj.create(cr, uid, {'po_line_id': l.id,
20 'in_line_number': l.line_number,
21+ 'in_ext_ref': l.external_ref,
22 'simu_id': export_id}, context=context)
23
24 return {'type': 'ir.actions.act_window',
25@@ -219,8 +220,10 @@
26 if isinstance(ids, (int, long)):
27 ids = [ids]
28
29- datas = {}
30- datas['ids'] = ids
31+ datas = {
32+ 'ids': ids,
33+ 'need_ad': context.get('need_ad', True),
34+ }
35 file_name = self.export_get_file_name(cr, uid, ids, prefix='POV',
36 context=context)
37 if file_name:
38@@ -244,8 +247,10 @@
39 if isinstance(ids, (int, long)):
40 ids = [ids]
41
42- datas = {}
43- datas['ids'] = ids
44+ datas = {
45+ 'ids': ids,
46+ 'need_ad': context.get('need_ad', True),
47+ }
48 file_name = self.export_get_file_name(cr, uid, ids, prefix='POV',
49 context=context)
50 if file_name:
51@@ -493,21 +498,38 @@
52
53 _columns = {
54 'order_id': fields.many2one('purchase.order', string='Purchase Order', required=True),
55+ 'need_ad': fields.selection(
56+ selection=[
57+ ('yes', 'Yes'),
58+ ('no', 'No'),
59+ ],
60+ string='Export AD',
61+ required=True,
62+ ),
63 'file_type': fields.selection([('excel', 'Excel file'),
64 ('xml', 'XML file')], string='File type', required=True),
65 }
66
67+ _defaults = {
68+ 'need_ad': 'yes',
69+ }
70+
71 def export_file(self, cr, uid, ids, context=None):
72 '''
73 Launch the good method to download the good file
74 '''
75 order_obj = self.pool.get('purchase.order')
76
77+ if context is None:
78+ context = {}
79+
80 if isinstance(ids, (int, long)):
81 ids = [ids]
82
83 wiz = self.browse(cr, uid, ids[0], context=context)
84
85+ context['need_ad'] = wiz.need_ad == 'yes'
86+
87 if wiz.file_type == 'xml':
88 return order_obj.export_xml_po_integration(cr, uid, wiz.order_id.id, context=context)
89 else:
90
91=== modified file 'bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako'
92--- bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako 2014-12-17 12:51:27 +0000
93+++ bin/addons/msf_doc_import/report/in_simulation_screen_xls_report.mako 2016-10-28 15:13:51 +0000
94@@ -152,6 +152,7 @@
95 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Price Unit')}</Data></Cell>
96 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Curr.')}</Data></Cell>
97 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line')}</Data></Cell>
98+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Ref')}</Data></Cell>
99 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('CHG')}</Data></Cell>
100 <Cell ss:StyleID="header" ><Data ss:Type="String"></Data></Cell>
101 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product')}</Data></Cell>
102@@ -174,6 +175,7 @@
103 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.move_price_unit or 0.00)|x}</Data></Cell>
104 <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.move_currency_id.name or '')|x}</Data></Cell>
105 <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.line_number or '')|x}</Data></Cell>
106+ <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.external_ref or '')|x}</Data></Cell>
107 % if l.type_change == 'error':
108 <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell>
109 <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'integrity_status') or '')|x}</Data></Cell>
110@@ -234,7 +236,9 @@
111 <Row></Row>
112
113 <Row>
114- <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Information')}</Data></Cell>
115+ <Cell ss:StyleID="header" MergeAcross="3"><Data ss:Type="String">${_('Information')}</Data></Cell>
116+ </Row>
117+ <Row>
118 <Cell ss:StyleID="line" MergeAcross="3" ><Data ss:Type="String">${(o.message or '')|x}</Data></Cell>
119 </Row>
120
121
122=== modified file 'bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako'
123--- bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako 2014-12-17 12:51:27 +0000
124+++ bin/addons/msf_doc_import/report/po_simulation_screen_xls_report.mako 2016-10-28 15:13:51 +0000
125@@ -268,43 +268,49 @@
126 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.in_price or 0.00)|x}</Data></Cell>
127 <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.in_currency and obj_name_get('res.currency', l.in_currency.id) or '')|x}</Data></Cell>
128 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.in_line_number)|x}</Data></Cell>
129- <Cell ss:StyleID="line" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell>
130- % if l.in_product_id != l.imp_product_id:
131+ % if l.type_change == 'del':
132+ <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell>
133+ % else:
134+ <Cell ss:StyleID="line" ><Data ss:Type="String">${(getSel(l, 'type_change') or '')|x}</Data></Cell>
135+ % endif
136+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_product_id != l.imp_product_id):
137 <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(l.imp_product_id and obj_name_get('product.product', l.imp_product_id.id) or '')|x}</Data></Cell>
138 % else:
139 <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.imp_product_id and obj_name_get('product.product', l.imp_product_id.id) or '')|x}</Data></Cell>
140 % endif
141- % if l.in_qty != l.imp_qty:
142+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_qty != l.imp_qty):
143 <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_qty or 0.00)|x}</Data></Cell>
144 % else:
145 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_qty or 0.00)|x}</Data></Cell>
146 % endif
147- % if l.in_price != l.imp_price:
148+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_price != l.imp_price):
149 <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_price or 0.00)|x}</Data></Cell>
150 % else:
151 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_price or 0.00)|x}</Data></Cell>
152 % endif
153- % if l.imp_discrepancy != 0.00:
154+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.imp_discrepancy != 0.00):
155 <Cell ss:StyleID="line_change" ><Data ss:Type="Number">${(l.imp_discrepancy or 0.00)|x}</Data></Cell>
156 % else:
157 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(l.imp_discrepancy or 0.00)|x}</Data></Cell>
158 % endif
159- % if l.in_currency != l.imp_currency:
160+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or l.in_currency != l.imp_currency):
161 <Cell ss:StyleID="line_change" ><Data ss:Type="String">${(l.imp_currency and obj_name_get('res.currency', l.imp_currency.id) or '')|x}</Data></Cell>
162 % else:
163 <Cell ss:StyleID="line" ><Data ss:Type="String">${(l.imp_currency and obj_name_get('res.currency', l.imp_currency.id) or '')|x}</Data></Cell>
164 % endif
165- % if l.in_drd != l.imp_drd and l.imp_drd not in ('False', False):
166+ % if not l.type_change == 'ignore' and (l.type_change == 'del' or (l.in_drd != l.imp_drd and l.imp_drd not in ('False', False))):
167 <Cell ss:StyleID="line_change_short_date" ><Data ss:Type="DateTime">${(l.imp_drd)|n}T00:00:00.000</Data></Cell>
168 % elif l.imp_drd not in ('False', False):
169 <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${(l.imp_drd)|n}T00:00:00.000</Data></Cell>
170 % else:
171 <Cell ss:StyleID="line" ></Cell>
172 % endif
173- % if l.in_dcd != l.imp_dcd and l.imp_dcd not in ('False', False):
174+ % if not l.type_change == 'ignore' and ((l.type_change == 'del' or l.in_dcd != l.imp_dcd) and l.imp_dcd not in ('False', False)):
175 <Cell ss:StyleID="line_change_short_date" ><Data ss:Type="DateTime">${(l.imp_dcd)|n}T00:00:00.000</Data></Cell>
176 % elif l.imp_dcd not in ('False', False):
177 <Cell ss:StyleID="short_date" ><Data ss:Type="DateTime">${(l.imp_dcd)|n}T00:00:00.000</Data></Cell>
178+ % elif l.type_change == 'del':
179+ <Cell ss:StyleID="line_change"></Cell>
180 % else:
181 <Cell ss:StyleID="line" ></Cell>
182 % endif
183
184=== modified file 'bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml'
185--- bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml 2016-05-26 08:58:45 +0000
186+++ bin/addons/msf_doc_import/view/purchase_order_import_line_view.xml 2016-10-28 15:13:51 +0000
187@@ -139,6 +139,8 @@
188 <form string="Export PO validated">
189 <separator colspan="4" string="File format" />
190 <field name="file_type" />
191+ <newline />
192+ <field name="need_ad" colspan="2" invisible="1" />
193 <separator colspan="4" string="Actions" />
194 <group colspan="4" col="4">
195 <label> </label>
196
197=== modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py'
198--- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-08-23 12:54:03 +0000
199+++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen.py 2016-10-28 15:13:51 +0000
200@@ -40,7 +40,7 @@
201 # Server imports
202 # Addons imports
203 NB_OF_HEADER_LINES = 7
204-NB_LINES_COLUMNS = 12
205+NB_LINES_COLUMNS = 13
206
207
208 PRODUCT_CODE_ID = {}
209@@ -49,20 +49,22 @@
210 PRODLOT_NAME_ID = {}
211
212 SIMU_LINES = {}
213+LN_BY_EXT_REF = {}
214
215
216 LINES_COLUMNS = [(0, _('Line number'), 'optionnal'),
217- (1, _('Product Code'), 'mandatory'),
218- (2, _('Product Description'), 'optionnal'),
219- (3, _('Product Qty'), 'mandatory'),
220- (4, _('Product UoM'), 'mandatory'),
221- (5, _('Price Unit'), 'mandatory'),
222- (6, _('Currency'), 'mandatory'),
223- (7, _('Batch'), 'optionnal'),
224- (8, _('Expiry Date'), 'optionnal'),
225- (9, _('Packing List'), 'optionnal'),
226- (10, _('ESC message 1'), 'optionnal'),
227- (11, _('ESC message 2'), 'optionnal'),
228+ (1, _('External Ref.'), 'optionnal'),
229+ (2, _('Product Code'), 'mandatory'),
230+ (3, _('Product Description'), 'optionnal'),
231+ (4, _('Product Qty'), 'mandatory'),
232+ (5, _('Product UoM'), 'mandatory'),
233+ (6, _('Price Unit'), 'mandatory'),
234+ (7, _('Currency'), 'mandatory'),
235+ (8, _('Batch'), 'optionnal'),
236+ (9, _('Expiry Date'), 'optionnal'),
237+ (10, _('Packing List'), 'optionnal'),
238+ (11, _('ESC message 1'), 'optionnal'),
239+ (12, _('ESC message 2'), 'optionnal'),
240 ]
241
242 HEADER_COLUMNS = [(1, _('Freight'), 'optionnal'),
243@@ -326,7 +328,7 @@
244 index = get_field_index(field, index)
245 else:
246 index += 1
247- values[index] = ['line_number', 'product_code',
248+ values[index] = ['line_number', 'external_ref', 'product_code',
249 'product_name', 'product_qty',
250 'uom_id', 'price_unit', 'currency_id',
251 'prodlot_id', 'expiry_date',
252@@ -390,6 +392,7 @@
253 global CURRENCY_NAME_ID
254 global PRODLOT_NAME_ID
255 global SIMU_LINES
256+ global LN_BY_EXT_REF
257
258 if context is None:
259 context = {}
260@@ -419,6 +422,7 @@
261 First of all, we build a cache for simulation screen lines
262 '''
263 l_num = line.line_number
264+ l_ext_ref = line.external_ref
265 l_prod = line.move_product_id and line.move_product_id.id or False
266 l_uom = line.move_uom_id and line.move_uom_id.id or False
267 # By simulation screen
268@@ -441,6 +445,11 @@
269 SIMU_LINES[wiz.id][l_num][l_prod][l_uom].setdefault(line.move_product_qty, [])
270 SIMU_LINES[wiz.id][l_num][l_prod][l_uom][line.move_product_qty].append(line.id)
271
272+ LN_BY_EXT_REF.setdefault(wiz.id, {})
273+ if l_ext_ref and l_num:
274+ LN_BY_EXT_REF[wiz.id].setdefault(l_ext_ref, [])
275+ LN_BY_EXT_REF[wiz.id][l_ext_ref].append(l_num)
276+
277 # Variables
278 lines_to_ignored = [] # Bad formatting lines
279 file_format_errors = []
280@@ -543,6 +552,9 @@
281 # Check mandatory fields
282 not_ok = False
283 file_line_error = []
284+ line_number = values.get(x, [False])[0] and int(values.get(x, [False])[0]) or False
285+ ext_ref = values.get(x, [False, False])[1]
286+ ext_ref = ext_ref and str(ext_ref) or False
287 for manda_field in LINES_COLUMNS:
288 if manda_field[2] == 'mandatory' and not values.get(x, [])[manda_field[0]]:
289 not_ok = True
290@@ -551,10 +563,16 @@
291 values_line_errors.append(err)
292 file_line_error.append(err1)
293
294- if not values.get(x, [''])[0]:
295- line_number = False
296- else:
297- line_number = int(values.get(x, [''])[0])
298+ if line_number and ext_ref:
299+ if line_number not in LN_BY_EXT_REF[wiz.id].get(ext_ref, []):
300+ not_ok = True
301+ err1 = _('No line found for line number \'%s\' and ext. ref. \'%s\' - Line not imported') % (line_number, ext_ref)
302+ err = _('Line %s of the file: %s') % (x, err1)
303+ values_line_errors.append(err)
304+ file_line_error.append(err1)
305+
306+ if not line_number and ext_ref:
307+ line_number = LN_BY_EXT_REF[wiz.id].get(ext_ref, [False])[0]
308
309 if not_ok:
310 not_ok_file_lines[x] = ' - '.join(err for err in file_line_error)
311@@ -566,47 +584,47 @@
312
313 vals = values.get(x, [])
314 # Product
315- if vals[1]:
316- product_id = PRODUCT_CODE_ID.get(vals[1], False)
317- if not product_id and vals[1]:
318- prod_ids = prod_obj.search(cr, uid, [('default_code', '=', vals[1])], context=context)
319+ if vals[2]:
320+ product_id = PRODUCT_CODE_ID.get(vals[2], False)
321+ if not product_id and vals[2]:
322+ prod_ids = prod_obj.search(cr, uid, [('default_code', '=', vals[2])], context=context)
323 if prod_ids:
324 product_id = prod_ids[0]
325- PRODUCT_CODE_ID.setdefault(vals[1], product_id)
326+ PRODUCT_CODE_ID.setdefault(vals[2], product_id)
327
328 # UoM
329- if vals[4]:
330- uom_id = UOM_NAME_ID.get(vals[4], False)
331+ if vals[5]:
332+ uom_id = UOM_NAME_ID.get(vals[5], False)
333 if not uom_id:
334- uom_ids = uom_obj.search(cr, uid, [('name', '=', vals[4])], context=context)
335+ uom_ids = uom_obj.search(cr, uid, [('name', '=', vals[5])], context=context)
336 if uom_ids:
337 uom_id = uom_ids[0]
338- UOM_NAME_ID.setdefault(vals[4], uom_id)
339+ UOM_NAME_ID.setdefault(vals[5], uom_id)
340
341 # Qty
342- if vals[3]:
343- qty = float(vals[3])
344+ if vals[4]:
345+ qty = float(vals[4])
346
347 # Batch and expiry date
348 # Put the batch + expiry date in a cache to create
349 # the batch that don't exist only during the import
350 # not at simulation time
351- if vals[7] and vals[8]:
352- exp_value = vals[8]
353- if type(vals[8]) == type(DateTime.now()):
354+ if vals[8] and vals[9]:
355+ exp_value = vals[9]
356+ if type(vals[9]) == type(DateTime.now()):
357 exp_value = exp_value.strftime('%Y-%m-%d')
358- elif vals[8] and isinstance(vals[8], str):
359+ elif vals[9] and isinstance(vals[9], str):
360 try:
361- time.strptime(vals[8], '%Y-%m-%d')
362- exp_value = vals[8]
363+ time.strptime(vals[9], '%Y-%m-%d')
364+ exp_value = vals[9]
365 except ValueError:
366 exp_value = False
367
368- if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[7])):
369+ if exp_value and not prodlot_cache.get(product_id, {}).get(str(vals[8])):
370 prodlot_cache.setdefault(product_id, {})
371- prodlot_cache[product_id].setdefault(str(vals[7]), exp_value)
372+ prodlot_cache[product_id].setdefault(str(vals[8]), exp_value)
373
374- file_lines[x] = (line_number, product_id, uom_id, qty)
375+ file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref)
376
377 '''
378 Get the best matching line:
379@@ -956,6 +974,7 @@
380 'str_line_number': fields.function(_get_l_num, method=True, type='char', size=32,
381 string='Line', readonly=True, multi='line_num',
382 store={'wizard.import.in.line.simulation.screen': (lambda self, cr, uid, ids, c={}: ids, ['line_number'], 20)}),
383+ 'external_ref': fields.char(size=256, string='External Ref.', readonly=True),
384 'type_change': fields.selection([('', ''),
385 ('split', 'Split'),
386 ('error', 'Error'),
387@@ -978,6 +997,7 @@
388 'imp_batch_name': fields.char(size=128, string='Batch Number', readonly=True),
389 'imp_exp_date': fields.date(string='Expiry date', readonly=True),
390 'imp_packing_list': fields.char(size=256, string='Packing list', readonly=True),
391+ 'imp_external_ref': fields.char(size=256, string='External ref.', readonly=True),
392 'message_esc1': fields.char(size=256, string='Message ESC 1', readonly=True),
393 'message_esc2': fields.char(size=256, string='Message ESC 2', readonly=True),
394 # Computed fields
395@@ -1060,9 +1080,16 @@
396 errors = []
397 warnings = []
398
399+ if len(values) == 13:
400+ ext_ref = values.pop(1)
401+ values.append(ext_ref)
402+
403 for line in self.browse(cr, uid, ids, context=context):
404 write_vals = {}
405
406+ if ext_ref:
407+ write_vals['imp_external_ref'] = ext_ref
408+
409 # Product
410 prod_id = False
411 if (values[1] and values[1] == line.move_product_id.default_code):
412@@ -1256,7 +1283,10 @@
413
414 if line.type_change == 'new':
415 write_vals['type_change'] = 'error'
416- errors.append(_('Line does not correspond to original IN'))
417+ if write_vals.get('imp_external_ref'):
418+ errors.append(_('No original IN lines with external ref \'%s\' found.') % write_vals['imp_external_ref'])
419+ else:
420+ errors.append(_('Line does not correspond to original IN'))
421
422 error_msg = line.error_msg or ''
423 for err in errors:
424
425=== modified file 'bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml'
426--- bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml 2016-03-17 08:37:36 +0000
427+++ bin/addons/msf_doc_import/wizard/wizard_in_simulation_screen_view.xml 2016-10-28 15:13:51 +0000
428@@ -81,6 +81,7 @@
429 <field name="move_price_unit" />
430 <field name="move_currency_id" />
431 <field name="str_line_number" />
432+ <field name="external_ref" />
433 <field name="error_msg" invisible="1" />
434 <button name="get_error_msg" type="object" icon="gtk-dialog-warning" string="See error" attrs="{'invisible': [('error_msg', '=', False), ('integrity_status', 'in', ('empty', False, ''))]}" />
435 <field name="type_change" />
436@@ -99,6 +100,7 @@
437 <field name="kc_check" widget="null_boolean" />
438 <field name="dg_check" widget="null_boolean" />
439 <field name="np_check" widget="null_boolean" />
440+ <field name="imp_external_ref" />
441 <field name="imp_packing_list" />
442 <field name="message_esc1" />
443 <field name="message_esc2" />
444
445=== modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py'
446--- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-08-23 12:54:03 +0000
447+++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen.py 2016-10-28 15:13:51 +0000
448@@ -48,6 +48,8 @@
449 CURRENCY_NAME_ID = {}
450
451 SIMU_LINES = {}
452+LN_BY_EXT_REF = {}
453+EXT_REF_BY_LN = {}
454
455 """
456 UF-2538 optional 4nd tuple item: list of states for mandatory check
457@@ -62,6 +64,7 @@
458 (6, _('Price Unit'), 'mandatory'),
459 (7, _('Currency'), 'mandatory'),
460 (8, _('Origin'), 'optionnal'),
461+ (14, _('Comment'), 'optionnal'),
462 (10, _('Delivery Confirmed Date'), 'mandatory', ('!=', ['confirmed'])),
463 (16, _('Project Ref.'), 'optionnal'),
464 (17, _('Message ESC 1'), 'optionnal'),
465@@ -159,6 +162,14 @@
466 ('done', 'Done')],
467 string='State',
468 readonly=True),
469+ 'with_ad': fields.selection(
470+ selection=[
471+ ('yes', 'Yes'),
472+ ('no', 'No'),
473+ ],
474+ string='File contains Analytic Distribution',
475+ required=True,
476+ ),
477 # File information
478 'file_to_import': fields.binary(string='File to import'),
479 'filename': fields.char(size=64, string='Filename'),
480@@ -259,6 +270,7 @@
481
482 _defaults = {
483 'state': 'draft',
484+ 'with_ad': lambda *a: 'yes',
485 }
486
487 def write(self, cr, uid, ids, vals, context=None):
488@@ -336,17 +348,23 @@
489 if isinstance(ids, (int, long)):
490 ids = [ids]
491
492- for wiz in self.browse(cr, uid, ids, context=context):
493- if wiz.filetype == 'excel':
494- xml_file = base64.decodestring(wiz.file_to_import)
495- excel_file = SpreadsheetXML(xmlstring=xml_file)
496- if not excel_file.getWorksheets():
497- raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !'))
498- else:
499- xml_file = base64.decodestring(wiz.file_to_import)
500- root = ET.fromstring(xml_file)
501- if root.tag != 'data':
502- raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !'))
503+ try:
504+ for wiz in self.browse(cr, uid, ids, context=context):
505+ if wiz.filetype == 'excel':
506+ xml_file = base64.decodestring(wiz.file_to_import)
507+ excel_file = SpreadsheetXML(xmlstring=xml_file)
508+ if not excel_file.getWorksheets():
509+ raise osv.except_osv(_('Error'), _('The given file is not a valid Excel 2003 Spreadsheet file !'))
510+ else:
511+ xml_file = base64.decodestring(wiz.file_to_import)
512+ root = ET.fromstring(xml_file)
513+ if root.tag != 'data':
514+ raise osv.except_osv(_('Error'), _('The given file is not a valid XML file !'))
515+ except Exception as e:
516+ raise osv.except_osv(
517+ _('Error'),
518+ _('Error during file to import parsing :: Error: %s') % e,
519+ )
520
521 self.write(cr, uid, ids, {'state': 'simu_progress'}, context=context)
522 cr.commit()
523@@ -372,6 +390,14 @@
524 rec_lines = []
525 rec = False
526
527+ ad_field_names = [
528+ 'analytic_distribution_id',
529+ 'ad_destination_name',
530+ 'ad_cost_center_name',
531+ 'ad_percentage',
532+ 'ad_subtotal',
533+ ]
534+
535 index = 0
536 for record in root:
537 if record.tag == 'record':
538@@ -393,18 +419,19 @@
539 return index
540
541 for field in rec:
542- if field.attrib['name'] != 'order_line':
543+ ad_field = field.attrib['name'] in ad_field_names
544+ if field.attrib['name'] != 'order_line' and not ad_field:
545 index = get_field_index(field, index)
546- else:
547+ elif not ad_field:
548 index += 1
549 values[index] = ['line_number', 'external_ref',
550 'product_code', 'product_name',
551 'product_qty', 'product_uom',
552 'price_unit', 'currency_id',
553- 'origin', 'date_planned',
554+ 'origin', 'comment', 'date_planned',
555 'confirmed_delivery_date',
556 'nomen_manda_0', 'nomen_manda_1',
557- 'nomen_manda_2', 'comment',
558+ 'nomen_manda_2',
559 'notes', 'project_ref',
560 'message_esc1', 'message_esc2']
561 for line in field:
562@@ -414,6 +441,8 @@
563 index += 1
564 values[index] = []
565 for fl in line:
566+ if fl.attrib['name'] in ad_field_names:
567+ continue
568 if not fl.getchildren():
569 values[index].append(fl.text or '')
570 else:
571@@ -469,6 +498,8 @@
572 global UOM_NAME_ID
573 global CURRENCY_NAME_ID
574 global SIMU_LINES
575+ global LN_BY_EXT_REF
576+ global EXT_REF_BY_LN
577
578 if context is None:
579 context = {}
580@@ -484,6 +515,13 @@
581 'state': 'draft'}, context=context)
582 continue
583
584+ nb_file_header_lines = NB_OF_HEADER_LINES
585+ nb_file_lines_columns = NB_LINES_COLUMNS
586+ first_line_index = nb_file_header_lines + 1
587+ if wiz.with_ad == 'yes' and wiz.filetype != 'xml':
588+ nb_file_header_lines += 2
589+ first_line_index += 2
590+
591 for line in wiz.simu_line_ids:
592 # Put data in cache
593 if line.in_product_id:
594@@ -497,6 +535,7 @@
595 First of all, we build a cache for simulation screen lines
596 '''
597 l_num = line.in_line_number
598+ l_ext_ref = line.in_ext_ref
599 l_prod = line.in_product_id and line.in_product_id.id or False
600 l_uom = line.in_uom and line.in_uom.id or False
601 # By simulation screen
602@@ -519,6 +558,14 @@
603 SIMU_LINES[wiz.id][l_num][l_prod][l_uom].setdefault(line.in_qty, [])
604 SIMU_LINES[wiz.id][l_num][l_prod][l_uom][line.in_qty].append(line.id)
605
606+ LN_BY_EXT_REF.setdefault(wiz.id, {})
607+ EXT_REF_BY_LN.setdefault(wiz.id, {})
608+ if line.in_ext_ref:
609+ LN_BY_EXT_REF[wiz.id].setdefault(str(line.in_ext_ref), [])
610+ EXT_REF_BY_LN[wiz.id].setdefault(l_num, [])
611+ LN_BY_EXT_REF[wiz.id][line.in_ext_ref].append(l_num)
612+ EXT_REF_BY_LN[wiz.id][l_num].append(str(line.in_ext_ref))
613+
614 # Variables
615 lines_to_ignored = [] # Bad formatting lines
616 file_format_errors = []
617@@ -541,28 +588,31 @@
618 '''
619 # Check number of columns on lines
620
621- for x in xrange(1, NB_OF_HEADER_LINES+1):
622- if len(values.get(x, [])) != 2:
623+ for x in xrange(1, nb_file_header_lines+1):
624+ nb_to_check = 2
625+ if x > NB_OF_HEADER_LINES and x <= nb_file_header_lines:
626+ continue
627+ if len(values.get(x, [])) != nb_to_check:
628 lines_to_ignored.append(x)
629 error_msg = _('Line %s of the imported file: The header \
630- information must be on two columns : Column A for name of the field and column\
631- B for value.') % x
632+information must be on two columns : Column A for name of the field and column\
633+ B for value.') % x
634 file_format_errors.append(error_msg)
635
636- if len(values.get(NB_OF_HEADER_LINES+1, [])) != NB_LINES_COLUMNS:
637- error_msg = _('Line 20 of the Excel file: This line is \
638- mandatory and must have %s columns. The values on this line must be the name \
639- of the field for PO lines.') % NB_LINES_COLUMNS
640+ if len(values.get(first_line_index, [])) < nb_file_lines_columns:
641+ error_msg = _('Line %s of the Excel file: This line is \
642+mandatory and must have at least %s columns. The values on this line must be the name \
643+of the field for PO lines.') % (first_line_index, nb_file_lines_columns)
644 file_format_errors.append(error_msg)
645
646- for x in xrange(NB_OF_HEADER_LINES+2, len(values)+1):
647- if len(values.get(x, [])) != NB_LINES_COLUMNS:
648+ for x in xrange(first_line_index, len(values)+1):
649+ if len(values.get(x, [])) < nb_file_lines_columns:
650 lines_to_ignored.append(x)
651 error_msg = _('Line %s of the imported file: The line \
652- information must be on %s columns. The line %s has %s columns') % (x, NB_LINES_COLUMNS, x, len(values.get(x, [])))
653+information must be on at least %s columns. The line %s has %s columns') % (x, nb_file_lines_columns, x, len(values.get(x, [])))
654 file_format_errors.append(error_msg)
655
656- nb_file_lines = len(values) - NB_OF_HEADER_LINES - 1
657+ nb_file_lines = len(values) - first_line_index
658 self.write(cr, uid, [wiz.id], {'nb_file_lines': nb_file_lines}, context=context)
659
660 if len(file_format_errors):
661@@ -709,7 +759,7 @@
662 new_po_lines = []
663 not_ok_file_lines = {}
664 # Loop on lines
665- for x in xrange(NB_OF_HEADER_LINES+2, len(values)+1):
666+ for x in xrange(first_line_index+1, len(values)+1):
667
668 # Check mandatory fields
669 not_ok = False
670@@ -738,7 +788,7 @@
671 file_line_error.append(err1)
672
673 line_number = values.get(x, [''])[0] and int(values.get(x, [''])[0]) or False
674- ext_ref = values.get(x, ['', ''])[1]
675+ ext_ref = values.get(x, ['', ''])[1] and str(values.get(x, ['', ''])[1])
676
677 if not line_number and not ext_ref:
678 not_ok = True
679@@ -747,6 +797,19 @@
680 values_line_errors.append(err)
681 file_line_error.append(err1)
682
683+ if line_number and ext_ref and (ext_ref not in LN_BY_EXT_REF[wiz.id].keys() or line_number not in LN_BY_EXT_REF[wiz.id][ext_ref]):
684+ not_ok = True
685+ err1 = _('The line cannot have both Line no. and Ext. Ref')
686+ err = _('Line %s of the file: %s') % (x, err1)
687+ values_line_errors.append(err)
688+ file_line_error.append(err1)
689+
690+ if not line_number and ext_ref and ext_ref in LN_BY_EXT_REF[wiz.id].keys():
691+ line_number = LN_BY_EXT_REF[wiz.id][ext_ref][0]
692+
693+ if not ext_ref and line_number and line_number in EXT_REF_BY_LN[wiz.id].keys():
694+ ext_ref = EXT_REF_BY_LN[wiz.id][line_number][0]
695+
696 if not_ok:
697 not_ok_file_lines[x] = ' - '.join(err for err in file_line_error)
698
699@@ -779,7 +842,7 @@
700 if vals[4]:
701 qty = float(vals[4])
702
703- file_lines[x] = (line_number or ext_ref, product_id, uom_id, qty)
704+ file_lines[x] = (line_number, product_id, uom_id, qty, ext_ref)
705
706 '''
707 Get the best matching line :
708@@ -920,6 +983,7 @@
709 vals = values.get(po_line, [])
710 new_wl_id = wl_obj.create(cr, uid, {'type_change': 'new',
711 'in_line_number': values.get(po_line, [])[0] and int(values.get(po_line, [])[0]) or False,
712+ 'in_ext_ref': values.get(po_line, [])[1] or False,
713 'simu_id': wiz.id}, context=context)
714 err_msg = wl_obj.import_line(cr, uid, new_wl_id, vals, context=context)
715 if po_line in not_ok_file_lines:
716@@ -934,7 +998,8 @@
717
718 # Lines to delete
719 for po_line in SIMU_LINES[wiz.id]['line_ids']:
720- wl_obj.write(cr, uid, po_line, {'type_change': 'del'}, context=context)
721+ if wl_obj.read(cr, uid, [po_line], ['type_change'], context=context)[0]['type_change'] != 'del':
722+ wl_obj.write(cr, uid, po_line, {'type_change': 'ignore'}, context=context)
723
724 '''
725 We generate the message which will be displayed on the simulation
726@@ -1071,7 +1136,7 @@
727
728 class wizard_import_po_simulation_screen_line(osv.osv):
729 _name = 'wizard.import.po.simulation.screen.line'
730- _order = 'is_new_line, in_line_number, in_product_id, id'
731+ _order = 'is_new_line, in_line_number, in_ext_ref, in_product_id, id'
732 _rec_name = 'in_line_number'
733
734 def _get_line_info(self, cr, uid, ids, field_name, args, context=None):
735@@ -1081,6 +1146,14 @@
736 if isinstance(ids, (int, long)):
737 ids = [ids]
738
739+ delete_line_ids = self.search(cr, uid, [
740+ ('imp_comment', '=', '[DELETE]')
741+ ], context=context)
742+ delete_line_numbers = set()
743+ for x in self.read(cr, uid, delete_line_ids, ['in_line_number'], context=context):
744+ if x['in_line_number']:
745+ delete_line_numbers.add(x['in_line_number'])
746+
747 res = {}
748 for line in self.browse(cr, uid, ids, context=context):
749 res[line.id] = {'in_product_id': False,
750@@ -1092,6 +1165,7 @@
751 'in_dcd': False,
752 'in_price': 0.00,
753 'in_currency': False,
754+ 'in_ext_ref': False,
755 'imp_discrepancy': 0.00,
756 'change_ok': False}
757
758@@ -1106,7 +1180,8 @@
759 res[line.id]['in_dcd'] = l.confirmed_delivery_date
760 res[line.id]['in_price'] = l.price_unit
761 res[line.id]['in_currency'] = l.currency_id and l.currency_id.id or False
762- if line.type_change != 'del':
763+ res[line.id]['in_ext_ref'] = l.external_ref or False
764+ if line.type_change != '':
765 if line.imp_qty and line.imp_price:
766 disc = (line.imp_qty*line.imp_price)-(line.in_qty*line.in_price)
767 res[line.id]['imp_discrepancy'] = disc
768@@ -1120,8 +1195,11 @@
769 price_change = not(res[line.id]['in_price'] == line.imp_price)
770 drd_change = not(res[line.id]['in_drd'] == line.imp_drd)
771 dcd_change = not(res[line.id]['in_dcd'] == line.imp_dcd)
772+ to_delete = line.imp_comment == '[DELETE]'
773+ if to_delete:
774+ delete_line_numbers.add(line.in_line_number)
775
776- if line.simu_id.state != 'draft' and (prod_change or qty_change or price_change or drd_change or dcd_change):
777+ if line.simu_id.state != 'draft' and (prod_change or qty_change or price_change or drd_change or dcd_change or to_delete):
778 res[line.id]['change_ok'] = True
779 elif line.type_change == 'del':
780 res[line.id]['imp_discrepancy'] = -(line.in_qty*line.in_price)
781@@ -1190,8 +1268,10 @@
782 'is_new_line': fields.function(_get_str_line_number, method=True, string='Is new line ?',
783 type='boolean', readonly=True, multi='new_line',
784 store={'wizard.import.po.simulation.screen.line': (lambda self, cr, uid, ids, c={}: ids, ['in_line_number'], 20),}),
785+ 'in_ext_ref': fields.char(size=256, string='External Ref.', readonly=True),
786 'type_change': fields.selection([('', ''), ('error', 'Error'), ('new', 'New'),
787- ('split', 'Split'), ('del', 'Del'),],
788+ ('split', 'Split'), ('del', 'Del'),
789+ ('ignore', 'Ignore')],
790 string='CHG', readonly=True),
791 'imp_product_id': fields.many2one('product.product', string='Product',
792 readonly=True),
793@@ -1206,6 +1286,7 @@
794 'imp_dcd': fields.date(string='Delivery Confirmed Date', readonly=True),
795 'imp_esc1': fields.char(size=256, string='Message ESC1', readonly=True),
796 'imp_esc2': fields.char(size=256, string='Message ESC2', readonly=True),
797+ 'imp_comment': fields.text(string='Comment', readonly=True),
798 'imp_external_ref': fields.char(size=256, string='External Ref.', readonly=True),
799 'imp_project_ref': fields.char(size=256, string='Project Ref.', readonly=True),
800 'imp_origin': fields.char(size=256, string='Origin Ref.', readonly=True),
801@@ -1246,20 +1327,35 @@
802 for line in self.browse(cr, uid, ids, context=context):
803 write_vals = {}
804
805+ # Comment
806+ write_vals['imp_comment'] = values[14] and values[14].strip()
807+
808 # External Ref.
809 write_vals['imp_external_ref'] = values[1]
810- if line.in_line_number and write_vals['imp_external_ref']:
811- errors.append(_('The line cannot have both Line no. and Ext Ref.'))
812- write_vals['in_line_number'] = False
813- write_vals['imp_external_ref'] = False
814- write_vals['type_change'] = 'error'
815- elif line.in_line_number:
816+ pol_ids = None
817+ if line.in_line_number:
818 pol_ids = self.pool.get('purchase.order.line').search(cr, uid, [('order_id', '=', line.simu_id.order_id.id), ('line_number', '=', line.in_line_number)], context=context)
819- if not pol_ids:
820+ if not pol_ids and not (write_vals['imp_comment'] and write_vals['imp_comment'] == '[DELETE]'):
821 errors.append(_('Line no is not consistent with validated PO.'))
822 write_vals['in_line_number'] = False
823 write_vals['type_change'] = 'error'
824
825+ if (write_vals['imp_comment'] and write_vals['imp_comment'] == '[DELETE]'):
826+ if not pol_ids:
827+ write_vals['type_change'] = 'error'
828+ if line.in_line_number:
829+ errors.append(_('The import file is inconsistent. Line no. %s is not existing or was previously deleted') % line.in_line_number)
830+ else:
831+ errors.append(_('The import file is inconsistent. The matching line is not existing or was previously deleted'))
832+ else:
833+ write_vals['type_change'] = 'del'
834+ if line.in_line_number:
835+ to_delete = self.search(cr, uid, [
836+ ('simu_id', '=', line.simu_id.id),
837+ ('in_line_number', '=', line.in_line_number),
838+ ], context=context)
839+ self.write(cr, uid, to_delete, {'type_change': 'del'}, context=context)
840+
841 if not line.in_line_number and not write_vals.get('imp_external_ref'):
842 errors.append(_('The line should have a Line no. or an Ext Ref.'))
843 write_vals['in_line_number'] = False
844@@ -1437,15 +1533,17 @@
845 line_treated = 0.00
846 percent_completed = 0.00
847 for line in self.browse(cr, uid, ids, context=context):
848+ context['purchase_id'] = line.simu_id.order_id.id
849 line_treated += 1
850 percent_completed = int(float(line_treated) / float(nb_lines) * 100)
851- if line.po_line_id and line.type_change != 'del' and not line.change_ok and not line.imp_external_ref and not line.imp_project_ref and not line.imp_origin:
852+ if line.po_line_id and line.type_change != 'ignore' and not line.change_ok and not line.imp_external_ref and not line.imp_project_ref and not line.imp_origin:
853 continue
854
855- if line.type_change in ('del', 'error'):
856+ if line.type_change in ('ignore', 'error'):
857 # Don't do anything
858- # i.e. Skype conversation with Raffaelle (08.01.2014) : deletes will need to be done manually after import
859 continue
860+ elif line.type_change == 'del' and line.po_line_id:
861+ line_obj.fake_unlink(cr, uid, [line.po_line_id.id], context=context)
862 elif line.type_change == 'split' and line.parent_line_id:
863 # Call the split line wizard
864 po_line_id = False
865@@ -1524,7 +1622,6 @@
866 'product_uom': line.imp_uom.id,
867 'price_unit': line.imp_price,
868 'product_qty': line.imp_qty,
869- 'line_number': line.in_line_number,
870 'date_planned': line.imp_drd or line.simu_id.order_id.delivery_requested_date,
871 }
872 if line.imp_dcd:
873
874=== modified file 'bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml'
875--- bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml 2014-10-13 11:03:40 +0000
876+++ bin/addons/msf_doc_import/wizard/wizard_po_simulation_screen_view.xml 2016-10-28 15:13:51 +0000
877@@ -20,6 +20,7 @@
878 attrs="{'invisible': [('import_error_ok', '!=', False), ('state', '!=', 'done')]}" />
879 <field name="error_filename" invisible="1" />
880 <field name="import_error_ok" invisible="1" />
881+ <field name="with_ad" attrs="{'readonly': [('state', '!=', 'draft')]}" invisible="1" />
882 <field name="percent_completed" widget="progressbar" attrs="{'invisible': [('state', '=', 'draft')]}" />
883 <field name="state" invisible="0" />
884 </group>
885@@ -83,7 +84,7 @@
886 <page string="Details">
887 <!-- LINES -->
888 <field name="simu_line_ids" nolabel="1" colspan="4">
889- <tree string="Lines" colors="grey: type_change == 'del'; red: type_change == 'error'; orange: change_ok==True and type_change not in ('del', 'error'); blue: type_change=='split'; green: type_change=='new'">
890+ <tree string="Lines" colors="grey: type_change == 'del'; red: type_change == 'error'; orange: change_ok==True and type_change not in ('del', 'ignore', 'error'); blue: type_change=='split'; green: type_change=='new'">
891 <field name="in_product_id" />
892 <field name="in_nomen" />
893 <field name="in_comment" />
894@@ -95,6 +96,7 @@
895 <field name="in_currency" />
896 <field name="in_line_number" invisible="1" />
897 <field name="str_in_line_number" />
898+ <field name="in_ext_ref" />
899 <field name="type_change" />
900 <field name="error_msg" invisible="1" />
901 <button name="get_error_msg" type="object" icon="gtk-dialog-warning" string="See error" attrs="{'invisible': [('error_msg', '=', False)]}" />
902
903=== modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py'
904--- bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2016-07-25 08:20:05 +0000
905+++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2016-10-28 15:13:51 +0000
906@@ -374,7 +374,9 @@
907 'move_uom_id': move.product_uom and move.product_uom.id or False,
908 'move_price_unit': move.price_unit or move.product_id.standard_price,
909 'move_currency_id': move.price_currency_id and move.price_currency_id.id or False,
910- 'line_number': move.line_number, }, context=context)
911+ 'line_number': move.line_number,
912+ 'external_ref': move.purchase_line_id and move.purchase_line_id.external_ref or False,
913+ }, context=context)
914
915 return {'type': 'ir.actions.act_window',
916 'res_model': 'wizard.import.in.simulation.screen',
917
918=== modified file 'bin/addons/msf_profile/data/patches.xml'
919--- bin/addons/msf_profile/data/patches.xml 2016-10-04 12:27:11 +0000
920+++ bin/addons/msf_profile/data/patches.xml 2016-10-28 15:13:51 +0000
921@@ -110,5 +110,9 @@
922 <record id="us_1766_fix_fxa_aji_curr" model="patch.scripts">
923 <field name="method">us_1766_fix_fxa_aji_curr</field>
924 </record>
925+
926+ <record id="us_635_dest_partner_ids" model="patch.scripts">
927+ <field name="method">us_635_dest_partner_ids</field>
928+ </record>
929 </data>
930 </openerp>
931
932=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
933--- bin/addons/msf_profile/i18n/fr_MF.po 2016-10-25 09:13:52 +0000
934+++ bin/addons/msf_profile/i18n/fr_MF.po 2016-10-28 15:13:51 +0000
935@@ -18086,19 +18086,47 @@
936 msgid "Available for incoming shipment ?"
937 msgstr "Disponible pour envoi entrant ?"
938
939-#. modules: purchase, account, reason_types_moves, stock_override, order_nomenclature, sale, product_asset, specific_rules, purchase_override, supplier_catalogue, base, product_list, tender_flow, msf_supply_doc_export, msf_doc_import, return_claim, analytic_distribution
940+#. modules: tender_flow, product_asset, update_client, register_accounting, return_claim, msf_doc_import, supplier_catalogue, purchase_compare_rfq, product_list, analytic_distribution, reason_types_moves, stock_override, consumption_calculation, purchase_override, specific_rules, kit, base, msf_tools, purchase, account, msf_outgoing, order_nomenclature, msf_field_access_rights, sale, msf_button_access_rights, msf_supply_doc_export
941 #: field:account.move.line.reconcile.writeoff,comment:0
942 #: field:account.commitment,notes:0
943+#: field:account.invoice.line,inactive_error:0
944 #: field:res.groups,comment:0
945-#: code:addons/msf_doc_import/wizard/__init__.py:45
946-#: code:addons/msf_doc_import/wizard/__init__.py:50
947-#: code:addons/msf_doc_import/wizard/__init__.py:55
948-#: code:addons/msf_doc_import/wizard/wizard_import_po_line.py:183
949+#: field:real.average.consumption.line,remark:0
950+#: field:composition.item,inactive_error:0
951+#: report:kit.report:0
952+#: field:msf_button_access_rights.button_access_rule,comment:0
953+#: report:addons/msf_doc_import/report/po_simulation_screen_xls_report.mako:232
954+#: code:addons/msf_doc_import/wizard/__init__.py:41
955+#: code:addons/msf_doc_import/wizard/__init__.py:58
956+#: code:addons/msf_doc_import/wizard/__init__.py:83
957+#: code:addons/msf_doc_import/wizard/__init__.py:108
958+#: code:addons/msf_doc_import/wizard/__init__.py:119
959+#: code:addons/msf_doc_import/wizard/wizard_import_po_line.py:244
960+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:67
961+#: field:initial.stock.inventory.line,inactive_error:0
962+#: report:po.simulation.screen:0
963+#: field:purchase.line.import.xml.line,comment:0
964+#: field:purchase.order.line,inactive_error:0
965+#: field:sale.order.line,inactive_error:0
966+#: field:stock.inventory.line,inactive_error:0
967+#: field:wizard.import.po.simulation.screen.line,imp_comment:0
968+#: field:wizard.import.po.simulation.screen.line,in_comment:0
969+#: field:wizard.simu.import.po.line,initial_comment:0
970+#: field:msf_field_access_rights.field_access_rule,comment:0
971+#: report:invoice:0
972+#: field:memory.additionalitems,comment:0
973+#: report:packing.list:0
974+#: report:picking.ticket:0
975+#: field:shipment.additional.line.processor,comment:0
976+#: field:shipment.additionalitems,comment:0
977+#: field:stock.move.memory.shipment.additionalitems,comment:0
978 #: report:addons/msf_supply_doc_export/report/product_list_xls.mako:52
979 #: report:addons/msf_supply_doc_export/report/report_internal_request_xls.mako:64
980 #: report:addons/msf_supply_doc_export/report/report_purchase_order_xls.mako:77
981 #: report:addons/msf_supply_doc_export/report/report_request_for_quotation_xls.mako:76
982 #: report:addons/msf_supply_doc_export/report/report_sale_order_xls.mako:77
983+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:227
984+#: field:automated.import.job,comment:0
985 #: field:purchase.order.line,comment:0
986 #: field:purchase.order.merged.line,comment:0
987 #: field:sale.order.line,comment:0
988@@ -18110,24 +18138,31 @@
989 #: field:old.product.list.line,comment:0
990 #: field:product.list.line,comment:0
991 #: field:purchase.order.line,name:0
992+#: code:addons/purchase_compare_rfq/wizard/compare_rfq.py:459
993 #: report:msf.purchase.order:0
994 #: report:msf.purchase.quotation:0
995 #: report:purchase.order.merged:0
996 #: field:purchase.order.merged.line,name:0
997 #: field:stock.inventory.line,comment:0
998 #: field:stock.move,comment:0
999+#: field:account.direct.invoice.wizard.line,inactive_error:0
1000+#: field:wizard.account.invoice.line,inactive_error:0
1001 #: field:claim.event,description_claim_event:0
1002+#: report:msf.freight_manifest:0
1003 #: report:msf.product_list:0
1004 #: report:msf.report_reception_in:0
1005 #: report:msf.sale.order:0
1006 #: field:sale.order.line,name:0
1007 #: field:initial.stock.inventory.line,comment:0
1008 #: field:report.stock.move,comment:0
1009+#: report:addons/supplier_catalogue/report/report_supplier_catalogue_lines_xls.mako:77
1010 #: view:supplier.catalogue:0
1011 #: field:supplier.catalogue,comment:0
1012 #: field:supplier.catalogue.line,comment:0
1013+#: report:addons/tender_flow/report/tender_rfq_comparison_xls.mako:552
1014 #: field:pricelist.partnerinfo,comment:0
1015 #: field:tender.line,comment:0
1016+#: field:sync_client.version,comment:0
1017 #, python-format
1018 msgid "Comment"
1019 msgstr "Commentaire"
1020@@ -27825,17 +27860,28 @@
1021 msgid "Macau"
1022 msgstr "Macau"
1023
1024-#. modules: purchase, account, sale, register_accounting, purchase_override, purchase_allocation_report
1025+#. modules: purchase, account, account_mcdb, procurement_request, purchase_override, sale, account_override, purchase_allocation_report, register_accounting, msf_supply_doc_export
1026 #: field:account.invoice.line,price_subtotal:0
1027+#: report:addons/account_mcdb/report/report_account_analytic_line_free_xls.mako:98
1028+#: report:addons/account_mcdb/report/report_account_analytic_line_free_xls.mako:185
1029+#: report:addons/account_override/report/open_invoices_xls.mako:361
1030+#: report:allocation.invoices.report:0
1031+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:180
1032+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:185
1033+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:202
1034+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:237
1035+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:243
1036+#: report:procurement.request.report:0
1037 #: field:purchase.order.line,price_subtotal:0
1038 #: view:purchase.report:0
1039 #: field:purchase.report,price_total:0
1040 #: report:po.line.allocation.report:0
1041 #: report:purchase.order.allocation.report:0
1042-#: report:sale.order.allocation.report:0
1043 #: field:purchase.order.line.allocation.report,subtotal:0
1044 #: field:purchase.order.merged.line,price_subtotal:0
1045+#: field:account.direct.invoice.wizard.line,price_subtotal:0
1046 #: field:wizard.account.invoice.line,price_subtotal:0
1047+#: report:sale.order.allocation.report:0
1048 #: field:sale.order.line,price_subtotal:0
1049 msgid "Subtotal"
1050 msgstr "Sous-total"
1051@@ -53245,8 +53291,10 @@
1052 msgid "Child Nomenclatures"
1053 msgstr "Nomenclatures Enfant"
1054
1055-#. module: product
1056+#. modules: sales_followup, product, res_currency_functional
1057 #: field:product.product,partner_ref:0
1058+#: view:purchase.order.line:0
1059+#: report:addons/sales_followup/report/sale_follow_up_multi_report_xls.mako:216
1060 msgid "Customer ref"
1061 msgstr "Réf. Client"
1062
1063@@ -60076,32 +60124,43 @@
1064 msgid "Error at import"
1065 msgstr "Error at import"
1066
1067-#. modules: msf_budget, purchase, tender_flow, account_mcdb, msf_homere_interface, account_hq_entries, analytic_distribution, msf_doc_import, financing_contract, purchase_allocation_report, register_accounting
1068+#. modules: msf_budget, purchase, register_accounting, account_mcdb, msf_homere_interface, financing_contract, sale, account_hq_entries, account_override, purchase_allocation_report, tender_flow, msf_supply_doc_export, msf_doc_import, analytic_override, analytic_distribution
1069 #: field:hq.analytic.reallocation,cost_center_id:0
1070 #: field:hq.entries,cost_center_id:0
1071+#: field:hq.entries.split.lines,cost_center_id:0
1072 #: view:account.analytic.line:0
1073 #: view:account.mcdb:0
1074-#: code:addons/account_mcdb/report/account_mcdb_export.py:167
1075+#: field:account.mcdb,analytic_account_cc_ids:0
1076+#: code:addons/account_mcdb/report/account_mcdb_export.py:189
1077 #: report:addons/account_mcdb/report/report_account_analytic_line_xls.mako:66
1078+#: report:allocation.invoices.report:0
1079+#: view:account.analytic.line:0
1080+#: report:addons/analytic_distribution/report/report_account_analytic_chart_export.mako:131
1081+#: view:analytic.distribution.wizard:0
1082+#: field:analytic.distribution.wizard.fp.lines,cost_center_id:0
1083+#: view:analytic.distribution.wizard.lines:0
1084+#: field:int.commitment.realloc.wizard,cost_center_id:0
1085 #: selection:account.analytic.account,category:0
1086-#: view:account.analytic.line:0
1087 #: field:account.analytic.line,cost_center_id:0
1088-#: view:analytic.distribution.wizard:0
1089-#: field:analytic.distribution.wizard.fp.lines,cost_center_id:0
1090-#: view:analytic.distribution.wizard.lines:0
1091+#: report:addons/financing_contract/report/project_expenses_xls.mako:482
1092 #: field:msf.budget,cost_center_id:0
1093+#: field:msf.doc.import.accounting.lines,cost_center_id:0
1094 #: field:hr.analytic.reallocation,cost_center_id:0
1095 #: field:hr.employee,cost_center_id:0
1096 #: field:hr.payroll.msf,cost_center_id:0
1097+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:178
1098+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:183
1099+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:200
1100+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:235
1101+#: report:addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako:241
1102+#: report:po.follow.up_rml:0
1103 #: view:purchase.report:0
1104+#: report:po.line.allocation.report:0
1105+#: report:purchase.order.allocation.report:0
1106+#: view:account.direct.invoice.wizard.lines:0
1107+#: field:wizard.register.import.lines,cost_center_id:0
1108+#: report:sale.order.allocation.report:0
1109 #: field:purchase.report,cost_center_id:0
1110-#: field:account.mcdb,analytic_account_cc_ids:0
1111-#: report:addons/financing_contract/report/project_expenses_xls.mako:461
1112-#: field:msf.doc.import.accounting.lines,cost_center_id:0
1113-#: report:po.line.allocation.report:0
1114-#: report:sale.order.allocation.report:0
1115-#: report:purchase.order.allocation.report:0
1116-#: field:wizard.register.import.lines,cost_center_id:0
1117 #, python-format
1118 msgid "Cost Center"
1119 msgstr "Centre de Coût"
1120@@ -70659,6 +70718,16 @@
1121 msgid "Ordered qty"
1122 msgstr "Qté commandée"
1123
1124+#. module: sales_followup
1125+#: field:sale.order.line.followup,qty_ordered:0
1126+msgid "Line number"
1127+msgstr "N° de ligne"
1128+
1129+#. module: sales_followup
1130+#: field:sale.order.line.followup,qty_ordered:0
1131+msgid "Ext. Ref"
1132+msgstr "Ref. ext."
1133+
1134 #. module: return_claim
1135 #: model:ir.module.module,shortdesc:return_claim.module_meta_information
1136 msgid "MSF Return-Claim"
1137@@ -74618,6 +74687,118 @@
1138 msgstr "\n"
1139 " Le nombre de colonnes n'est pas égal à %s"
1140
1141+#: field:wizard.export.po.validated,need_ad:0
1142+msgid "Export AD"
1143+msgstr "Exporter la Distribution Analytique"
1144+
1145+#. module: msf_doc_import
1146+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:569
1147+#, python-format
1148+msgid "No line found for line number '%s' and ext. ref. '%s' - Line not imported"
1149+msgstr "Pas de ligne trouvée avec le numéro de ligne '%s' et la réf. externe '%s' - Ligne non importée"
1150+
1151+#. module: msf_doc_import
1152+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:562
1153+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:570
1154+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:786
1155+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:796
1156+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:803
1157+#, python-format
1158+msgid "Line %s of the file: %s"
1159+msgstr "Ligne %s du fichier : %s"
1160+
1161+#. module: msf_doc_import
1162+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:56
1163+#: field:wizard.import.in.line.simulation.screen,external_ref:0
1164+#: field:wizard.import.po.simulation.screen.line,imp_external_ref:0
1165+#: field:wizard.import.po.simulation.screen.line,in_ext_ref:0
1166+#, python-format
1167+msgid "External Ref."
1168+msgstr "Réf. Externe"
1169+
1170+#. module: msf_doc_import
1171+#: field:wizard.import.in.line.simulation.screen,imp_external_ref:0
1172+msgid "External ref."
1173+msgstr "Réf. Externe"
1174+
1175+#. module: msf_doc_import
1176+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:1287
1177+#, python-format
1178+msgid "No original IN lines with external ref '%s' found."
1179+msgstr "Pas de ligne trouvée dans la réception originale avec la réf. externe '%s'."
1180+
1181+#. module: msf_doc_import
1182+#: code:addons/msf_doc_import/wizard/wizard_in_simulation_screen.py:1289
1183+#, python-format
1184+msgid "Line does not correspond to original IN"
1185+msgstr "La ligne ne correspond pas à la réception originale"
1186+
1187+#. module: msf_doc_import
1188+#: field:wizard.import.po.simulation.screen,with_ad:0
1189+msgid "File contains Analytic Distribution"
1190+msgstr "Le fichier contient une distribution analytique"
1191+
1192+#. module: msf_doc_import
1193+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:366
1194+#, python-format
1195+msgid "Error during file to import parsing :: Error: %s"
1196+msgstr "Erreur durant le traitement du fichier importé :: Erreur : %s"
1197+
1198+#. module: msf_doc_import
1199+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:597
1200+#, python-format
1201+msgid "Line %s of the imported file: The header information must be on two columns : Column A for name of the field and column B for value."
1202+msgstr "Ligne %s du fichier importé : les informations de l'en-tête doivent être sur deux colonnes : La colonne A pour le nom du champ et la colonne B pour sa valeur."
1203+
1204+#. module: msf_doc_import
1205+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:1346
1206+#, python-format
1207+msgid "The import file is inconsistent. Line no. %s is not existing or was previously deleted"
1208+msgstr "Le fichier importé est incohérent. La ligne n° %s n'existe pas ou a été précédemment supprimée"
1209+
1210+#. module: msf_doc_import
1211+#: code:addons/msf_doc_import/wizard/wizard_po_simulation_screen.py:1348
1212+#, python-format
1213+msgid "The import file is inconsistent. The matching line is not existing or was previously deleted"
1214+msgstr "Le fichier importé est incohérent. La ligne correspondante n'existe pas ou a été précédemment supprimée"
1215+
1216+#. module: msf_supply_doc_export
1217+#: report:addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako:102
1218+msgid "Ext. Reference"
1219+msgstr "Réf. Externe"
1220+
1221+#. module: purchase_override
1222+#: report:msf.purchase.order:0
1223+#: report:msf.purchase.quotation:0
1224+#: report:purchase.order.merged:0
1225+msgid "Print date:"
1226+msgstr "Date d'impression :"
1227+
1228+#. module: purchase_override
1229+#: field:purchase.order.line,customer_ref:0
1230+msgid "Customer ref."
1231+msgstr "Ref. Client"
1232+
1233+#. module: purchase_override
1234+#: field:purchase.order,customer_ref:0
1235+msgid "Customer Ref."
1236+msgstr "Ref. Client"
1237+
1238+#. module: purchase_override
1239+#: field:purchase.order,line_count:0
1240+msgid "Line count"
1241+msgstr "# de lignes"
1242+
1243+#. module: purchase_override
1244+#: report:msf.purchase.order:0
1245+msgid "Source Document :"
1246+msgstr "Document source :"
1247+
1248+#. module: purchase_override
1249+#: report:msf.purchase.order:0
1250+msgid "Customer reference :"
1251+msgstr "Référence client :"
1252+
1253 #. module: specific_rules
1254 #: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:143
1255 msgid "Exp Date"
1256@@ -74688,4 +74869,3 @@
1257 #, python-format
1258 msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."
1259 msgstr "Vous ne pouvez pas exécuter de recherche sur cet objet sans utiliser au moins une recherche exacte (ajoutez le caractère = devant votre filtre)."
1260-
1261
1262=== modified file 'bin/addons/msf_profile/msf_profile.py'
1263--- bin/addons/msf_profile/msf_profile.py 2016-10-04 12:27:11 +0000
1264+++ bin/addons/msf_profile/msf_profile.py 2016-10-28 15:13:51 +0000
1265@@ -891,6 +891,26 @@
1266 currency_id != %s""", (currency_id, tuple(journal_ids), currency_id))
1267
1268
1269+ def us_635_dest_partner_ids(self, cr, uid, *a, **b):
1270+ """
1271+ Fill many2many field dest_partner_ids
1272+ """
1273+ context = {}
1274+ po_obj = self.pool.get('purchase.order')
1275+ so_obj = self.pool.get('sale.order')
1276+
1277+ po_ids = po_obj.search(cr, uid, [], context=context)
1278+ for po_id in po_ids:
1279+ so_ids = po_obj.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
1280+ for so in so_obj.browse(cr, uid, so_ids, context=context):
1281+ if not so.procurement_request:
1282+ po_obj.write(cr, uid, po_id, {
1283+ 'dest_partner_ids': [(4, so.partner_id.id)],
1284+ }, context=context)
1285+
1286+ return True
1287+
1288+
1289 patch_scripts()
1290
1291
1292
1293=== modified file 'bin/addons/msf_supply_doc_export/msf_supply_doc_export.py'
1294--- bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2016-03-15 06:38:29 +0000
1295+++ bin/addons/msf_supply_doc_export/msf_supply_doc_export.py 2016-10-28 15:13:51 +0000
1296@@ -123,6 +123,23 @@
1297 class validated_purchase_order_report_xls(report_sxw.rml_parse):
1298 def __init__(self, cr, uid, name, context):
1299 super(validated_purchase_order_report_xls, self).__init__(cr, uid, name, context=context)
1300+ self.localcontext.update({
1301+ 'time': time,
1302+ 'maxADLines': self.get_max_ad_lines,
1303+ })
1304+
1305+ def set_context(self, objects, data, ids, report_type = None):
1306+ super(validated_purchase_order_report_xls, self).set_context(objects, data, ids, report_type=report_type)
1307+ self.localcontext['need_ad'] = data.get('need_ad', True)
1308+
1309+ def get_max_ad_lines(self, order):
1310+ max_ad_lines = 0
1311+ for line in order.order_line:
1312+ if line.analytic_distribution_id:
1313+ if len(line.analytic_distribution_id.cost_center_lines) > max_ad_lines:
1314+ max_ad_lines = len(line.analytic_distribution_id.cost_center_lines)
1315+
1316+ return max_ad_lines
1317
1318 SpreadsheetReport('report.validated.purchase.order_xls', 'purchase.order', 'addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako', parser=validated_purchase_order_report_xls)
1319
1320@@ -130,6 +147,23 @@
1321 class parser_validated_purchase_order_report_xml(report_sxw.rml_parse):
1322 def __init__(self, cr, uid, name, context):
1323 super(parser_validated_purchase_order_report_xml, self).__init__(cr, uid, name, context=context)
1324+ self.localcontext.update({
1325+ 'time': time,
1326+ 'maxADLines': self.get_max_ad_lines,
1327+ })
1328+
1329+ def set_context(self, objects, data, ids, report_type = None):
1330+ super(parser_validated_purchase_order_report_xml, self).set_context(objects, data, ids, report_type=report_type)
1331+ self.localcontext['need_ad'] = data.get('need_ad', True)
1332+
1333+ def get_max_ad_lines(self, order):
1334+ max_ad_lines = 0
1335+ for line in order.order_line:
1336+ if line.analytic_distribution_id:
1337+ if len(line.analytic_distribution_id.cost_center_lines) > max_ad_lines:
1338+ max_ad_lines = len(line.analytic_distribution_id.cost_center_lines)
1339+
1340+ return max_ad_lines
1341
1342 class validated_purchase_order_report_xml(WebKitParser):
1343 def __init__(self, name, table, rml=False, parser=report_sxw.rml_parse, header='external', store=False):
1344
1345=== modified file 'bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako'
1346--- bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako 2015-01-28 14:08:10 +0000
1347+++ bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xls.mako 2016-10-28 15:13:51 +0000
1348@@ -98,7 +98,8 @@
1349 </Row>
1350
1351 <Row>
1352- <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number*')}</Data></Cell>
1353+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number')}</Data></Cell>
1354+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Reference')}</Data></Cell>
1355 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Code*')}</Data></Cell>
1356 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Description')}</Data></Cell>
1357 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Product Qty*')}</Data></Cell>
1358@@ -114,6 +115,7 @@
1359 % for line in o.move_lines:
1360 <Row>
1361 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.line_number or '')|x}</Data></Cell>
1362+ <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.purchase_line_id and line.purchase_line_id.external_ref or '')|x}</Data></Cell>
1363 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.product_id and line.product_id.default_code or '')|x}</Data></Cell>
1364 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.product_id and line.product_id.name or '')|x}</Data></Cell>
1365 <Cell ss:StyleID="line" ><Data ss:Type="Number">${(line.product_qty or '')|x}</Data></Cell>
1366
1367=== modified file 'bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako'
1368--- bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako 2014-01-15 11:12:34 +0000
1369+++ bin/addons/msf_supply_doc_export/report/report_incoming_shipment_xml.mako 2016-10-28 15:13:51 +0000
1370@@ -15,6 +15,7 @@
1371 % for l in o.move_lines:
1372 <record>
1373 <field name="line_number">${l.line_number or ''}</field>
1374+ <field name="external_ref">${l.purchase_line_id and l.purchase_line_id.external_ref or ''}</field>
1375 <field name="product_id" key="default_code,name">
1376 <field name="product_code">${l.product_id and l.product_id.default_code or ''}</field>
1377 <field name="product_name">${l.product_id and l.product_id.name or ''}</field>
1378
1379=== modified file 'bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako'
1380--- bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako 2014-01-10 10:50:00 +0000
1381+++ bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xls.mako 2016-10-28 15:13:51 +0000
1382@@ -32,6 +32,10 @@
1383 </Borders>
1384 <Protection />
1385 </Style>
1386+ <Style ss:ID="line_wb">
1387+ <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
1388+ <Protection ss:Protected="0" />
1389+ </Style>
1390 <Style ss:ID="line">
1391 <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
1392 <Borders>
1393@@ -57,7 +61,8 @@
1394 ## ==================================== we loop over the purchase_order "objects" == purchase_order ====================================================
1395 % for o in objects:
1396 <ss:Worksheet ss:Name="${"%s"%(o.name.split('/')[-1] or 'Sheet1')|x}" ss:Protected="1">
1397-## definition of the columns' size
1398+ ## definition of the columns' size
1399+<% max_ad_lines = maxADLines(o) %>
1400 <% nb_of_columns = 17 %>
1401 <Table x:FullColumns="1" x:FullRows="1">
1402 <Column ss:AutoFitWidth="1" ss:Width="120" />
1403@@ -165,7 +170,45 @@
1404 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Message ESC Header')}</Data></Cell>
1405 <Cell ss:StyleID="line" ><Data ss:Type="String">${o.message_esc or ''|x}</Data></Cell>
1406 </Row>
1407-
1408+
1409+ % if need_ad and o.analytic_distribution_id:
1410+ <Row>
1411+ <Cell ss:MergeDown="1" ss:StyleID="header" ><Data ss:Type="String">${_('Analytic Distribution')}</Data></Cell>
1412+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell>
1413+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell>
1414+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell>
1415+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell>
1416+ % for x in range(1, len(o.analytic_distribution_id.cost_center_lines)):
1417+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell>
1418+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell>
1419+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell>
1420+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell>
1421+ % endfor
1422+ </Row>
1423+ <Row>
1424+ % for i, ccl in enumerate(o.analytic_distribution_id.cost_center_lines):
1425+ <Cell ss:Index="${(i*4+2)|x}" ss:StyleID="line" ><Data ss:Type="String">${(ccl.destination_id.code or '')|x}</Data></Cell>
1426+ <Cell ss:Index="${(i*4+3)|x}" ss:StyleID="line" ><Data ss:Type="String">${(ccl.analytic_id.code or '')|x}</Data></Cell>
1427+ <Cell ss:Index="${(i*4+4)|x}" ss:StyleID="line" ><Data ss:Type="Number">${(ccl.percentage or 0.00)|x}</Data></Cell>
1428+ <Cell ss:Index="${(i*4+5)|x}" ss:StyleID="line" ><Data ss:Type="Number">${((ccl.percentage/100.00)*o.amount_total or 0.00)|x}</Data></Cell>
1429+ % endfor
1430+ </Row>
1431+ % else:
1432+ <Row>
1433+ <Cell ss:MergeDown="1" ss:StyleID="header" ><Data ss:Type="String">${_('Analytic Distribution')}</Data></Cell>
1434+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell>
1435+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell>
1436+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell>
1437+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell>
1438+ </Row>
1439+ <Row>
1440+ <Cell ss:Index="2" ss:StyleID="line" />
1441+ <Cell ss:Index="3" ss:StyleID="line" />
1442+ <Cell ss:Index="4" ss:StyleID="line" />
1443+ <Cell ss:Index="5" ss:StyleID="line" />
1444+ </Row>
1445+ % endif
1446+
1447 <Row>
1448 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Line number')}</Data></Cell>
1449 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Ext. Ref.')}</Data></Cell>
1450@@ -186,8 +229,22 @@
1451 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Project Ref')}</Data></Cell>
1452 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('ESC Message 1')}</Data></Cell>
1453 <Cell ss:StyleID="header" ><Data ss:Type="String">${_('ESC Message 2')}</Data></Cell>
1454+ % if max_ad_lines:
1455+ % for x in range(1, max_ad_lines+1):
1456+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell>
1457+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell>
1458+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell>
1459+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell>
1460+ % endfor
1461+ % else:
1462+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Destination')}</Data></Cell>
1463+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Cost Center')}</Data></Cell>
1464+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('%')}</Data></Cell>
1465+ <Cell ss:StyleID="header" ><Data ss:Type="String">${_('Subtotal')}</Data></Cell>
1466+ % endif
1467 </Row>
1468 % for line in o.order_line:
1469+ <% len_cc_lines = line.analytic_distribution_id and len(line.analytic_distribution_id.cost_center_lines) or 0 %>
1470 <Row>
1471 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.line_number or '')|x}</Data></Cell>
1472 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.external_ref or '')|x}</Data></Cell>
1473@@ -222,6 +279,27 @@
1474 <Cell ss:StyleID="line" ><Data ss:Type="String">${(line.fnct_project_ref or '')|x}</Data></Cell>
1475 <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1476 <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1477+ % if need_ad:
1478+ % if line.analytic_distribution_id:
1479+ % for ccl in line.analytic_distribution_id.cost_center_lines:
1480+ <Cell ss:StyleID="line" ><Data ss:Type="String">${(ccl.destination_id.code or '')|x}</Data></Cell>
1481+ <Cell ss:StyleID="line" ><Data ss:Type="String">${(ccl.analytic_id.code or '')|x}</Data></Cell>
1482+ <Cell ss:StyleID="line" ><Data ss:Type="Number">${(ccl.percentage or 0.00)|x}</Data></Cell>
1483+ <Cell ss:StyleID="line" ><Data ss:Type="Number">${((ccl.percentage/100.00) * line.price_subtotal or 0.00)|x}</Data></Cell>
1484+ % endfor
1485+ % for x in range(0, max_ad_lines-len_cc_lines):
1486+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1487+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1488+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1489+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1490+ % endfor
1491+ % endif
1492+ % else:
1493+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1494+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1495+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1496+ <Cell ss:StyleID="line" ><Data ss:Type="String"></Data></Cell>
1497+ % endif
1498 </Row>
1499 % endfor
1500 </Table>
1501
1502=== modified file 'bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako'
1503--- bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako 2014-11-05 09:11:22 +0000
1504+++ bin/addons/msf_supply_doc_export/report/report_validated_purchase_order_xml.mako 2016-10-28 15:13:51 +0000
1505@@ -42,6 +42,16 @@
1506 <field name="origin">${o.origin or ''|x}</field>
1507 <field name="project_ref">${o.fnct_project_ref or ''|x}</field>
1508 <field name="message_esc">${o.message_esc or ''|x}</field>
1509+ <field name="analytic_distribution_id">
1510+ % if need_ad and o.analytic_distribution_id:
1511+ % for ccl in o.analytic_distribution_id.cost_center_lines:
1512+ <field name="ad_destination_name">${(ccl.destination_id.name or '')|x}</field>
1513+ <field name="ad_cost_center_name">${(ccl.analytic_id.name or '')|x}</field>
1514+ <field name="ad_percentage">${(ccl.percentage or 0.00)|x}</field>
1515+ <field name="ad_subtotal">${((ccl.percentage/100.00)*o.amount_total or 0.00)|x}</field>
1516+ % endfor
1517+ % endif
1518+ </field>
1519 <field name="order_line">
1520 % for l in o.order_line:
1521 <record>
1522@@ -84,6 +94,16 @@
1523 <field name="project_ref">${l.fnct_project_ref or ''|x}</field>
1524 <field name="message_esc1"></field>
1525 <field name="message_esc2"></field>
1526+ <field name="analytic_distribution_id">
1527+ % if need_ad and l.analytic_distribution_id:
1528+ % for ccl in l.analytic_distribution_id.cost_center_lines:
1529+ <field name="ad_destination_name">${(ccl.destination_id.name or '')|x}</field>
1530+ <field name="ad_cost_center_name">${(ccl.analytic_id.name or '')|x}</field>
1531+ <field name="ad_percentage">${(ccl.percentage or 0.00)|x}</field>
1532+ <field name="ad_subtotal">${((ccl.percentage/100.00)*l.price_subtotal or 0.00)|x}</field>
1533+ % endfor
1534+ % endif
1535+ </field>
1536 </record>
1537 % endfor
1538 </field>
1539
1540=== modified file 'bin/addons/purchase_override/purchase.py'
1541--- bin/addons/purchase_override/purchase.py 2016-10-26 07:22:24 +0000
1542+++ bin/addons/purchase_override/purchase.py 2016-10-28 15:13:51 +0000
1543@@ -236,12 +236,34 @@
1544 return res
1545
1546 def _get_no_line(self, cr, uid, ids, field_name, args, context=None):
1547+ """
1548+ Compute the number of Purchase order lines in each purchase order.
1549+ A split line is count as one line
1550+ :param cr: Cursor to the database
1551+ :param uid: ID of the res.users that calls this method
1552+ :param ids: List of purchase.order ID to compute
1553+ :param field_name: Name of the field to compute
1554+ :param args: Extra parameters
1555+ :param context: Context of the call
1556+ :return: A dictionnary with the purchase.order ID as keys and the number of Purchase
1557+ order lines for each of them as value
1558+ """
1559+ pol_obj = self.pool.get('sale.order.line')
1560+
1561+ if context is None:
1562+ context = {}
1563+
1564+ if isinstance(ids, (int, long)):
1565+ ids = [ids]
1566+
1567 res = {}
1568- for order in self.read(cr, uid, ids, ['order_line'], context=context):
1569- if order['order_line']:
1570- res[order['id']] = False
1571- else:
1572- res[order['id']] = True
1573+
1574+ for order_id in ids:
1575+ res[order_id] = pol_obj.search_count(cr, uid, [
1576+ ('order_id', '=', order_id),
1577+ ('is_line_split', '=', False),
1578+ ], context=context)
1579+
1580 return res
1581
1582 def _po_from_x(self, cr, uid, ids, field_names, args, context=None):
1583@@ -336,6 +358,52 @@
1584
1585 return res
1586
1587+ def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
1588+ '''
1589+ Return a concatenation of the PO's customer references from the project (case of procurement request)
1590+ '''
1591+ if isinstance(ids, (int, long)):
1592+ ids = [ids]
1593+
1594+ res = {}
1595+ so_obj = self.pool.get('sale.order')
1596+ for po_id in ids:
1597+ res[po_id] = ""
1598+
1599+ so_ids = self.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
1600+ for so in so_obj.read(cr, uid, so_ids, ['client_order_ref'], context=context):
1601+ if so['client_order_ref']:
1602+ if res[po_id]:
1603+ res[po_id] += ';'
1604+ res[po_id] += so['client_order_ref']
1605+
1606+ return res
1607+
1608+ def _get_line_count(self, cr, uid, ids, field_name, args, context=None):
1609+ '''
1610+ Return the number of line(s) for the PO
1611+ '''
1612+ pol_obj = self.pool.get('purchase.order.line')
1613+
1614+ if isinstance(ids, (int, long)):
1615+ ids = [ids]
1616+
1617+ line_number_by_order = {}
1618+
1619+ lines = pol_obj.search(cr, uid, [('order_id', 'in', ids)], context=context)
1620+ for l in pol_obj.read(cr, uid, lines, ['order_id', 'line_number'], context=context):
1621+ line_number_by_order.setdefault(l['order_id'][0], set())
1622+ line_number_by_order[l['order_id'][0]].add(l['line_number'])
1623+
1624+ res = {}
1625+ for po_id, ln in line_number_by_order.iteritems():
1626+ res[po_id] = len(ln)
1627+
1628+
1629+ return res
1630+
1631+
1632+
1633 _columns = {
1634 'order_type': fields.selection([('regular', 'Regular'), ('donation_exp', 'Donation before expiry'),
1635 ('donation_st', 'Standard donation'), ('loan', 'Loan'),
1636@@ -418,6 +486,20 @@
1637 ),
1638 # US-1765: register the 1st call of wkf_confirm_trigger to prevent recursion error
1639 'po_confirmed': fields.boolean('PO', readonly=True),
1640+ 'customer_ref': fields.function(
1641+ _get_customer_ref,
1642+ method=True,
1643+ string='Customer Ref.',
1644+ type='text',
1645+ store=False,
1646+ ),
1647+ 'line_count': fields.function(
1648+ _get_line_count,
1649+ method=True,
1650+ type='integer',
1651+ string="Line count",
1652+ store=False,
1653+ ),
1654 }
1655
1656 _defaults = {
1657@@ -3671,6 +3753,20 @@
1658
1659 return res
1660
1661+ def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
1662+ '''
1663+ Return the customer ref from "sale.order".client_order_ref
1664+ '''
1665+ if isinstance(ids, (int, long)):
1666+ ids = [ids]
1667+
1668+ res = {}
1669+ for pol in self.browse(cr, uid, ids, context=context):
1670+ res[pol.id] = pol.procurement_id and pol.procurement_id.sale_id and pol.procurement_id.sale_id.client_order_ref or False
1671+
1672+ return res
1673+
1674+
1675 _columns = {
1676 'is_line_split': fields.boolean(string='This line is a split line?'), # UTP-972: Use boolean to indicate if the line is a split line
1677 'merged_id': fields.many2one('purchase.order.merged.line', string='Merged line'),
1678@@ -3712,6 +3808,13 @@
1679 string='SoQ updated',
1680 readonly=True,
1681 ),
1682+ 'customer_ref': fields.function(
1683+ _get_customer_ref,
1684+ method=True,
1685+ type="text",
1686+ store=False,
1687+ string="Customer ref.",
1688+ ),
1689 }
1690
1691 _defaults = {
1692
1693=== modified file 'bin/addons/purchase_override/purchase_view.xml'
1694--- bin/addons/purchase_override/purchase_view.xml 2016-08-03 12:08:12 +0000
1695+++ bin/addons/purchase_override/purchase_view.xml 2016-10-28 15:13:51 +0000
1696@@ -183,7 +183,9 @@
1697 <field name="partner_id" string="Supplier" />
1698 <field name="delivery_requested_date" />
1699 <field name="origin" />
1700+ <field name="customer_ref"/>
1701 <field name="dest_partner_names" />
1702+ <field name="line_count" />
1703 <field name="shipped_rate" widget="progressbar" />
1704 <field name="invoiced_rate" widget="progressbar" />
1705 <field name="amount_total" />
1706
1707=== modified file 'bin/addons/purchase_override/report/merged_order.rml'
1708--- bin/addons/purchase_override/report/merged_order.rml 2016-03-17 14:54:50 +0000
1709+++ bin/addons/purchase_override/report/merged_order.rml 2016-10-28 15:13:51 +0000
1710@@ -3,7 +3,7 @@
1711
1712 <template pageSize="(842.0,595.0)" title="Purchase Order" author="Medecins Sans Frontieres" allowSplitting="20">
1713 <pageTemplate id="first">
1714- <frame id="first" x1="30.0" y1="15.0" width="772" height="520" />
1715+ <frame id="first" x1="30.0" y1="15.0" width="772" height="500" />
1716
1717 <pageGraphics>
1718 <drawString x="35" y="560.0">PURCHASE ORDER ([[ getSel(objects[0], 'order_type') ]])</drawString>
1719@@ -12,10 +12,11 @@
1720 <image x="700" y="530.0" height="53.3" width="100">[[ company.logo or removeParentNode('image') ]]</image>
1721 <setFont name="Helvetica" size="8"/>
1722 <fill color="black"/>
1723- <drawString x="730" y="520.0">Page : <pageNumber /></drawString>
1724+ <drawString x="700" y="520.0">Page : <pageNumber /></drawString>
1725 <!-- TODO: OEB-148 - Waiting integration on unifield-server -->
1726- <!--<drawString x="765" y="520.0">/</drawString>
1727- <drawString x="770" y="520.0"><pageCount /> </drawString>-->
1728+ <drawString x="735" y="520.0">/</drawString>
1729+ <drawString x="740" y="520.0"><pageCount /> </drawString>
1730+ <drawString x="700" y="510.0">Print date: [[ time.strftime('%d/%b/%Y') ]]</drawString>
1731 </pageGraphics>
1732
1733 </pageTemplate>
1734@@ -74,7 +75,7 @@
1735 <paraStyle name="all" alignment="justify"/>
1736 </initialize>
1737
1738- <paraStyle name="Standard" fontName="Helvetica" fontSize="8.0" />
1739+ <paraStyle name="Standard" fontName="Helvetica" fontSize="7.0" />
1740
1741 <!-- Header font style -->
1742 <paraStyle name="Header" fontName="Helvetica-Bold" fontSize="13.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0" />
1743@@ -83,9 +84,9 @@
1744 <!-- Information font style -->
1745 <paraStyle name="TextInformation" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="3.0" spaceBefore="1.0" spaceAfter="1.0" />
1746 <paraStyle name="TextInformationMail" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1747- <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="9.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1748+ <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1749 <!-- Lines font style -->
1750- <paraStyle name="Lines" fontName="Helvetica" fontSize="6.0" alignment="LEFT" leading="7.0" />
1751+ <paraStyle name="Lines" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1752 <paraStyle name="LinesBlue" textColor="blue" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1753 </stylesheet>
1754
1755
1756=== modified file 'bin/addons/purchase_override/report/purchase_order.rml'
1757--- bin/addons/purchase_override/report/purchase_order.rml 2016-03-21 13:31:17 +0000
1758+++ bin/addons/purchase_override/report/purchase_order.rml 2016-10-28 15:13:51 +0000
1759@@ -3,19 +3,21 @@
1760
1761 <template pageSize="(842.0,595.0)" title="Purchase Order" author="Medecins Sans Frontieres" allowSplitting="20">
1762 <pageTemplate id="first">
1763- <frame id="first" x1="30.0" y1="15.0" width="772" height="520" />
1764+ <frame id="first" x1="30.0" y1="15.0" width="772" height="500" />
1765
1766 <pageGraphics>
1767 <drawString x="35" y="560.0">PURCHASE ORDER ([[ getSel(objects[0], 'order_type') ]])</drawString>
1768 <fill color="blue"/>
1769 <drawString x="35" y="548.0">[[ '%s %s %s' % (getSel(objects[0], 'order_type'), objects[0].name, getSel(objects[0], 'state')) ]]</drawString>
1770+ <drawString x="700" y="548.0">[[ time.strftime('%Y-%m-%d') ]]</drawString>
1771 <image x="700" y="530.0" height="53.3" width="100">[[ company.logo or removeParentNode('image') ]]</image>
1772 <setFont name="Helvetica" size="8"/>
1773 <fill color="black"/>
1774- <drawString x="730" y="520.0">Page : <pageNumber /></drawString>
1775+ <drawString x="700" y="520.0">Page : <pageNumber /></drawString>
1776 <!-- TODO: OEB-148 - Waiting integration on unifield-server -->
1777- <!-- <drawString x="765" y="520.0">/</drawString>
1778- <drawString x="770" y="520.0"><pageCount /> </drawString>-->
1779+ <drawString x="735" y="520.0">/</drawString>
1780+ <drawString x="740" y="520.0"><pageCount /> </drawString>
1781+ <drawString x="700" y="510.0">Print date: [[ time.strftime('%d/%b/%Y') ]]</drawString>
1782 </pageGraphics>
1783
1784 </pageTemplate>
1785@@ -74,7 +76,7 @@
1786 <paraStyle name="all" alignment="justify"/>
1787 </initialize>
1788
1789- <paraStyle name="Standard" fontName="Helvetica" fontSize="8.0" />
1790+ <paraStyle name="Standard" fontName="Helvetica" fontSize="7.0" />
1791
1792 <!-- Header font style -->
1793 <paraStyle name="Header" fontName="Helvetica-Bold" fontSize="13.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0" />
1794@@ -83,9 +85,9 @@
1795 <!-- Information font style -->
1796 <paraStyle name="TextInformation" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="3.0" spaceBefore="1.0" spaceAfter="1.0" />
1797 <paraStyle name="TextInformationMail" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1798- <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="9.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1799+ <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1800 <!-- Lines font style -->
1801- <paraStyle name="Lines" fontName="Helvetica" fontSize="6.0" alignment="LEFT" leading="7.0" />
1802+ <paraStyle name="Lines" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1803 <paraStyle name="LinesBlue" textColor="blue" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1804 </stylesheet>
1805
1806@@ -93,10 +95,10 @@
1807
1808 <para style="Standard">[[ setLang(objects[0].partner_id.lang) ]]</para>
1809
1810- <blockTable colWidths="72.0,600.0,100.0" style="Origin">
1811+ <blockTable colWidths="90.0,582.0,100.0" style="Origin">
1812 <tr>
1813 <td>
1814- <para style="TextInformation">Origin ref. :</para>
1815+ <para style="TextInformation">Source Document :</para>
1816 </td>
1817 <td>
1818 <para style="TextInformation">[[ getOrigin(objects[0].origin, 5)[0] ]]</para>
1819@@ -106,6 +108,17 @@
1820 </td>
1821 </tr>
1822 <tr>
1823+ <td>
1824+ <para style="TextInformation">Customer reference :</para>
1825+ </td>
1826+ <td>
1827+ <para style="TextInformation">[[ objects[0].customer_ref ]]</para>
1828+ </td>
1829+ <td>
1830+ <para style="TextInformation"> </para>
1831+ </td>
1832+ </tr>
1833+ <tr>
1834 [[ repeatIn(getOrigin(objects[0].origin, 5)[1:], 'orig') ]]
1835 <td>
1836 <para style="TextInformation"> </para>
1837
1838=== modified file 'bin/addons/purchase_override/report/rfq.rml'
1839--- bin/addons/purchase_override/report/rfq.rml 2014-03-07 16:46:48 +0000
1840+++ bin/addons/purchase_override/report/rfq.rml 2016-10-28 15:13:51 +0000
1841@@ -3,7 +3,7 @@
1842
1843 <template pageSize="(842.0,595.0)" title="Purchase Order" author="Medecins Sans Frontieres" allowSplitting="20">
1844 <pageTemplate id="first">
1845- <frame id="first" x1="30.0" y1="0.0" width="772" height="520" />
1846+ <frame id="first" x1="30.0" y1="0.0" width="772" height="500" />
1847
1848 <pageGraphics>
1849 <drawString x="35" y="560.0">REQUEST FOR QUOTATION ([[ getSel(objects[0], 'order_type') ]])</drawString>
1850@@ -12,10 +12,11 @@
1851 <image x="700" y="530.0" height="53.3" width="100">[[ company.logo or removeParentNode('image') ]]</image>
1852 <setFont name="Helvetica" size="8"/>
1853 <fill color="black"/>
1854- <drawString x="730" y="520.0">Page : <pageNumber /></drawString>
1855+ <drawString x="700" y="520.0">Page : <pageNumber /></drawString>
1856 <!-- TODO: OEB-148 - Waiting integration on unifield-server -->
1857- <!-- <drawString x="765" y="520.0">/</drawString>
1858- <drawString x="770" y="520.0"><pageCount /> </drawString>-->
1859+ <drawString x="735" y="520.0">/</drawString>
1860+ <drawString x="740" y="520.0"><pageCount /> </drawString>
1861+ <drawString x="700" y="510.0">Print date: [[ time.strftime('%d/%b/%Y') ]]</drawString>
1862 </pageGraphics>
1863
1864 </pageTemplate>
1865@@ -77,11 +78,11 @@
1866 <paraStyle name="Header_9" fontName="Helvetica-Bold" fontSize="8.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0" />
1867 <paraStyle name="HeaderBlue" textColor="blue" fontName="Helvetica-Bold" fontSize="13.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="35.0" />
1868 <!-- Information font style -->
1869- <paraStyle name="TextInformation" fontName="Helvetica" fontSize="9.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1870- <paraStyle name="TextInformationOrigin" fontName="Helvetica" fontSize="8.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1871- <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="9.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1872+ <paraStyle name="TextInformation" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1873+ <paraStyle name="TextInformationOrigin" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" spaceBefore="1.0" spaceAfter="1.0" />
1874+ <paraStyle name="TextRemarks" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="15.0" spaceBefore="1.0" spaceAfter="1.0" />
1875 <!-- Lines font style -->
1876- <paraStyle name="Lines" fontName="Helvetica" fontSize="6.0" alignment="LEFT" leading="7.0" />
1877+ <paraStyle name="Lines" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1878 <paraStyle name="LinesBlue" textColor="blue" fontName="Helvetica" fontSize="7.0" alignment="LEFT" leading="7.0" />
1879 </stylesheet>
1880
1881
1882=== modified file 'bin/addons/res_currency_functional/order_line_view.xml'
1883--- bin/addons/res_currency_functional/order_line_view.xml 2014-10-10 08:22:30 +0000
1884+++ bin/addons/res_currency_functional/order_line_view.xml 2016-10-28 15:13:51 +0000
1885@@ -83,8 +83,9 @@
1886 <field name="from_fo" invisible="1" />
1887 <field name="tender_id" invisible="1" />
1888 <group colspan="2" col="3">
1889- <field name="origin" on_change="on_change_origin(origin, procurement_id, parent.partner_type)" attrs="{'required': [('from_fo', '=', True)], 'readonly': ['|', ('tender_id', '!=', False), ('tender_line_id', '!=', False)]}" />
1890+ <field name="origin" on_change="on_change_origin(origin, procurement_id, parent.partner_type)" attrs="{'required': [('from_fo', '=', True)], 'readonly': ['|', ('tender_id', '!=', False), ('tender_line_id', '!=', False)]}" string="Source Document" />
1891 <field name="select_fo" on_change="on_change_select_fo(select_fo)" nolabel="1" domain="[('state', 'in', ['sourced', 'progress']), '|', ('split_type_sale_order', '=', parent.partner_type == 'esc' and 'esc_split_sale_order' or 'local_purchase_split_sale_order'), ('procurement_request', '=', True)]" attrs="{'invisible': ['|', ('tender_id', '!=', False), ('tender_line_id', '!=', False)]}" />
1892+ <field name="customer_ref" string="Customer ref" widget="char" />
1893 <field name="display_sync_ref" invisible="1" />
1894 <field name="instance_sync_order_ref" attrs="{'required': [('display_sync_ref', '=', True)], 'invisible': [('display_sync_ref', '=', False)]}" domain="[('order_id.name', '=', origin)]" />
1895 </group>
1896
1897=== modified file 'bin/addons/sourcing/procurement_order.py'
1898--- bin/addons/sourcing/procurement_order.py 2016-08-22 13:55:25 +0000
1899+++ bin/addons/sourcing/procurement_order.py 2016-10-28 15:13:51 +0000
1900@@ -226,9 +226,11 @@
1901 purchase_domain.append(('pricelist_id', '=', procurement.rfq_id.pricelist_id.id))
1902
1903 line = None
1904+ order_customer_id = None
1905 sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('procurement_id', '=', procurement.id)], context=context)
1906 if sale_line_ids:
1907 line = self.pool.get('sale.order.line').browse(cr, uid, sale_line_ids[0], context=context)
1908+ order_customer_id = line.order_partner_id.id
1909 if line.product_id.type in ('service', 'service_recep') and not line.order_id.procurement_request:
1910 if ('order_type', '!=', 'direct') in purchase_domain:
1911 purchase_domain.remove(('order_type', '!=', 'direct'))
1912@@ -334,6 +336,8 @@
1913 if values.get('priority') and values['priority'] in priority_sorted.keys() and values['priority'] != po.priority:
1914 if priority_sorted[values['priority']] < priority_sorted[po.priority]:
1915 write_values['priority'] = values['priority']
1916+ if order_customer_id:
1917+ write_values['dest_partner_ids'] = [(4, order_customer_id)]
1918
1919 self.pool.get('purchase.order').write(cr, uid, purchase_ids[0], write_values, context=dict(context, import_in_progress=True))
1920
1921@@ -387,6 +391,8 @@
1922 values.update({'location_id': input_id, })
1923 if categ:
1924 values.update({'categ': categ})
1925+ if order_customer_id:
1926+ values['dest_partner_ids'] = [(4, order_customer_id)]
1927 purchase_id = super(procurement_order, self).create_po_hook(cr, uid, ids, context=context, *args, **kwargs)
1928
1929 if ir_to_link:

Subscribers

People subscribed via source and target branches

to all changes: