Merge lp:~numerigraphe-team/purchase-wkfl/7.0-add-purchase_delivery_split_date into lp:~purchase-core-editors/purchase-wkfl/7.0

Proposed by Lionel Sausin - Initiatives/Numérigraphe
Status: Needs review
Proposed branch: lp:~numerigraphe-team/purchase-wkfl/7.0-add-purchase_delivery_split_date
Merge into: lp:~purchase-core-editors/purchase-wkfl/7.0
Diff against target: 121 lines (+106/-0)
3 files modified
purchase_delivery_split_date/__init__.py (+21/-0)
purchase_delivery_split_date/__openerp__.py (+41/-0)
purchase_delivery_split_date/purchase.py (+44/-0)
To merge this branch: bzr merge lp:~numerigraphe-team/purchase-wkfl/7.0-add-purchase_delivery_split_date
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza Needs Resubmitting
Yannick Vaucher @ Camptocamp code review, no test Approve
Lorenzo Battistini (community) code review Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Needs Fixing
Loïc Bellier - Numérigraphe (community) code review Approve
Review via email: mp+211374@code.launchpad.net

Description of the change

This branch adds a new module which, when installed, creates one reception picking for each expected date on the purchase order.
This way stock workers have a clear view of which goods should be received when.

This modules uses the modular design of purchase orders to create several pickings rather that a single one: to the best f my knowledge, this should be compatible with the other modules in this branch.

To post a comment you must log in.
31. By Numérigraphe

[ADD] authors file

Revision history for this message
Loïc Bellier - Numérigraphe (lb-b) :
review: Approve (code review)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi Lionel,

Thanks for the contrib ! A few remarks concerning community guideline:

 * L32 : use from . import purchase
 * L95 : use full path instead : from openerp.osv import orm
 * L114 : use let a print, remove it please

Otherwise, LGTM,

Regards,

Joël

review: Needs Fixing (code review, no tests)
32. By Numérigraphe

[REF] explicit import paths. Updated authors file. Use itervalues() when we don't need the keys

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Thanks Joël, I've updated the module as you suggested.

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Please don't add AUTHOR.txt file and add Contributors in __openerp__.py

For who did exaclty what there is the CVS

review: Needs Fixing
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Yannick, I agree, but I thought it was required for OCA modules - I can't remember why I assumed that, maybe read it in some guide somewhere.
I'll fix it.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Here is the reference for this community Guideline.

https://doc.openerp.com/contribute/05_developing_modules/#modules-description

This has the advantage to show who contributed directly on apps.odoo.com as we don't have such field in manifest.

33. By Numérigraphe

[DEL] remove AUTHORS file - annotate will tell whom to blame

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

I moved the crediting to a comment in __openerp__.py, is it right?

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :
34. By Numérigraphe

[IMP] Make a 'contributor' paragraph

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

I think it's fixed now.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Perfect, thanks for the changes Lionel

review: Approve (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

This project is now hosted on https://github.com/OCA/purchase-workflow. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting

Unmerged revisions

34. By Numérigraphe

[IMP] Make a 'contributor' paragraph

33. By Numérigraphe

[DEL] remove AUTHORS file - annotate will tell whom to blame

32. By Numérigraphe

[REF] explicit import paths. Updated authors file. Use itervalues() when we don't need the keys

31. By Numérigraphe

[ADD] authors file

30. By Numérigraphe

[ADD] Module to split purchase receptions into 1 picking by expected date

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'purchase_delivery_split_date'
2=== added file 'purchase_delivery_split_date/__init__.py'
3--- purchase_delivery_split_date/__init__.py 1970-01-01 00:00:00 +0000
4+++ purchase_delivery_split_date/__init__.py 2014-05-19 11:29:31 +0000
5@@ -0,0 +1,21 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
10+#
11+# This program is free software: you can redistribute it and/or modify
12+# it under the terms of the GNU General Public License as published by
13+# the Free Software Foundation, either version 3 of the License, or
14+# (at your option) any later version.
15+#
16+# This program is distributed in the hope that it will be useful,
17+# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+# GNU General Public License for more details.
20+#
21+# You should have received a copy of the GNU General Public License
22+# along with this program. If not, see <http://www.gnu.org/licenses/>.
23+#
24+##############################################################################
25+
26+from . import purchase
27
28=== added file 'purchase_delivery_split_date/__openerp__.py'
29--- purchase_delivery_split_date/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ purchase_delivery_split_date/__openerp__.py 2014-05-19 11:29:31 +0000
31@@ -0,0 +1,41 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
36+#
37+# This program is free software: you can redistribute it and/or modify
38+# it under the terms of the GNU General Public License as published by
39+# the Free Software Foundation, either version 3 of the License, or
40+# (at your option) any later version.
41+#
42+# This program is distributed in the hope that it will be useful,
43+# but WITHOUT ANY WARRANTY; without even the implied warranty of
44+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45+# GNU General Public License for more details.
46+#
47+# You should have received a copy of the GNU General Public License
48+# along with this program. If not, see <http://www.gnu.org/licenses/>.
49+#
50+##############################################################################
51+
52+{
53+ 'name': "Purchase Deliveries split by date",
54+ 'version': '1.0',
55+ 'author': u'Numérigraphe',
56+ 'category': 'Purchase Management',
57+ 'description': """
58+Split Purchase Deliveries in one reception per expected date
59+------------------------------------------------------------
60+
61+When this module is installed, each Purchase Order you confirm will generate one
62+Reception Order per delivery date indicated in the Purchase Order Lines.
63+
64+Contributors
65+------------
66+
67+ * Philippe Rossi <pr@numerigraphe.com> (initial patch against v6.0)
68+ * Lionel Sausin <ls@numerigraphe.com> (modularization for v7.0)
69+""",
70+ 'license': 'AGPL-3',
71+ "depends": ['purchase'],
72+}
73
74=== added file 'purchase_delivery_split_date/purchase.py'
75--- purchase_delivery_split_date/purchase.py 1970-01-01 00:00:00 +0000
76+++ purchase_delivery_split_date/purchase.py 2014-05-19 11:29:31 +0000
77@@ -0,0 +1,44 @@
78+# -*- coding: utf-8 -*-
79+##############################################################################
80+#
81+# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved.
82+#
83+# This program is free software: you can redistribute it and/or modify
84+# it under the terms of the GNU General Public License as published by
85+# the Free Software Foundation, either version 3 of the License, or
86+# (at your option) any later version.
87+#
88+# This program is distributed in the hope that it will be useful,
89+# but WITHOUT ANY WARRANTY; without even the implied warranty of
90+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91+# GNU General Public License for more details.
92+#
93+# You should have received a copy of the GNU General Public License
94+# along with this program. If not, see <http://www.gnu.org/licenses/>.
95+#
96+##############################################################################
97+
98+from openerp.osv import orm
99+
100+
101+class PurchaseOrder(orm.Model):
102+ _inherit = "purchase.order"
103+
104+ def _create_pickings(self, cr, uid, order, order_lines, picking_id=False,
105+ context=None):
106+ """Group the Purchase Order's receptions by expected date"""
107+ picking_ids = []
108+ delivery_dates = {}
109+ # Triage the order lines by delivery date
110+ for line in order_lines:
111+ if line.date_planned in delivery_dates:
112+ delivery_dates[line.date_planned].append(line)
113+ else:
114+ delivery_dates[line.date_planned] = [line]
115+ # Process each group of lines
116+ for lines in delivery_dates.itervalues():
117+ picking_ids.extend(
118+ super(PurchaseOrder, self)._create_pickings(
119+ cr, uid, order, lines, picking_id=picking_id,
120+ context=context))
121+ return picking_ids

Subscribers

People subscribed via source and target branches