Merge lp:~unifield-team/unifield-wm/bklg-73 into lp:unifield-wm

Proposed by Quentin THEURET @Amaris
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/bklg-73
Merge into: lp:unifield-wm
Diff against target: 383 lines (+183/-7)
14 files modified
msf_doc_import/view/purchase_order_import_line_view.xml (+2/-0)
purchase_override/purchase.py (+3/-0)
purchase_override/purchase_view.xml (+1/-0)
sale_override/sale.py (+1/-0)
sourcing/__init__.py (+1/-0)
sourcing/__openerp__.py (+1/-0)
sourcing/procurement_order.py (+14/-0)
sourcing/purchase_order.py (+5/-0)
sourcing/related_sourcing.py (+68/-0)
sourcing/related_sourcing_view.xml (+30/-0)
sourcing/sale_order_line.py (+4/-0)
sourcing/sourcing_view.xml (+26/-1)
sourcing/wizard/multiple_sourcing.py (+19/-0)
sourcing/wizard/multiple_sourcing_view.xml (+8/-6)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/bklg-73
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+260254@code.launchpad.net
To post a comment you must log in.
2494. By Quentin THEURET @Amaris

Merge latest trunk

2495. By Quentin THEURET @Amaris

BKLG-73 [IMP]
  * For the Sourcing Groups, it would be better if these could be stocked as master data (Supply Config>Orders?) so all types can be seen, and one can be selected or created. - In addition, as well as the code, it would be good to have a Field for a Free text description in the master data record.
  * For the PO produced, a new field "Sourcing Group" can be added in Notes tab. This sourcing group selected in OST is automatically added as value when PO is produced. However this value is not shown on PO print out or other exports.
  * After PO (with sourcing group) has been generated, only other OST lines with same sourcing group (and supplier - and according to supplier order creation mode) can be added automatically to this PO. However user can manually add (from scratch) new lines to this PO.

2496. By Quentin THEURET @Amaris

BKLG-73 [IMP] POs with different sourcing groups can be merged, default system merging message will be changed to say 'any sourcing group will be lost'.

Unmerged revisions

2496. By Quentin THEURET @Amaris

BKLG-73 [IMP] POs with different sourcing groups can be merged, default system merging message will be changed to say 'any sourcing group will be lost'.

2495. By Quentin THEURET @Amaris

BKLG-73 [IMP]
  * For the Sourcing Groups, it would be better if these could be stocked as master data (Supply Config>Orders?) so all types can be seen, and one can be selected or created. - In addition, as well as the code, it would be good to have a Field for a Free text description in the master data record.
  * For the PO produced, a new field "Sourcing Group" can be added in Notes tab. This sourcing group selected in OST is automatically added as value when PO is produced. However this value is not shown on PO print out or other exports.
  * After PO (with sourcing group) has been generated, only other OST lines with same sourcing group (and supplier - and according to supplier order creation mode) can be added automatically to this PO. However user can manually add (from scratch) new lines to this PO.

2494. By Quentin THEURET @Amaris

Merge latest trunk

2493. By Quentin THEURET @Amaris

BKLG-73 [IMP] Sourcing: Split the PO creation into different PO according to group in OST

2492. By Quentin THEURET @Amaris

BKLG-73 [IMP] Sourcing tool: Add a new field to group all lines to the same supplier on different POs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'msf_doc_import/view/purchase_order_import_line_view.xml'
2--- msf_doc_import/view/purchase_order_import_line_view.xml 2014-01-16 10:06:42 +0000
3+++ msf_doc_import/view/purchase_order_import_line_view.xml 2015-08-06 15:15:58 +0000
4@@ -23,6 +23,8 @@
5 <field name="import_in_progress" readonly="1" invisible="0" />
6 </xpath>
7 <xpath expr="/form/notebook/page[@string='Notes']/field[@name='project_ref']" position="after">
8+ <separator colspan="4" string="Sourcing group" />
9+ <field name="related_sourcing_id" readonly="True" />
10 <separator colspan="4" string="Import filenames" />
11 <field name="import_filenames" mode="tree" readonly="1" nolabel="1" colspan="4">
12 <tree string="Imported filenames">
13
14=== modified file 'purchase_override/purchase.py'
15--- purchase_override/purchase.py 2015-08-03 11:48:43 +0000
16+++ purchase_override/purchase.py 2015-08-06 15:15:58 +0000
17@@ -162,6 +162,9 @@
18 if not context.get('keepOrigin', False):
19 default.update({'origin': False})
20
21+ if not default.get('related_sourcing_id', False):
22+ default['related_sourcing_id'] = False
23+
24 return super(purchase_order, self).copy(cr, uid, p_id, default, context=context)
25
26 # @@@purchase.purchase_order._invoiced
27
28=== modified file 'purchase_override/purchase_view.xml'
29--- purchase_override/purchase_view.xml 2015-04-09 12:56:14 +0000
30+++ purchase_override/purchase_view.xml 2015-08-06 15:15:58 +0000
31@@ -379,6 +379,7 @@
32 <html colspan="4">
33 <p>All information of the PO template will be written in the new PO,</p>
34 <p>except the Delivery Requested date which will be the earliest date of all POs.</p>
35+ <p>Any sourcing group will be lost.</p>
36 </html>
37 <newline />
38 <group colspan="4" col="4" attrs="{'invisible': [('unmatched_categ', '=', False)]}">
39
40=== modified file 'sale_override/sale.py'
41--- sale_override/sale.py 2015-08-06 08:49:25 +0000
42+++ sale_override/sale.py 2015-08-06 15:15:58 +0000
43@@ -1827,6 +1827,7 @@
44 'company_id': order.company_id.id,
45 'supplier': line.supplier and line.supplier.id or False,
46 'po_cft': line.po_cft or False,
47+ 'related_sourcing_id': line.related_sourcing_id and line.related_sourcing_id.id or False,
48 'date_planned': rts_date,
49 'from_yml_test': order.from_yml_test,
50 'so_back_update_dest_po_id_procurement_order': line.so_back_update_dest_po_id_sale_order_line.id,
51
52=== modified file 'sourcing/__init__.py'
53--- sourcing/__init__.py 2014-03-10 09:56:10 +0000
54+++ sourcing/__init__.py 2015-08-06 15:15:58 +0000
55@@ -19,6 +19,7 @@
56 #
57 ##############################################################################
58
59+import related_sourcing
60 import sale_order_line
61 import wizard
62
63
64=== modified file 'sourcing/__openerp__.py'
65--- sourcing/__openerp__.py 2014-03-14 08:17:52 +0000
66+++ sourcing/__openerp__.py 2015-08-06 15:15:58 +0000
67@@ -50,6 +50,7 @@
68 ],
69 'update_xml': [
70 'sourcing_view.xml',
71+ 'related_sourcing_view.xml',
72 'wizard/multiple_sourcing_view.xml',
73 ],
74 'installable': True,
75
76=== modified file 'sourcing/procurement_order.py'
77--- sourcing/procurement_order.py 2015-03-19 09:43:56 +0000
78+++ sourcing/procurement_order.py 2015-08-06 15:15:58 +0000
79@@ -68,6 +68,10 @@
80 _columns = {
81 'supplier': fields.many2one('res.partner', 'Supplier'),
82 'po_cft': fields.selection(_SELECTION_PO_CFT, string="PO/CFT"),
83+ 'related_sourcing_id': fields.many2one(
84+ 'related.sourcing',
85+ string='Group',
86+ ),
87 'unique_rule_type': fields.char(
88 size=128,
89 string='Unique Replenishment rule type',
90@@ -86,6 +90,9 @@
91 if not default_values.get('from_splitted_po_line'):
92 default_values['from_splitted_po_line'] = False
93
94+ if not default_values.get('related_sourcing_id'):
95+ default_values['related_sourcing_id'] = False
96+
97 return super(procurement_order, self).copy_data(cr, uid, copy_id, default_values, context=context)
98
99 def po_line_values_hook(self, cr, uid, ids, context=None, *args, **kwargs):
100@@ -206,6 +213,13 @@
101 else:
102 purchase_domain.append(('order_type', '!=', 'direct'))
103
104+ if procurement.related_sourcing_id:
105+ purchase_domain.append(('related_sourcing_id', '=', procurement.related_sourcing_id.id))
106+ values['related_sourcing_id'] = procurement.related_sourcing_id.id
107+ else:
108+ purchase_domain.append(('related_sourcing_id', '=', False))
109+ values['related_sourcing_id'] = False
110+
111 if procurement.tender_line_id and procurement.tender_line_id.purchase_order_line_id:
112 purchase_domain.append(('pricelist_id', '=', procurement.tender_line_id.purchase_order_line_id.order_id.pricelist_id.id))
113 elif procurement.rfq_id:
114
115=== modified file 'sourcing/purchase_order.py'
116--- sourcing/purchase_order.py 2014-10-02 20:13:13 +0000
117+++ sourcing/purchase_order.py 2015-08-06 15:15:58 +0000
118@@ -51,6 +51,11 @@
119 string='PO from replenishment rules',
120 readonly=True,
121 ),
122+ 'related_sourcing_id': fields.many2one(
123+ 'related.sourcing',
124+ string='Sourcing group',
125+ readonly=True,
126+ ),
127 }
128
129 _defaults = {
130
131=== added file 'sourcing/related_sourcing.py'
132--- sourcing/related_sourcing.py 1970-01-01 00:00:00 +0000
133+++ sourcing/related_sourcing.py 2015-08-06 15:15:58 +0000
134@@ -0,0 +1,68 @@
135+# -*- coding: utf-8 -*-
136+##############################################################################
137+#
138+# OpenERP, Open Source Management Solution
139+# Copyright (C) 2014 TeMPO Consulting, MSF
140+#
141+# This program is free software: you can redistribute it and/or modify
142+# it under the terms of the GNU Affero General Public License as
143+# published by the Free Software Foundation, either version 3 of the
144+# License, or (at your option) any later version.
145+#
146+# This program is distributed in the hope that it will be useful,
147+# but WITHOUT ANY WARRANTY; without even the implied warranty of
148+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
149+# GNU Affero General Public License for more details.
150+#
151+# You should have received a copy of the GNU Affero General Public License
152+# along with this program. If not, see <http://www.gnu.org/licenses/>.
153+#
154+##############################################################################
155+
156+from osv import fields
157+from osv import osv
158+
159+import string
160+
161+
162+class related_sourcing(osv.osv):
163+ """
164+ This object is used to link sourcing lines on a same PO to the same
165+ supplier. If most sourcing lines are sourced to the same supplier but
166+ have different related.sourcing, one PO per related.sourcing will be
167+ created with all lines linked to this related.sourcing.
168+ """
169+ _name = 'related.sourcing'
170+ _description = 'Sourcing group'
171+
172+ _columns = {
173+ 'name': fields.char(
174+ size=128,
175+ string='Name',
176+ required=True,
177+ ),
178+ 'description': fields.text(
179+ string='Description',
180+ ),
181+ }
182+
183+ def create(self, cr, uid, vals, context=None):
184+ """
185+ Format the name value
186+ """
187+ vals['name'] = filter(str.isalnum, vals.get('name', '')).upper()
188+ return super(related_sourcing, self).\
189+ create(cr, uid, vals, context=context)
190+
191+ def write(self, cr, uid, ids, vals, context=None):
192+ """
193+ Format the name value
194+ """
195+ vals['name'] = filter(str.isalnum, vals.get('name', '')).upper()
196+ return super(related_sourcing, self).\
197+ write(cr, uid, ids, vals, context=context)
198+
199+related_sourcing()
200+
201+
202+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
203
204=== added file 'sourcing/related_sourcing_view.xml'
205--- sourcing/related_sourcing_view.xml 1970-01-01 00:00:00 +0000
206+++ sourcing/related_sourcing_view.xml 2015-08-06 15:15:58 +0000
207@@ -0,0 +1,30 @@
208+<?xml version="1.0" encoding="utf-8"?>
209+<openerp>
210+ <data>
211+
212+ <record id="related_sourcing_tree_view" model="ir.ui.view">
213+ <field name="name">related.sourcing.tree.view</field>
214+ <field name="model">related.sourcing</field>
215+ <field name="type">tree</field>
216+ <field name="arch" type="xml">
217+ <tree string="Sourcing groups" editable="top">
218+ <field name="name" />
219+ <field name="description" />
220+ </tree>
221+ </field>
222+ </record>
223+
224+ <record id="related_sourcing_action" model="ir.actions.act_window">
225+ <field name="name">Sourcing groups</field>
226+ <field name="res_model">related.sourcing</field>
227+ <field name="view_type">form</field>
228+ <field name="view_mode">tree,form</field>
229+ </record>
230+
231+ <menuitem
232+ id="related_sourcing_menu"
233+ action="related_sourcing_action"
234+ parent="base.menu_sale_config_sales" />
235+
236+ </data>
237+</openerp>
238
239=== modified file 'sourcing/sale_order_line.py'
240--- sourcing/sale_order_line.py 2015-07-24 12:22:31 +0000
241+++ sourcing/sale_order_line.py 2015-08-06 15:15:58 +0000
242@@ -419,6 +419,10 @@
243 'res.partner',
244 'Supplier',
245 ),
246+ 'related_sourcing_id': fields.many2one(
247+ 'related.sourcing',
248+ string='Group',
249+ ),
250 'location_id': fields.many2one(
251 'stock.location',
252 string='Location',
253
254=== modified file 'sourcing/sourcing_view.xml'
255--- sourcing/sourcing_view.xml 2014-09-29 12:38:06 +0000
256+++ sourcing/sourcing_view.xml 2015-08-06 15:15:58 +0000
257@@ -98,6 +98,8 @@
258 <field name="po_cft"
259 on_change="onChangePoCft(po_cft, order_id, supplier)"
260 attrs="{'readonly': ['|', ('type', '=', 'make_to_stock'), ('state', '!=', 'draft')], 'required': [('type', '=', 'make_to_order')]}" />
261+ <field name="related_sourcing_id"
262+ attrs="{'readonly': ['|', '|', ('type', '=', 'make_to_stock'), ('state', '!=', 'draft'), ('po_cft', 'not in', ['po', 'dpo'])]}" />
263 <field name="location_id"
264 widget="selection"
265 on_change="onChangeLocation(location_id, product_id, rts, order_id)"
266@@ -191,7 +193,30 @@
267 target="new"
268 key2="client_action_multi"
269 empty_ids="1"
270- id="action_compute_schedulers_sourcing"/>
271+ id="action_compute_schedulers_sourcing"/>
272+
273+ <!-- Related sourcing group -->
274+ <record id="related_sourcing_search_view" model="ir.ui.view">
275+ <field name="name">related.sourcing.search.view</field>
276+ <field name="model">related.sourcing</field>
277+ <field name="type">form</field>
278+ <field name="arch" type="xml">
279+ <search string="Related sourcing group">
280+ <field name="name" />
281+ </search>
282+ </field>
283+ </record>
284+
285+ <record id="related_sourcing_form_view" model="ir.ui.view">
286+ <field name="name">related.sourcing.form.view</field>
287+ <field name="model">related.sourcing</field>
288+ <field name="type">form</field>
289+ <field name="arch" type="xml">
290+ <form string="Related sourcing group">
291+ <field name="name" />
292+ </form>
293+ </field>
294+ </record>
295
296 </data>
297 </openerp>
298
299=== modified file 'sourcing/wizard/multiple_sourcing.py'
300--- sourcing/wizard/multiple_sourcing.py 2015-03-02 20:31:25 +0000
301+++ sourcing/wizard/multiple_sourcing.py 2015-08-06 15:15:58 +0000
302@@ -49,6 +49,10 @@
303 _SELECTION_PO_CFT,
304 string='PO/CFT',
305 ),
306+ 'related_sourcing_id': fields.many2one(
307+ 'related.sourcing',
308+ string='Group',
309+ ),
310 'location_id': fields.many2one(
311 'stock.location',
312 string='Location',
313@@ -92,6 +96,7 @@
314 res['po_cft'] = False
315 loc = -1 # first location flag
316 supplier = -1 # first location flag
317+ group = None
318 for line in self.pool.get('sale.order.line').browse(cr, uid, active_ids, context=context):
319 if line.state == 'draft' and line.sale_order_state == 'validated':
320 res['line_ids'].append(line.id)
321@@ -111,9 +116,20 @@
322 supplier = temp
323 elif supplier != temp:
324 supplier = False
325+
326+ if not line.related_sourcing_id:
327+ group = False
328+ else:
329+ temp = line.related_sourcing_id.id
330+ if group is None:
331+ group = temp
332+ elif group != temp:
333+ group = False
334+
335 else:
336 # UTP-1021: Calculate the location to set into the wizard view if all lines are sourced from the same location
337 supplier = False # if source from stock, always set False to partner
338+ group = False
339 temploc = line.location_id.id
340 if loc == -1: # first location
341 loc = temploc
342@@ -125,6 +141,8 @@
343 res['location_id'] = loc
344 if supplier != -1:
345 res['supplier_id'] = supplier
346+ if group is not None:
347+ res['related_sourcing_id'] = group
348
349 if not res['line_ids']:
350 raise osv.except_osv(_('Error'), _('No non-sourced lines are selected. Please select non-sourced lines'))
351@@ -160,6 +178,7 @@
352 line_obj.write(cr, uid, [line.id], {'type': wiz.type,
353 'po_cft': wiz.po_cft,
354 'supplier': wiz.supplier_id and wiz.supplier_id.id or False,
355+ 'related_sourcing_id': wiz.related_sourcing_id and wiz.related_sourcing_id.id or False,
356 'location_id': wiz.location_id.id and wiz.location_id.id or False},
357 context=context)
358 except osv.except_osv, e:
359
360=== modified file 'sourcing/wizard/multiple_sourcing_view.xml'
361--- sourcing/wizard/multiple_sourcing_view.xml 2015-03-02 20:31:25 +0000
362+++ sourcing/wizard/multiple_sourcing_view.xml 2015-08-06 15:15:58 +0000
363@@ -28,12 +28,14 @@
364 on_change="change_supplier(supplier_id)"
365 />
366
367-
368- <field name="location_id" domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False),
369- ('scrap_location', '=', False), ('destruction_location', '=', False),
370- ('output_ok', '=', False), ('input_ok', '=', False)]"
371- attrs="{'readonly': [('type', '!=', 'make_to_stock')]}"
372- on_change="change_location(location_id, line_ids)" />
373+ <field name="location_id"
374+ domain="[('usage', '=', 'internal'), ('quarantine_location', '=', False),
375+ ('scrap_location', '=', False), ('destruction_location', '=', False),
376+ ('output_ok', '=', False), ('input_ok', '=', False)]"
377+ attrs="{'readonly': [('type', '!=', 'make_to_stock')]}"
378+ on_change="change_location(location_id, line_ids)" />
379+ <field name="related_sourcing_id"
380+ attrs="{'readonly': ['|', ('type', '!=', 'make_to_order'), ('po_cft', 'not in', ['po', 'dpo'])]}" />
381
382 </group>
383 <separator colspan="4" string="Actions" />

Subscribers

People subscribed via source and target branches