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
=== modified file 'bin/addons/msf_custom_settings/view/purchase_view.xml'
--- bin/addons/msf_custom_settings/view/purchase_view.xml 2016-04-19 08:57:07 +0000
+++ bin/addons/msf_custom_settings/view/purchase_view.xml 2016-10-28 15:13:29 +0000
@@ -40,6 +40,8 @@
40 <field name="partner_address_id" attrs="{'readonly': [('state', 'in', ['sourced', 'split', 'rfq_sent', 'rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>40 <field name="partner_address_id" attrs="{'readonly': [('state', 'in', ['sourced', 'split', 'rfq_sent', 'rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>
41 <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"/>41 <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"/>
42 <field name="internal_type" string="Zone" />42 <field name="internal_type" string="Zone" />
43 <field name="customer_ref" widget="char" />
44 <label colspan="2"></label>
43 <field name="pricelist_id" string="Currency" domain="[('type', '=', 'purchase'), ('in_search', '=', partner_type)]"45 <field name="pricelist_id" string="Currency" domain="[('type', '=', 'purchase'), ('in_search', '=', partner_type)]"
44 colspan="3" attrs="{'readonly': [('state', 'in', ['rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>46 colspan="3" attrs="{'readonly': [('state', 'in', ['rfq_updated', 'done', 'cancel', 'confirmed_wait', 'approved', 'except_picking', 'except_invoice'])]}"/>
45 </group>47 </group>
4648
=== modified file 'bin/addons/msf_profile/data/patches.xml'
--- bin/addons/msf_profile/data/patches.xml 2016-10-04 12:27:11 +0000
+++ bin/addons/msf_profile/data/patches.xml 2016-10-28 15:13:29 +0000
@@ -110,5 +110,9 @@
110 <record id="us_1766_fix_fxa_aji_curr" model="patch.scripts">110 <record id="us_1766_fix_fxa_aji_curr" model="patch.scripts">
111 <field name="method">us_1766_fix_fxa_aji_curr</field>111 <field name="method">us_1766_fix_fxa_aji_curr</field>
112 </record>112 </record>
113
114 <record id="us_635_dest_partner_ids" model="patch.scripts">
115 <field name="method">us_635_dest_partner_ids</field>
116 </record>
113 </data>117 </data>
114</openerp>118</openerp>
115119
=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2016-10-25 09:13:52 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2016-10-28 15:13:29 +0000
@@ -53245,8 +53245,10 @@
53245msgid "Child Nomenclatures"53245msgid "Child Nomenclatures"
53246msgstr "Nomenclatures Enfant"53246msgstr "Nomenclatures Enfant"
5324753247
53248#. module: product53248#. modules: sales_followup, product, res_currency_functional
53249#: field:product.product,partner_ref:053249#: field:product.product,partner_ref:0
53250#: view:purchase.order.line:0
53251#: report:addons/sales_followup/report/sale_follow_up_multi_report_xls.mako:216
53250msgid "Customer ref"53252msgid "Customer ref"
53251msgstr "Réf. Client"53253msgstr "Réf. Client"
5325253254
@@ -74617,6 +74619,7 @@
74617" Number of columns is not equal to %s"74619" Number of columns is not equal to %s"
74618msgstr "\n"74620msgstr "\n"
74619" Le nombre de colonnes n'est pas égal à %s"74621" Le nombre de colonnes n'est pas égal à %s"
74622<<<<<<< TREE
7462074623
74621#. module: specific_rules74624#. module: specific_rules
74622#: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:14374625#: report:addons/specific_rules/report/report_stock_inventory_all_locations_xls.mako:143
@@ -74689,3 +74692,32 @@
74689msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."74692msgid "You can't search on this object without using at least one exact search term (precede your search with the character '=')."
74690msgstr "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)."74693msgstr "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)."
7469174694
74695=======
74696
74697#. module: purchase_override
74698#: field:purchase.order.line,customer_ref:0
74699msgid "Customer ref."
74700msgstr "Ref. Client"
74701
74702#. module: purchase_override
74703#: field:purchase.order,customer_ref:0
74704msgid "Customer Ref."
74705msgstr "Ref. Client"
74706
74707#. module: purchase_override
74708#: field:purchase.order,line_count:0
74709msgid "Line count"
74710msgstr "# de lignes"
74711
74712#. module: purchase_override
74713#: report:msf.purchase.order:0
74714msgid "Source Document :"
74715msgstr "Document source :"
74716
74717#. module: purchase_override
74718#: report:msf.purchase.order:0
74719msgid "Customer reference :"
74720msgstr "Référence client :"
74721
74722
74723>>>>>>> MERGE-SOURCE
7469274724
=== modified file 'bin/addons/msf_profile/msf_profile.py'
--- bin/addons/msf_profile/msf_profile.py 2016-10-04 12:27:11 +0000
+++ bin/addons/msf_profile/msf_profile.py 2016-10-28 15:13:29 +0000
@@ -891,6 +891,26 @@
891 currency_id != %s""", (currency_id, tuple(journal_ids), currency_id))891 currency_id != %s""", (currency_id, tuple(journal_ids), currency_id))
892892
893893
894 def us_635_dest_partner_ids(self, cr, uid, *a, **b):
895 """
896 Fill many2many field dest_partner_ids
897 """
898 context = {}
899 po_obj = self.pool.get('purchase.order')
900 so_obj = self.pool.get('sale.order')
901
902 po_ids = po_obj.search(cr, uid, [], context=context)
903 for po_id in po_ids:
904 so_ids = po_obj.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
905 for so in so_obj.browse(cr, uid, so_ids, context=context):
906 if not so.procurement_request:
907 po_obj.write(cr, uid, po_id, {
908 'dest_partner_ids': [(4, so.partner_id.id)],
909 }, context=context)
910
911 return True
912
913
894patch_scripts()914patch_scripts()
895915
896916
897917
=== modified file 'bin/addons/purchase_override/purchase.py'
--- bin/addons/purchase_override/purchase.py 2016-10-26 07:22:24 +0000
+++ bin/addons/purchase_override/purchase.py 2016-10-28 15:13:29 +0000
@@ -236,12 +236,34 @@
236 return res236 return res
237237
238 def _get_no_line(self, cr, uid, ids, field_name, args, context=None):238 def _get_no_line(self, cr, uid, ids, field_name, args, context=None):
239 """
240 Compute the number of Purchase order lines in each purchase order.
241 A split line is count as one line
242 :param cr: Cursor to the database
243 :param uid: ID of the res.users that calls this method
244 :param ids: List of purchase.order ID to compute
245 :param field_name: Name of the field to compute
246 :param args: Extra parameters
247 :param context: Context of the call
248 :return: A dictionnary with the purchase.order ID as keys and the number of Purchase
249 order lines for each of them as value
250 """
251 pol_obj = self.pool.get('sale.order.line')
252
253 if context is None:
254 context = {}
255
256 if isinstance(ids, (int, long)):
257 ids = [ids]
258
239 res = {}259 res = {}
240 for order in self.read(cr, uid, ids, ['order_line'], context=context):260
241 if order['order_line']:261 for order_id in ids:
242 res[order['id']] = False262 res[order_id] = pol_obj.search_count(cr, uid, [
243 else:263 ('order_id', '=', order_id),
244 res[order['id']] = True264 ('is_line_split', '=', False),
265 ], context=context)
266
245 return res267 return res
246268
247 def _po_from_x(self, cr, uid, ids, field_names, args, context=None):269 def _po_from_x(self, cr, uid, ids, field_names, args, context=None):
@@ -336,6 +358,52 @@
336358
337 return res359 return res
338360
361 def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
362 '''
363 Return a concatenation of the PO's customer references from the project (case of procurement request)
364 '''
365 if isinstance(ids, (int, long)):
366 ids = [ids]
367
368 res = {}
369 so_obj = self.pool.get('sale.order')
370 for po_id in ids:
371 res[po_id] = ""
372
373 so_ids = self.get_so_ids_from_po_ids(cr, uid, po_id, context=context)
374 for so in so_obj.read(cr, uid, so_ids, ['client_order_ref'], context=context):
375 if so['client_order_ref']:
376 if res[po_id]:
377 res[po_id] += ';'
378 res[po_id] += so['client_order_ref']
379
380 return res
381
382 def _get_line_count(self, cr, uid, ids, field_name, args, context=None):
383 '''
384 Return the number of line(s) for the PO
385 '''
386 pol_obj = self.pool.get('purchase.order.line')
387
388 if isinstance(ids, (int, long)):
389 ids = [ids]
390
391 line_number_by_order = {}
392
393 lines = pol_obj.search(cr, uid, [('order_id', 'in', ids)], context=context)
394 for l in pol_obj.read(cr, uid, lines, ['order_id', 'line_number'], context=context):
395 line_number_by_order.setdefault(l['order_id'][0], set())
396 line_number_by_order[l['order_id'][0]].add(l['line_number'])
397
398 res = {}
399 for po_id, ln in line_number_by_order.iteritems():
400 res[po_id] = len(ln)
401
402
403 return res
404
405
406
339 _columns = {407 _columns = {
340 'order_type': fields.selection([('regular', 'Regular'), ('donation_exp', 'Donation before expiry'),408 'order_type': fields.selection([('regular', 'Regular'), ('donation_exp', 'Donation before expiry'),
341 ('donation_st', 'Standard donation'), ('loan', 'Loan'),409 ('donation_st', 'Standard donation'), ('loan', 'Loan'),
@@ -416,8 +484,25 @@
416 string='Update in progress',484 string='Update in progress',
417 readonly=True,485 readonly=True,
418 ),486 ),
487<<<<<<< TREE
419 # US-1765: register the 1st call of wkf_confirm_trigger to prevent recursion error488 # US-1765: register the 1st call of wkf_confirm_trigger to prevent recursion error
420 'po_confirmed': fields.boolean('PO', readonly=True),489 'po_confirmed': fields.boolean('PO', readonly=True),
490=======
491 'customer_ref': fields.function(
492 _get_customer_ref,
493 method=True,
494 string='Customer Ref.',
495 type='text',
496 store=False,
497 ),
498 'line_count': fields.function(
499 _get_line_count,
500 method=True,
501 type='integer',
502 string="Line count",
503 store=False,
504 ),
505>>>>>>> MERGE-SOURCE
421 }506 }
422507
423 _defaults = {508 _defaults = {
@@ -3671,6 +3756,20 @@
36713756
3672 return res3757 return res
36733758
3759 def _get_customer_ref(self, cr, uid, ids, field_name, args, context=None):
3760 '''
3761 Return the customer ref from "sale.order".client_order_ref
3762 '''
3763 if isinstance(ids, (int, long)):
3764 ids = [ids]
3765
3766 res = {}
3767 for pol in self.browse(cr, uid, ids, context=context):
3768 res[pol.id] = pol.procurement_id and pol.procurement_id.sale_id and pol.procurement_id.sale_id.client_order_ref or False
3769
3770 return res
3771
3772
3674 _columns = {3773 _columns = {
3675 'is_line_split': fields.boolean(string='This line is a split line?'), # UTP-972: Use boolean to indicate if the line is a split line3774 '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
3676 'merged_id': fields.many2one('purchase.order.merged.line', string='Merged line'),3775 'merged_id': fields.many2one('purchase.order.merged.line', string='Merged line'),
@@ -3712,6 +3811,13 @@
3712 string='SoQ updated',3811 string='SoQ updated',
3713 readonly=True,3812 readonly=True,
3714 ),3813 ),
3814 'customer_ref': fields.function(
3815 _get_customer_ref,
3816 method=True,
3817 type="text",
3818 store=False,
3819 string="Customer ref.",
3820 ),
3715 }3821 }
37163822
3717 _defaults = {3823 _defaults = {
37183824
=== modified file 'bin/addons/purchase_override/purchase_view.xml'
--- bin/addons/purchase_override/purchase_view.xml 2016-08-03 12:08:12 +0000
+++ bin/addons/purchase_override/purchase_view.xml 2016-10-28 15:13:29 +0000
@@ -183,7 +183,9 @@
183 <field name="partner_id" string="Supplier" />183 <field name="partner_id" string="Supplier" />
184 <field name="delivery_requested_date" />184 <field name="delivery_requested_date" />
185 <field name="origin" />185 <field name="origin" />
186 <field name="customer_ref"/>
186 <field name="dest_partner_names" />187 <field name="dest_partner_names" />
188 <field name="line_count" />
187 <field name="shipped_rate" widget="progressbar" />189 <field name="shipped_rate" widget="progressbar" />
188 <field name="invoiced_rate" widget="progressbar" />190 <field name="invoiced_rate" widget="progressbar" />
189 <field name="amount_total" />191 <field name="amount_total" />
190192
=== modified file 'bin/addons/purchase_override/report/purchase_order.rml'
--- bin/addons/purchase_override/report/purchase_order.rml 2016-03-21 13:31:17 +0000
+++ bin/addons/purchase_override/report/purchase_order.rml 2016-10-28 15:13:29 +0000
@@ -93,10 +93,10 @@
9393
94 <para style="Standard">[[ setLang(objects[0].partner_id.lang) ]]</para>94 <para style="Standard">[[ setLang(objects[0].partner_id.lang) ]]</para>
9595
96 <blockTable colWidths="72.0,600.0,100.0" style="Origin">96 <blockTable colWidths="90.0,582.0,100.0" style="Origin">
97 <tr>97 <tr>
98 <td>98 <td>
99 <para style="TextInformation">Origin ref. :</para>99 <para style="TextInformation">Source Document :</para>
100 </td>100 </td>
101 <td>101 <td>
102 <para style="TextInformation">[[ getOrigin(objects[0].origin, 5)[0] ]]</para>102 <para style="TextInformation">[[ getOrigin(objects[0].origin, 5)[0] ]]</para>
@@ -106,6 +106,17 @@
106 </td>106 </td>
107 </tr>107 </tr>
108 <tr>108 <tr>
109 <td>
110 <para style="TextInformation">Customer reference :</para>
111 </td>
112 <td>
113 <para style="TextInformation">[[ objects[0].customer_ref ]]</para>
114 </td>
115 <td>
116 <para style="TextInformation"> </para>
117 </td>
118 </tr>
119 <tr>
109 [[ repeatIn(getOrigin(objects[0].origin, 5)[1:], 'orig') ]]120 [[ repeatIn(getOrigin(objects[0].origin, 5)[1:], 'orig') ]]
110 <td>121 <td>
111 <para style="TextInformation"> </para>122 <para style="TextInformation"> </para>
112123
=== modified file 'bin/addons/res_currency_functional/order_line_view.xml'
--- bin/addons/res_currency_functional/order_line_view.xml 2014-10-10 08:22:30 +0000
+++ bin/addons/res_currency_functional/order_line_view.xml 2016-10-28 15:13:29 +0000
@@ -83,8 +83,9 @@
83 <field name="from_fo" invisible="1" />83 <field name="from_fo" invisible="1" />
84 <field name="tender_id" invisible="1" />84 <field name="tender_id" invisible="1" />
85 <group colspan="2" col="3">85 <group colspan="2" col="3">
86 <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)]}" />86 <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" />
87 <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)]}" />87 <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)]}" />
88 <field name="customer_ref" string="Customer ref" widget="char" />
88 <field name="display_sync_ref" invisible="1" />89 <field name="display_sync_ref" invisible="1" />
89 <field name="instance_sync_order_ref" attrs="{'required': [('display_sync_ref', '=', True)], 'invisible': [('display_sync_ref', '=', False)]}" domain="[('order_id.name', '=', origin)]" />90 <field name="instance_sync_order_ref" attrs="{'required': [('display_sync_ref', '=', True)], 'invisible': [('display_sync_ref', '=', False)]}" domain="[('order_id.name', '=', origin)]" />
90 </group>91 </group>
9192
=== modified file 'bin/addons/sourcing/procurement_order.py'
--- bin/addons/sourcing/procurement_order.py 2016-08-22 13:55:25 +0000
+++ bin/addons/sourcing/procurement_order.py 2016-10-28 15:13:29 +0000
@@ -226,9 +226,11 @@
226 purchase_domain.append(('pricelist_id', '=', procurement.rfq_id.pricelist_id.id))226 purchase_domain.append(('pricelist_id', '=', procurement.rfq_id.pricelist_id.id))
227227
228 line = None228 line = None
229 order_customer_id = None
229 sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('procurement_id', '=', procurement.id)], context=context)230 sale_line_ids = self.pool.get('sale.order.line').search(cr, uid, [('procurement_id', '=', procurement.id)], context=context)
230 if sale_line_ids:231 if sale_line_ids:
231 line = self.pool.get('sale.order.line').browse(cr, uid, sale_line_ids[0], context=context)232 line = self.pool.get('sale.order.line').browse(cr, uid, sale_line_ids[0], context=context)
233 order_customer_id = line.order_partner_id.id
232 if line.product_id.type in ('service', 'service_recep') and not line.order_id.procurement_request:234 if line.product_id.type in ('service', 'service_recep') and not line.order_id.procurement_request:
233 if ('order_type', '!=', 'direct') in purchase_domain:235 if ('order_type', '!=', 'direct') in purchase_domain:
234 purchase_domain.remove(('order_type', '!=', 'direct'))236 purchase_domain.remove(('order_type', '!=', 'direct'))
@@ -334,6 +336,8 @@
334 if values.get('priority') and values['priority'] in priority_sorted.keys() and values['priority'] != po.priority:336 if values.get('priority') and values['priority'] in priority_sorted.keys() and values['priority'] != po.priority:
335 if priority_sorted[values['priority']] < priority_sorted[po.priority]:337 if priority_sorted[values['priority']] < priority_sorted[po.priority]:
336 write_values['priority'] = values['priority']338 write_values['priority'] = values['priority']
339 if order_customer_id:
340 write_values['dest_partner_ids'] = [(4, order_customer_id)]
337341
338 self.pool.get('purchase.order').write(cr, uid, purchase_ids[0], write_values, context=dict(context, import_in_progress=True))342 self.pool.get('purchase.order').write(cr, uid, purchase_ids[0], write_values, context=dict(context, import_in_progress=True))
339343
@@ -387,6 +391,8 @@
387 values.update({'location_id': input_id, })391 values.update({'location_id': input_id, })
388 if categ:392 if categ:
389 values.update({'categ': categ})393 values.update({'categ': categ})
394 if order_customer_id:
395 values['dest_partner_ids'] = [(4, order_customer_id)]
390 purchase_id = super(procurement_order, self).create_po_hook(cr, uid, ids, context=context, *args, **kwargs)396 purchase_id = super(procurement_order, self).create_po_hook(cr, uid, ids, context=context, *args, **kwargs)
391397
392 if ir_to_link:398 if ir_to_link:

Subscribers

People subscribed via source and target branches

to all changes: