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
1=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
2--- bin/addons/msf_profile/i18n/fr_MF.po 2021-02-24 09:28:37 +0000
3+++ bin/addons/msf_profile/i18n/fr_MF.po 2021-03-25 11:03:52 +0000
4@@ -52354,7 +52354,7 @@
5 msgid "A line must a have a quantity larger than 0.00"
6 msgstr "A line must a have a quantity larger than 0.00"
7
8-#. modules: sales_followup, tender_flow, purchase, stock_override, stock_forecast, purchase_allocation_report, purchase_followup, order_types, stock, msf_supply_doc_export
9+#. 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
10 #: selection:stock.move,order_type:0
11 #: view:purchase.order:0
12 #: selection:purchase.order,order_type:0
13@@ -52373,6 +52373,9 @@
14 #: field:supplier.performance.wizard,po_type_purchase_list:0
15 #: code:addons/stock_override/report/report_stock_move.py:32
16 #: selection:purchase.order.line,po_order_type:0
17+#: selection:purchase.order.merged.line,po_order_type:0
18+#: selection:multiple.sourcing.wizard,po_cft:0
19+#: selection:sale.order.line,po_cft:0
20 #, python-format
21 msgid "Purchase List"
22 msgstr "Liste d'Achats"
23@@ -111894,3 +111897,16 @@
24 #, python-format
25 msgid "You must have at least one line to create the Internal Move"
26 msgstr "Vous devez avoir au moins une ligne pour pouvoir créer le Mouvement Interne"
27+
28+#. module: sourcing
29+#: code:addons/sourcing/sale_order_line.py:905
30+#, python-format
31+msgid "You can't source with 'Purchase List' to a non-external partner."
32+msgstr "Vous ne pouvez pas sourcer avec 'Liste d'Achats' vers un partenaire non-externe."
33+
34+#. module: sourcing
35+#: code:addons/sourcing/sale_order_line.py:2144
36+#: code:addons/sourcing/wizard/multiple_sourcing.py:461
37+#, python-format
38+msgid "'Purchase List' is not allowed with a non-external partner."
39+msgstr "'Liste d'Achats' n'est pas autorisé avec un partenaire non-externe."
40
41=== modified file 'bin/addons/sale/sale_order.py'
42--- bin/addons/sale/sale_order.py 2021-01-27 17:04:50 +0000
43+++ bin/addons/sale/sale_order.py 2021-03-25 11:03:52 +0000
44@@ -3008,6 +3008,9 @@
45 qty = float(qty)
46 vals.update({'product_uos_qty' : qty * product_obj.read(cr, uid, product_id, ['uos_coeff'])['uos_coeff']})
47
48+ if vals.get('po_cft', False) == 'pli':
49+ vals.update({'po_cft': 'po'})
50+
51 pricelist = False
52 order_id = vals.get('order_id', False)
53 order_data = False
54
55=== modified file 'bin/addons/sales_followup/sale_followup.py'
56--- bin/addons/sales_followup/sale_followup.py 2019-09-18 14:06:52 +0000
57+++ bin/addons/sales_followup/sale_followup.py 2021-03-25 11:03:52 +0000
58@@ -737,7 +737,7 @@
59 'original_order_id': fields.many2one('sale.order', string='Orig. line', readonly=True),
60 'first_line': fields.boolean(string='First line'),
61 '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'),
62- 'po_cft': fields.related('line_id', 'po_cft', type='selection', selection=[('po','PO'), ('dpo', 'DPO'), ('cft','CFT')], readonly=True, string='PO/CFT'),
63+ 'po_cft': fields.related('line_id', 'po_cft', type='selection', selection=[('po','PO'), ('dpo', 'DPO'), ('cft','CFT'), ('pli', 'PLI')], readonly=True, string='PO/CFT'),
64 'line_number': fields.related('line_id', 'line_number', string='Order line', readonly=True, type='integer'),
65 'product_id': fields.related('line_id', 'product_id', string='Product Code', readondy=True,
66 type='many2one', relation='product.product'),
67
68=== modified file 'bin/addons/sourcing/sale_order_line.py'
69--- bin/addons/sourcing/sale_order_line.py 2021-02-02 10:20:51 +0000
70+++ bin/addons/sourcing/sale_order_line.py 2021-03-25 11:03:52 +0000
71@@ -43,6 +43,7 @@
72 ('dpo', 'Direct Purchase Order'),
73 ('cft', 'Tender'),
74 ('rfq', 'Request for Quotation'),
75+ ('pli', 'Purchase List'),
76 ]
77
78
79@@ -898,6 +899,12 @@
80 _("""You can't source with 'Request for Quotation' to an internal/inter-section/intermission partner."""),
81 )
82
83+ if line.product_id and line.po_cft == 'pli' and line.supplier.partner_type != 'external':
84+ raise osv.except_osv(
85+ _('Warning'),
86+ _("""You can't source with 'Purchase List' to a non-external partner."""),
87+ )
88+
89 if line.order_id.state == 'validated' and line.order_id.order_type in (
90 'donation_st', 'donation_exp') and line.type != 'make_to_stock':
91 raise osv.except_osv(
92@@ -1255,6 +1262,8 @@
93 elif sourcing_line.po_cft == 'dpo':
94 domain.append(('order_type', '=', 'direct'))
95 domain.append(('dest_address_id', '=', sourcing_line.order_id.partner_shipping_id.id))
96+ elif sourcing_line.po_cft == 'pli':
97+ domain.append(('order_type', '=', 'purchase_list'))
98
99 # supplier's order creation mode:
100 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'):
101@@ -1360,11 +1369,11 @@
102 'related_sourcing_id': sourcing_line.related_sourcing_id.id or False,
103 'unique_fo_id': sourcing_line.order_id.id if sourcing_line.supplier.po_by_project == 'isolated' else False,
104 }
105- if sourcing_line.po_cft == 'po': # Purchase Order
106+ if sourcing_line.po_cft == 'po': # Purchase Order
107 po_values.update({
108 'order_type': 'regular',
109 })
110- elif sourcing_line.po_cft == 'dpo': # Direct Purchase Order
111+ elif sourcing_line.po_cft == 'dpo': # Direct Purchase Order
112 po_values.update({
113 'order_type': 'direct',
114 'dest_partner_id': sourcing_line.order_id.partner_id.id,
115@@ -1372,6 +1381,8 @@
116 })
117 #if sourcing_line.order_id.partner_id.partner_type in ('esc', 'external'):
118 # po_values['po_version'] = 2 # TODO NEEDED ?
119+ elif sourcing_line.po_cft == 'pli': # Purchase List
120+ po_values.update({'order_type': 'purchase_list',})
121
122 return self.pool.get('purchase.order').create(cr, uid, po_values, context=context)
123
124@@ -1589,7 +1600,7 @@
125 wf_service.trg_validate(uid, 'sale.order.line', sourcing_line.id, 'confirmed', cr) # confirmation create pick/out or INT
126
127 elif sourcing_line.type == 'make_to_order':
128- if sourcing_line.po_cft in ('po', 'dpo'):
129+ if sourcing_line.po_cft in ('po', 'dpo', 'pli'):
130 po_to_use = self.get_existing_po(cr, uid, sourcing_line.id, context=context)
131 if not po_to_use: # then create new PO:
132 po_to_use = self.create_po_from_sourcing_line(cr, uid, sourcing_line.id, context=context)
133@@ -2124,6 +2135,16 @@
134 res['value'].update({'po_cft': 'dpo'})
135
136 partner_id = 'supplier' in value and value['supplier'] or partner_id
137+
138+ if partner_id:
139+ p_type = self.pool.get('res.partner').read(cr, uid, partner_id, ['partner_type'], context=context)['partner_type']
140+ if po_cft == 'pli' and p_type != 'external':
141+ res['warning'] = {
142+ 'title': _('Warning'),
143+ 'message': _("""'Purchase List' is not allowed with a non-external partner."""),
144+ }
145+ res['value'].update({'po_cft': 'po'})
146+
147 if line_id and partner_id and line.product_id:
148 check_fnct = product_obj._on_change_restriction_error
149 res, error = self._check_product_constraints(
150@@ -2280,6 +2301,13 @@
151 'message': _('The chosen partner has no address. Please define an address before continuing.'),
152 }
153
154+ # Search the local market partner id
155+ data_obj = self.pool.get('ir.model.data')
156+ data_id = data_obj.search(cr, uid, [('module', '=', 'order_types'), ('model', '=', 'res.partner'),
157+ ('name', '=', 'res_partner_local_market')], limit=1, order='NO_ORDER')
158+ if data_id and partner.id == data_obj.read(cr, uid, data_id, ['res_id'])[0]['res_id']:
159+ result['value'].update({'po_cft': 'pli'})
160+
161 # If the selected partner belongs to product->suppliers, we take that delay (from supplierinfo)
162 line = self.browse(cr, uid, line_id, context=context)
163 delay = self.check_supplierinfo(line, partner, context=context)
164
165=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing.py'
166--- bin/addons/sourcing/wizard/multiple_sourcing.py 2019-07-30 09:41:15 +0000
167+++ bin/addons/sourcing/wizard/multiple_sourcing.py 2021-03-25 11:03:52 +0000
168@@ -438,7 +438,7 @@
169 },
170 }
171
172- def change_po_cft(self, cr, uid, ids, po_cft, context=None):
173+ def change_po_cft(self, cr, uid, ids, po_cft, supplier_id, context=None):
174 """
175 Unset the supplier if tender is choose
176 :param cr: Cursor to the database
177@@ -451,6 +451,17 @@
178 if po_cft == 'cft':
179 return {'value': {'supplier_id': False}}
180
181+ if supplier_id:
182+ suppl_type = self.pool.get('res.partner').read(cr, uid, supplier_id, ['partner_type'], context=context)['partner_type']
183+ if po_cft == 'pli' and suppl_type != 'external':
184+ return {
185+ 'value': {'po_cft': False},
186+ 'warning': {
187+ 'title': _('Warning'),
188+ 'message': _("""You can't source with 'Purchase List' to a non-external partner."""),
189+ },
190+ }
191+
192 return {}
193
194 def change_supplier(self, cr, uid, ids, supplier, l_type, context=None):
195@@ -486,6 +497,13 @@
196 'supplier_type': partner and partner.partner_type or False,
197 'supplier_split_po': partner and partner.split_po or False,
198 })
199+
200+ # Search the local market partner id
201+ data_obj = self.pool.get('ir.model.data')
202+ data_id = data_obj.search(cr, uid, [('module', '=', 'order_types'), ('model', '=', 'res.partner'),
203+ ('name', '=', 'res_partner_local_market')], limit=1, order='NO_ORDER')
204+ if data_id and partner.id == data_obj.read(cr, uid, data_id, ['res_id'])[0]['res_id']:
205+ result['value'].update({'po_cft': 'pli'})
206 else:
207 result['value'].update({
208 'supplier_type': False,
209
210=== modified file 'bin/addons/sourcing/wizard/multiple_sourcing_view.xml'
211--- bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2019-06-07 12:15:15 +0000
212+++ bin/addons/sourcing/wizard/multiple_sourcing_view.xml 2021-03-25 11:03:52 +0000
213@@ -20,7 +20,7 @@
214 <field name="type"
215 on_change="change_type(line_ids, type, supplier)"/>
216 <field name="po_cft" attrs="{'readonly': [('type', '=', 'make_to_stock')]}"
217- on_change="change_po_cft(po_cft)"/>
218+ on_change="change_po_cft(po_cft, supplier_id)"/>
219 <field name="run_scheduler" />
220 <separator colspan="4" string="Supplier selection" />
221 <field name="supplier_id"

Subscribers

People subscribed via source and target branches