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

Proposed by Quentin THEURET @Amaris
Status: Merged
Merged at revision: 4025
Proposed branch: lp:~unifield-team/unifield-server/us-635
Merge into: lp:unifield-server
Diff against target: 370 lines (+193/-9) (has conflicts)
9 files modified
bin/addons/msf_custom_settings/view/purchase_view.xml (+2/-0)
bin/addons/msf_profile/data/patches.xml (+4/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+33/-1)
bin/addons/msf_profile/msf_profile.py (+20/-0)
bin/addons/purchase_override/purchase.py (+111/-5)
bin/addons/purchase_override/purchase_view.xml (+2/-0)
bin/addons/purchase_override/report/purchase_order.rml (+13/-2)
bin/addons/res_currency_functional/order_line_view.xml (+2/-1)
bin/addons/sourcing/procurement_order.py (+6/-0)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
Text conflict in bin/addons/purchase_override/purchase.py
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-635
Reviewer Review Type Date Requested Status
Quentin THEURET @Amaris Pending
Review via email: mp+309025@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/msf_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:29 +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_profile/data/patches.xml'
15--- bin/addons/msf_profile/data/patches.xml 2016-10-04 12:27:11 +0000
16+++ bin/addons/msf_profile/data/patches.xml 2016-10-28 15:13:29 +0000
17@@ -110,5 +110,9 @@
18 <record id="us_1766_fix_fxa_aji_curr" model="patch.scripts">
19 <field name="method">us_1766_fix_fxa_aji_curr</field>
20 </record>
21+
22+ <record id="us_635_dest_partner_ids" model="patch.scripts">
23+ <field name="method">us_635_dest_partner_ids</field>
24+ </record>
25 </data>
26 </openerp>
27
28=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
29--- bin/addons/msf_profile/i18n/fr_MF.po 2016-10-25 09:13:52 +0000
30+++ bin/addons/msf_profile/i18n/fr_MF.po 2016-10-28 15:13:29 +0000
31@@ -53245,8 +53245,10 @@
32 msgid "Child Nomenclatures"
33 msgstr "Nomenclatures Enfant"
34
35-#. module: product
36+#. modules: sales_followup, product, res_currency_functional
37 #: field:product.product,partner_ref:0
38+#: view:purchase.order.line:0
39+#: report:addons/sales_followup/report/sale_follow_up_multi_report_xls.mako:216
40 msgid "Customer ref"
41 msgstr "Réf. Client"
42
43@@ -74617,6 +74619,7 @@
44 " Number of columns is not equal to %s"
45 msgstr "\n"
46 " Le nombre de colonnes n'est pas égal à %s"
47+<<<<<<< TREE
48
49 #. module: specific_rules
50 #: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:143
51@@ -74689,3 +74692,32 @@
52 msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."
53 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)."
54
55+=======
56+
57+#. module: purchase_override
58+#: field:purchase.order.line,customer_ref:0
59+msgid "Customer ref."
60+msgstr "Ref. Client"
61+
62+#. module: purchase_override
63+#: field:purchase.order,customer_ref:0
64+msgid "Customer Ref."
65+msgstr "Ref. Client"
66+
67+#. module: purchase_override
68+#: field:purchase.order,line_count:0
69+msgid "Line count"
70+msgstr "# de lignes"
71+
72+#. module: purchase_override
73+#: report:msf.purchase.order:0
74+msgid "Source Document :"
75+msgstr "Document source :"
76+
77+#. module: purchase_override
78+#: report:msf.purchase.order:0
79+msgid "Customer reference :"
80+msgstr "Référence client :"
81+
82+
83+>>>>>>> MERGE-SOURCE
84
85=== modified file 'bin/addons/msf_profile/msf_profile.py'
86--- bin/addons/msf_profile/msf_profile.py 2016-10-04 12:27:11 +0000
87+++ bin/addons/msf_profile/msf_profile.py 2016-10-28 15:13:29 +0000
88@@ -891,6 +891,26 @@
89 currency_id != %s""", (currency_id, tuple(journal_ids), currency_id))
90
91
92+ def us_635_dest_partner_ids(self, cr, uid, *a, **b):
93+ """
94+ Fill many2many field dest_partner_ids
95+ """
96+ context = {}
97+ po_obj = self.pool.get('purchase.order')
98+ so_obj = self.pool.get('sale.order')
99+
100+ po_ids = po_obj.search(cr, uid, [], context=context)
101+ for po_id in po_ids:
102+ so_ids = po_obj.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
103+ for so in so_obj.browse(cr, uid, so_ids, context=context):
104+ if not so.procurement_request:
105+ po_obj.write(cr, uid, po_id, {
106+ 'dest_partner_ids': [(4, so.partner_id.id)],
107+ }, context=context)
108+
109+ return True
110+
111+
112 patch_scripts()
113
114
115
116=== modified file 'bin/addons/purchase_override/purchase.py'
117--- bin/addons/purchase_override/purchase.py 2016-10-26 07:22:24 +0000
118+++ bin/addons/purchase_override/purchase.py 2016-10-28 15:13:29 +0000
119@@ -236,12 +236,34 @@
120 return res
121
122 def _get_no_line(self, cr, uid, ids, field_name, args, context=None):
123+ """
124+ Compute the number of Purchase order lines in each purchase order.
125+ A split line is count as one line
126+ :param cr: Cursor to the database
127+ :param uid: ID of the res.users that calls this method
128+ :param ids: List of purchase.order ID to compute
129+ :param field_name: Name of the field to compute
130+ :param args: Extra parameters
131+ :param context: Context of the call
132+ :return: A dictionnary with the purchase.order ID as keys and the number of Purchase
133+ order lines for each of them as value
134+ """
135+ pol_obj = self.pool.get('sale.order.line')
136+
137+ if context is None:
138+ context = {}
139+
140+ if isinstance(ids, (int, long)):
141+ ids = [ids]
142+
143 res = {}
144- for order in self.read(cr, uid, ids, ['order_line'], context=context):
145- if order['order_line']:
146- res[order['id']] = False
147- else:
148- res[order['id']] = True
149+
150+ for order_id in ids:
151+ res[order_id] = pol_obj.search_count(cr, uid, [
152+ ('order_id', '=', order_id),
153+ ('is_line_split', '=', False),
154+ ], context=context)
155+
156 return res
157
158 def _po_from_x(self, cr, uid, ids, field_names, args, context=None):
159@@ -336,6 +358,52 @@
160
161 return res
162
163+ def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
164+ '''
165+ Return a concatenation of the PO's customer references from the project (case of procurement request)
166+ '''
167+ if isinstance(ids, (int, long)):
168+ ids = [ids]
169+
170+ res = {}
171+ so_obj = self.pool.get('sale.order')
172+ for po_id in ids:
173+ res[po_id] = ""
174+
175+ so_ids = self.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
176+ for so in so_obj.read(cr, uid, so_ids, ['client_order_ref'], context=context):
177+ if so['client_order_ref']:
178+ if res[po_id]:
179+ res[po_id] += ';'
180+ res[po_id] += so['client_order_ref']
181+
182+ return res
183+
184+ def _get_line_count(self, cr, uid, ids, field_name, args, context=None):
185+ '''
186+ Return the number of line(s) for the PO
187+ '''
188+ pol_obj = self.pool.get('purchase.order.line')
189+
190+ if isinstance(ids, (int, long)):
191+ ids = [ids]
192+
193+ line_number_by_order = {}
194+
195+ lines = pol_obj.search(cr, uid, [('order_id', 'in', ids)], context=context)
196+ for l in pol_obj.read(cr, uid, lines, ['order_id', 'line_number'], context=context):
197+ line_number_by_order.setdefault(l['order_id'][0], set())
198+ line_number_by_order[l['order_id'][0]].add(l['line_number'])
199+
200+ res = {}
201+ for po_id, ln in line_number_by_order.iteritems():
202+ res[po_id] = len(ln)
203+
204+
205+ return res
206+
207+
208+
209 _columns = {
210 'order_type': fields.selection([('regular', 'Regular'), ('donation_exp', 'Donation before expiry'),
211 ('donation_st', 'Standard donation'), ('loan', 'Loan'),
212@@ -416,8 +484,25 @@
213 string='Update in progress',
214 readonly=True,
215 ),
216+<<<<<<< TREE
217 # US-1765: register the 1st call of wkf_confirm_trigger to prevent recursion error
218 'po_confirmed': fields.boolean('PO', readonly=True),
219+=======
220+ 'customer_ref': fields.function(
221+ _get_customer_ref,
222+ method=True,
223+ string='Customer Ref.',
224+ type='text',
225+ store=False,
226+ ),
227+ 'line_count': fields.function(
228+ _get_line_count,
229+ method=True,
230+ type='integer',
231+ string="Line count",
232+ store=False,
233+ ),
234+>>>>>>> MERGE-SOURCE
235 }
236
237 _defaults = {
238@@ -3671,6 +3756,20 @@
239
240 return res
241
242+ def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
243+ '''
244+ Return the customer ref from "sale.order".client_order_ref
245+ '''
246+ if isinstance(ids, (int, long)):
247+ ids = [ids]
248+
249+ res = {}
250+ for pol in self.browse(cr, uid, ids, context=context):
251+ res[pol.id] = pol.procurement_id and pol.procurement_id.sale_id and pol.procurement_id.sale_id.client_order_ref or False
252+
253+ return res
254+
255+
256 _columns = {
257 '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
258 'merged_id': fields.many2one('purchase.order.merged.line', string='Merged line'),
259@@ -3712,6 +3811,13 @@
260 string='SoQ updated',
261 readonly=True,
262 ),
263+ 'customer_ref': fields.function(
264+ _get_customer_ref,
265+ method=True,
266+ type="text",
267+ store=False,
268+ string="Customer ref.",
269+ ),
270 }
271
272 _defaults = {
273
274=== modified file 'bin/addons/purchase_override/purchase_view.xml'
275--- bin/addons/purchase_override/purchase_view.xml 2016-08-03 12:08:12 +0000
276+++ bin/addons/purchase_override/purchase_view.xml 2016-10-28 15:13:29 +0000
277@@ -183,7 +183,9 @@
278 <field name="partner_id" string="Supplier" />
279 <field name="delivery_requested_date" />
280 <field name="origin" />
281+ <field name="customer_ref"/>
282 <field name="dest_partner_names" />
283+ <field name="line_count" />
284 <field name="shipped_rate" widget="progressbar" />
285 <field name="invoiced_rate" widget="progressbar" />
286 <field name="amount_total" />
287
288=== modified file 'bin/addons/purchase_override/report/purchase_order.rml'
289--- bin/addons/purchase_override/report/purchase_order.rml 2016-03-21 13:31:17 +0000
290+++ bin/addons/purchase_override/report/purchase_order.rml 2016-10-28 15:13:29 +0000
291@@ -93,10 +93,10 @@
292
293 <para style="Standard">[[ setLang(objects[0].partner_id.lang) ]]</para>
294
295- <blockTable colWidths="72.0,600.0,100.0" style="Origin">
296+ <blockTable colWidths="90.0,582.0,100.0" style="Origin">
297 <tr>
298 <td>
299- <para style="TextInformation">Origin ref. :</para>
300+ <para style="TextInformation">Source Document :</para>
301 </td>
302 <td>
303 <para style="TextInformation">[[ getOrigin(objects[0].origin, 5)[0] ]]</para>
304@@ -106,6 +106,17 @@
305 </td>
306 </tr>
307 <tr>
308+ <td>
309+ <para style="TextInformation">Customer reference :</para>
310+ </td>
311+ <td>
312+ <para style="TextInformation">[[ objects[0].customer_ref ]]</para>
313+ </td>
314+ <td>
315+ <para style="TextInformation"> </para>
316+ </td>
317+ </tr>
318+ <tr>
319 [[ repeatIn(getOrigin(objects[0].origin, 5)[1:], 'orig') ]]
320 <td>
321 <para style="TextInformation"> </para>
322
323=== modified file 'bin/addons/res_currency_functional/order_line_view.xml'
324--- bin/addons/res_currency_functional/order_line_view.xml 2014-10-10 08:22:30 +0000
325+++ bin/addons/res_currency_functional/order_line_view.xml 2016-10-28 15:13:29 +0000
326@@ -83,8 +83,9 @@
327 <field name="from_fo" invisible="1" />
328 <field name="tender_id" invisible="1" />
329 <group colspan="2" col="3">
330- <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)]}" />
331+ <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" />
332 <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)]}" />
333+ <field name="customer_ref" string="Customer ref" widget="char" />
334 <field name="display_sync_ref" invisible="1" />
335 <field name="instance_sync_order_ref" attrs="{'required': [('display_sync_ref', '=', True)], 'invisible': [('display_sync_ref', '=', False)]}" domain="[('order_id.name', '=', origin)]" />
336 </group>
337
338=== modified file 'bin/addons/sourcing/procurement_order.py'
339--- bin/addons/sourcing/procurement_order.py 2016-08-22 13:55:25 +0000
340+++ bin/addons/sourcing/procurement_order.py 2016-10-28 15:13:29 +0000
341@@ -226,9 +226,11 @@
342 purchase_domain.append(('pricelist_id', '=', procurement.rfq_id.pricelist_id.id))
343
344 line = None
345+ order_customer_id = None
346 sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('procurement_id', '=', procurement.id)], context=context)
347 if sale_line_ids:
348 line = self.pool.get('sale.order.line').browse(cr, uid, sale_line_ids[0], context=context)
349+ order_customer_id = line.order_partner_id.id
350 if line.product_id.type in ('service', 'service_recep') and not line.order_id.procurement_request:
351 if ('order_type', '!=', 'direct') in purchase_domain:
352 purchase_domain.remove(('order_type', '!=', 'direct'))
353@@ -334,6 +336,8 @@
354 if values.get('priority') and values['priority'] in priority_sorted.keys() and values['priority'] != po.priority:
355 if priority_sorted[values['priority']] < priority_sorted[po.priority]:
356 write_values['priority'] = values['priority']
357+ if order_customer_id:
358+ write_values['dest_partner_ids'] = [(4, order_customer_id)]
359
360 self.pool.get('purchase.order').write(cr, uid, purchase_ids[0], write_values, context=dict(context, import_in_progress=True))
361
362@@ -387,6 +391,8 @@
363 values.update({'location_id': input_id, })
364 if categ:
365 values.update({'categ': categ})
366+ if order_customer_id:
367+ values['dest_partner_ids'] = [(4, order_customer_id)]
368 purchase_id = super(procurement_order, self).create_po_hook(cr, uid, ids, context=context, *args, **kwargs)
369
370 if ir_to_link:

Subscribers

People subscribed via source and target branches

to all changes: