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

Proposed by jftempo
Status: Merged
Merged at revision: 5989
Proposed branch: lp:~dorian-kemps/unifield-server/US-7816
Merge into: lp:unifield-server
Diff against target: 221 lines (+72/-7)
6 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+17/-1)
bin/addons/sale/sale_order.py (+3/-0)
bin/addons/sales_followup/sale_followup.py (+1/-1)
bin/addons/sourcing/sale_order_line.py (+31/-3)
bin/addons/sourcing/wizard/multiple_sourcing.py (+19/-1)
bin/addons/sourcing/wizard/multiple_sourcing_view.xml (+1/-1)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-7816
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+400177@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_profile/i18n/fr_MF.po'
--- bin/addons/msf_profile/i18n/fr_MF.po 2021-02-24 09:28:37 +0000
+++ bin/addons/msf_profile/i18n/fr_MF.po 2021-03-25 11:03:52 +0000
@@ -52354,7 +52354,7 @@
52354msgid "A line must a have a quantity larger than 0.00"52354msgid "A line must a have a quantity larger than 0.00"
52355msgstr "A line must a have a quantity larger than 0.00"52355msgstr "A line must a have a quantity larger than 0.00"
5235652356
52357#. modules: sales_followup, tender_flow, purchase, stock_override, stock_forecast, purchase_allocation_report, purchase_followup, order_types, stock, msf_supply_doc_export52357#. modules: sales_followup, tender_flow, purchase, stock_override, stock_forecast, purchase_allocation_report, purchase_followup, order_types, stock, msf_supply_doc_export, sourcing, purchase_override
52358#: selection:stock.move,order_type:052358#: selection:stock.move,order_type:0
52359#: view:purchase.order:052359#: view:purchase.order:0
52360#: selection:purchase.order,order_type:052360#: selection:purchase.order,order_type:0
@@ -52373,6 +52373,9 @@
52373#: field:supplier.performance.wizard,po_type_purchase_list:052373#: field:supplier.performance.wizard,po_type_purchase_list:0
52374#: code:addons/stock_override/report/report_stock_move.py:3252374#: code:addons/stock_override/report/report_stock_move.py:32
52375#: selection:purchase.order.line,po_order_type:052375#: selection:purchase.order.line,po_order_type:0
52376#: selection:purchase.order.merged.line,po_order_type:0
52377#: selection:multiple.sourcing.wizard,po_cft:0
52378#: selection:sale.order.line,po_cft:0
52376#, python-format52379#, python-format
52377msgid "Purchase List"52380msgid "Purchase List"
52378msgstr "Liste d'Achats"52381msgstr "Liste d'Achats"
@@ -111894,3 +111897,16 @@
111894#, python-format111897#, python-format
111895msgid "You must have at least one line to create the Internal Move"111898msgid "You must have at least one line to create the Internal Move"
111896msgstr "Vous devez avoir au moins une ligne pour pouvoir créer le Mouvement Interne"111899msgstr "Vous devez avoir au moins une ligne pour pouvoir créer le Mouvement Interne"
111900
111901#. module: sourcing
111902#: code:addons/sourcing/sale_order_line.py:905
111903#, python-format
111904msgid "You can't source with 'Purchase List' to a non-external partner."
111905msgstr "Vous ne pouvez pas sourcer avec 'Liste d'Achats' vers un partenaire non-externe."
111906
111907#. module: sourcing
111908#: code:addons/sourcing/sale_order_line.py:2144
111909#: code:addons/sourcing/wizard/multiple_sourcing.py:461
111910#, python-format
111911msgid "'Purchase List' is not allowed with a non-external partner."
111912msgstr "'Liste d'Achats' n'est pas autorisé avec un partenaire non-externe."
111897111913
=== modified file 'bin/addons/sale/sale_order.py'
--- bin/addons/sale/sale_order.py 2021-01-27 17:04:50 +0000
+++ bin/addons/sale/sale_order.py 2021-03-25 11:03:52 +0000
@@ -3008,6 +3008,9 @@
3008 qty = float(qty)3008 qty = float(qty)
3009 vals.update({'product_uos_qty' : qty * product_obj.read(cr, uid, product_id, ['uos_coeff'])['uos_coeff']})3009 vals.update({'product_uos_qty' : qty * product_obj.read(cr, uid, product_id, ['uos_coeff'])['uos_coeff']})
30103010
3011 if vals.get('po_cft', False) == 'pli':
3012 vals.update({'po_cft': 'po'})
3013
3011 pricelist = False3014 pricelist = False
3012 order_id = vals.get('order_id', False)3015 order_id = vals.get('order_id', False)
3013 order_data = False3016 order_data = False
30143017
=== modified file 'bin/addons/sales_followup/sale_followup.py'
--- bin/addons/sales_followup/sale_followup.py 2019-09-18 14:06:52 +0000
+++ bin/addons/sales_followup/sale_followup.py 2021-03-25 11:03:52 +0000
@@ -737,7 +737,7 @@
737 'original_order_id': fields.many2one('sale.order', string='Orig. line', readonly=True),737 'original_order_id': fields.many2one('sale.order', string='Orig. line', readonly=True),
738 'first_line': fields.boolean(string='First line'),738 'first_line': fields.boolean(string='First line'),
739 'procure_method': fields.related('line_id', 'type', type='selection', selection=[('make_to_stock','From stock'), ('make_to_order','On order')], readonly=True, string='Proc. Method'),739 'procure_method': fields.related('line_id', 'type', type='selection', selection=[('make_to_stock','From stock'), ('make_to_order','On order')], readonly=True, string='Proc. Method'),
740 'po_cft': fields.related('line_id', 'po_cft', type='selection', selection=[('po','PO'), ('dpo', 'DPO'), ('cft','CFT')], readonly=True, string='PO/CFT'),740 'po_cft': fields.related('line_id', 'po_cft', type='selection', selection=[('po','PO'), ('dpo', 'DPO'), ('cft','CFT'), ('pli', 'PLI')], readonly=True, string='PO/CFT'),
741 'line_number': fields.related('line_id', 'line_number', string='Order line', readonly=True, type='integer'),741 'line_number': fields.related('line_id', 'line_number', string='Order line', readonly=True, type='integer'),
742 'product_id': fields.related('line_id', 'product_id', string='Product Code', readondy=True,742 'product_id': fields.related('line_id', 'product_id', string='Product Code', readondy=True,
743 type='many2one', relation='product.product'),743 type='many2one', relation='product.product'),
744744
=== modified file 'bin/addons/sourcing/sale_order_line.py'
--- bin/addons/sourcing/sale_order_line.py 2021-02-02 10:20:51 +0000
+++ bin/addons/sourcing/sale_order_line.py 2021-03-25 11:03:52 +0000
@@ -43,6 +43,7 @@
43 ('dpo', 'Direct Purchase Order'),43 ('dpo', 'Direct Purchase Order'),
44 ('cft', 'Tender'),44 ('cft', 'Tender'),
45 ('rfq', 'Request for Quotation'),45 ('rfq', 'Request for Quotation'),
46 ('pli', 'Purchase List'),
46]47]
4748
4849
@@ -898,6 +899,12 @@
898 _("""You can't source with 'Request for Quotation' to an internal/inter-section/intermission partner."""),899 _("""You can't source with 'Request for Quotation' to an internal/inter-section/intermission partner."""),
899 )900 )
900901
902 if line.product_id and line.po_cft == 'pli' and line.supplier.partner_type != 'external':
903 raise osv.except_osv(
904 _('Warning'),
905 _("""You can't source with 'Purchase List' to a non-external partner."""),
906 )
907
901 if line.order_id.state == 'validated' and line.order_id.order_type in (908 if line.order_id.state == 'validated' and line.order_id.order_type in (
902 'donation_st', 'donation_exp') and line.type != 'make_to_stock':909 'donation_st', 'donation_exp') and line.type != 'make_to_stock':
903 raise osv.except_osv(910 raise osv.except_osv(
@@ -1255,6 +1262,8 @@
1255 elif sourcing_line.po_cft == 'dpo':1262 elif sourcing_line.po_cft == 'dpo':
1256 domain.append(('order_type', '=', 'direct'))1263 domain.append(('order_type', '=', 'direct'))
1257 domain.append(('dest_address_id', '=', sourcing_line.order_id.partner_shipping_id.id))1264 domain.append(('dest_address_id', '=', sourcing_line.order_id.partner_shipping_id.id))
1265 elif sourcing_line.po_cft == 'pli':
1266 domain.append(('order_type', '=', 'purchase_list'))
12581267
1259 # supplier's order creation mode:1268 # supplier's order creation mode:
1260 if sourcing_line.supplier.po_by_project in ('project', 'category_project') or (sourcing_line.po_cft == 'dpo' and sourcing_line.supplier.po_by_project == 'all'):1269 if sourcing_line.supplier.po_by_project in ('project', 'category_project') or (sourcing_line.po_cft == 'dpo' and sourcing_line.supplier.po_by_project == 'all'):
@@ -1360,11 +1369,11 @@
1360 'related_sourcing_id': sourcing_line.related_sourcing_id.id or False,1369 'related_sourcing_id': sourcing_line.related_sourcing_id.id or False,
1361 'unique_fo_id': sourcing_line.order_id.id if sourcing_line.supplier.po_by_project == 'isolated' else False,1370 'unique_fo_id': sourcing_line.order_id.id if sourcing_line.supplier.po_by_project == 'isolated' else False,
1362 }1371 }
1363 if sourcing_line.po_cft == 'po': # Purchase Order1372 if sourcing_line.po_cft == 'po': # Purchase Order
1364 po_values.update({1373 po_values.update({
1365 'order_type': 'regular',1374 'order_type': 'regular',
1366 })1375 })
1367 elif sourcing_line.po_cft == 'dpo': # Direct Purchase Order1376 elif sourcing_line.po_cft == 'dpo': # Direct Purchase Order
1368 po_values.update({1377 po_values.update({
1369 'order_type': 'direct',1378 'order_type': 'direct',
1370 'dest_partner_id': sourcing_line.order_id.partner_id.id,1379 'dest_partner_id': sourcing_line.order_id.partner_id.id,
@@ -1372,6 +1381,8 @@
1372 })1381 })
1373 #if sourcing_line.order_id.partner_id.partner_type in ('esc', 'external'):1382 #if sourcing_line.order_id.partner_id.partner_type in ('esc', 'external'):
1374 # po_values['po_version'] = 2 # TODO NEEDED ?1383 # po_values['po_version'] = 2 # TODO NEEDED ?
1384 elif sourcing_line.po_cft == 'pli': # Purchase List
1385 po_values.update({'order_type': 'purchase_list',})
13751386
1376 return self.pool.get('purchase.order').create(cr, uid, po_values, context=context)1387 return self.pool.get('purchase.order').create(cr, uid, po_values, context=context)
13771388
@@ -1589,7 +1600,7 @@
1589 wf_service.trg_validate(uid, 'sale.order.line', sourcing_line.id, 'confirmed', cr) # confirmation create pick/out or INT1600 wf_service.trg_validate(uid, 'sale.order.line', sourcing_line.id, 'confirmed', cr) # confirmation create pick/out or INT
15901601
1591 elif sourcing_line.type == 'make_to_order':1602 elif sourcing_line.type == 'make_to_order':
1592 if sourcing_line.po_cft in ('po', 'dpo'):1603 if sourcing_line.po_cft in ('po', 'dpo', 'pli'):
1593 po_to_use = self.get_existing_po(cr, uid, sourcing_line.id, context=context)1604 po_to_use = self.get_existing_po(cr, uid, sourcing_line.id, context=context)
1594 if not po_to_use: # then create new PO:1605 if not po_to_use: # then create new PO:
1595 po_to_use = self.create_po_from_sourcing_line(cr, uid, sourcing_line.id, context=context)1606 po_to_use = self.create_po_from_sourcing_line(cr, uid, sourcing_line.id, context=context)
@@ -2124,6 +2135,16 @@
2124 res['value'].update({'po_cft': 'dpo'})2135 res['value'].update({'po_cft': 'dpo'})
21252136
2126 partner_id = 'supplier' in value and value['supplier'] or partner_id2137 partner_id = 'supplier' in value and value['supplier'] or partner_id
2138
2139 if partner_id:
2140 p_type = self.pool.get('res.partner').read(cr, uid, partner_id, ['partner_type'], context=context)['partner_type']
2141 if po_cft == 'pli' and p_type != 'external':
2142 res['warning'] = {
2143 'title': _('Warning'),
2144 'message': _("""'Purchase List' is not allowed with a non-external partner."""),
2145 }
2146 res['value'].update({'po_cft': 'po'})
2147
2127 if line_id and partner_id and line.product_id:2148 if line_id and partner_id and line.product_id:
2128 check_fnct = product_obj._on_change_restriction_error2149 check_fnct = product_obj._on_change_restriction_error
2129 res, error = self._check_product_constraints(2150 res, error = self._check_product_constraints(
@@ -2280,6 +2301,13 @@
2280 'message': _('The chosen partner has no address. Please define an address before continuing.'),2301 'message': _('The chosen partner has no address. Please define an address before continuing.'),
2281 }2302 }
22822303
2304 # Search the local market partner id
2305 data_obj = self.pool.get('ir.model.data')
2306 data_id = data_obj.search(cr, uid, [('module', '=', 'order_types'), ('model', '=', 'res.partner'),
2307 ('name', '=', 'res_partner_local_market')], limit=1, order='NO_ORDER')
2308 if data_id and partner.id == data_obj.read(cr, uid, data_id, ['res_id'])[0]['res_id']:
2309 result['value'].update({'po_cft': 'pli'})
2310
2283 # If the selected partner belongs to product->suppliers, we take that delay (from supplierinfo)2311 # If the selected partner belongs to product->suppliers, we take that delay (from supplierinfo)
2284 line = self.browse(cr, uid, line_id, context=context)2312 line = self.browse(cr, uid, line_id, context=context)
2285 delay = self.check_supplierinfo(line, partner, context=context)2313 delay = self.check_supplierinfo(line, partner, context=context)
22862314
=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing.py'
--- bin/addons/sourcing/wizard/multiple_sourcing.py 2019-07-30 09:41:15 +0000
+++ bin/addons/sourcing/wizard/multiple_sourcing.py 2021-03-25 11:03:52 +0000
@@ -438,7 +438,7 @@
438 },438 },
439 }439 }
440440
441 def change_po_cft(self, cr, uid, ids, po_cft, context=None):441 def change_po_cft(self, cr, uid, ids, po_cft, supplier_id, context=None):
442 """442 """
443 Unset the supplier if tender is choose443 Unset the supplier if tender is choose
444 :param cr: Cursor to the database444 :param cr: Cursor to the database
@@ -451,6 +451,17 @@
451 if po_cft == 'cft':451 if po_cft == 'cft':
452 return {'value': {'supplier_id': False}}452 return {'value': {'supplier_id': False}}
453453
454 if supplier_id:
455 suppl_type = self.pool.get('res.partner').read(cr, uid, supplier_id, ['partner_type'], context=context)['partner_type']
456 if po_cft == 'pli' and suppl_type != 'external':
457 return {
458 'value': {'po_cft': False},
459 'warning': {
460 'title': _('Warning'),
461 'message': _("""You can't source with 'Purchase List' to a non-external partner."""),
462 },
463 }
464
454 return {}465 return {}
455466
456 def change_supplier(self, cr, uid, ids, supplier, l_type, context=None):467 def change_supplier(self, cr, uid, ids, supplier, l_type, context=None):
@@ -486,6 +497,13 @@
486 'supplier_type': partner and partner.partner_type or False,497 'supplier_type': partner and partner.partner_type or False,
487 'supplier_split_po': partner and partner.split_po or False,498 'supplier_split_po': partner and partner.split_po or False,
488 })499 })
500
501 # Search the local market partner id
502 data_obj = self.pool.get('ir.model.data')
503 data_id = data_obj.search(cr, uid, [('module', '=', 'order_types'), ('model', '=', 'res.partner'),
504 ('name', '=', 'res_partner_local_market')], limit=1, order='NO_ORDER')
505 if data_id and partner.id == data_obj.read(cr, uid, data_id, ['res_id'])[0]['res_id']:
506 result['value'].update({'po_cft': 'pli'})
489 else:507 else:
490 result['value'].update({508 result['value'].update({
491 'supplier_type': False,509 'supplier_type': False,
492510
=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing_view.xml'
--- bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2019-06-07 12:15:15 +0000
+++ bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2021-03-25 11:03:52 +0000
@@ -20,7 +20,7 @@
20 <field name="type" 20 <field name="type"
21 on_change="change_type(line_ids, type, supplier)"/>21 on_change="change_type(line_ids, type, supplier)"/>
22 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"22 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"
23 on_change="change_po_cft(po_cft)"/>23 on_change="change_po_cft(po_cft, supplier_id)"/>
24 <field name="run_scheduler" />24 <field name="run_scheduler" />
25 <separator colspan="4" string="Supplier selection" />25 <separator colspan="4" string="Supplier selection" />
26 <field name="supplier_id"26 <field name="supplier_id"

Subscribers

People subscribed via source and target branches