Merge lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge into lp:~sale-core-editors/sale-wkfl/7.0

Proposed by Yannick Vaucher @ Camptocamp
Status: Merged
Merged at revision: 44
Proposed branch: lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge
Merge into: lp:~sale-core-editors/sale-wkfl/7.0
Diff against target: 182 lines (+156/-0)
5 files modified
sale_jit_on_services/__init__.py (+22/-0)
sale_jit_on_services/__openerp__.py (+60/-0)
sale_jit_on_services/procurement.py (+36/-0)
sale_jit_on_services/procurement_workflow.xml (+14/-0)
sale_jit_on_services/test/sale_service_jit_test.yml (+24/-0)
To merge this branch: bzr merge lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge
Reviewer Review Type Date Requested Status
Sandy Carter (http://www.savoirfairelinux.com) Approve
Yannick Vaucher @ Camptocamp Abstain
Guewen Baconnier @ Camptocamp code review Approve
Nicolas Bessi - Camptocamp code review, no test Pending
Review via email: mp+214719@code.launchpad.net

This proposal supersedes a proposal from 2013-12-13.

Description of the change

[ADD] sale_jit_on_services module that provide the mrp_jit feature but only on product of type service.

This allow to have SO marked as delivered without waiting the mrp

I resubmit as it was rewritten using workflows

To post a comment you must log in.
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : Posted in a previous version of this proposal

Just wondering if the logging is supposed to be there or just there for debugging purposes.
If that's the case, you might want to remove it.

Some PEP8 issues:
__init__.py:3:2: W291 trailing whitespace
__init__.py:19:75: W291 trailing whitespace
__openerp__.py:32:84: W291 trailing whitespace
__openerp__.py:39:78: W291 trailing whitespace
__openerp__.py:49:29: E202 whitespace before ']'
__openerp__.py:52:13: E126 continuation line over-indented for hanging indent
sale_stock.py:3:2: W291 trailing whitespace
sale_stock.py:19:75: W291 trailing whitespace
sale_stock.py:28:1: E302 expected 2 blank lines, found 1
sale_stock.py:33:75: W291 trailing whitespace

Typos:
__openerp__.py:36: In word 'Usualy'
sale_stock.py:39: In word 'ommitted'

Unused imports:
sale_stock.py:23: fields

review: Needs Fixing (code review)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : Posted in a previous version of this proposal

Joël,

The "mrp_jit" module uses a different approach: it modifies the condition of the workflow.
Did you do it this way to ensure compatibility when both modules are installed?

I may be wrong but I wonder if the condition on l.152 should not restrict only on 'service' *and* 'buy' so if the 'project_mrp' module is used, the 'produce service' would still be triggered by the scheduler.

review: Needs Information
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote : Posted in a previous version of this proposal

Regarding the second remark, I think it's ok not to filter on only "buy" one cause I "just" run the button. As this module is called JIT on service, I think it's ok to automatically run the procurement related to them.

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : Posted in a previous version of this proposal

Just fixed some PEP8 issues.

LGTM

review: Approve (code review, no test)
Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote : Posted in a previous version of this proposal

I would greatly appreciate some tests on the module, before merging it.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote : Posted in a previous version of this proposal

Still two typos:
l.68: Usualy -> Usually
lp.138: ommitted -> omitted

review: Needs Fixing
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

Fixed typos

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

Thanks Sandy

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

LGTM

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : Posted in a previous version of this proposal

Missed Guewen's comment

It should be better using workflow some work still needed

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks! LGTM

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

I abstain as I did the rewrite

review: Abstain
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

l.120 is CamelCase the standard now?

review: Approve
33. By Yannick Vaucher @ Camptocamp

misdated headers

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

@Sandy I often use CamelCase in my modules and this for past 2 years. No decision was made on mailing list though a majority of people were for CamelCase. For now I would say we are still in a non settled area of convention. So I took the risk to stick to CamelCase for this one.

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

@Yannick Good to know, thank you.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'sale_jit_on_services'
2=== added file 'sale_jit_on_services/__init__.py'
3--- sale_jit_on_services/__init__.py 1970-01-01 00:00:00 +0000
4+++ sale_jit_on_services/__init__.py 2014-04-08 13:42:21 +0000
5@@ -0,0 +1,22 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Yannick Vaucher
10+# Copyright 2014 Camptocamp SA
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+from . import procurement
28
29=== added file 'sale_jit_on_services/__openerp__.py'
30--- sale_jit_on_services/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ sale_jit_on_services/__openerp__.py 2014-04-08 13:42:21 +0000
32@@ -0,0 +1,60 @@
33+# -*- coding: utf-8 -*-
34+##############################################################################
35+#
36+# Author: Joël Grand-Guillaume, Yannick Vaucher
37+# Copyright 2013 Camptocamp SA
38+#
39+# This program is free software: you can redistribute it and/or modify
40+# it under the terms of the GNU Affero General Public License as
41+# published by the Free Software Foundation, either version 3 of the
42+# License, or (at your option) any later version.
43+#
44+# This program is distributed in the hope that it will be useful,
45+# but WITHOUT ANY WARRANTY; without even the implied warranty of
46+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47+# GNU Affero General Public License for more details.
48+#
49+# You should have received a copy of the GNU Affero General Public License
50+# along with this program. If not, see <http://www.gnu.org/licenses/>.
51+#
52+##############################################################################
53+
54+{
55+ 'name': 'Sale Service Just In Time',
56+ 'version': '1.0',
57+ 'category': 'Generic Modules/Sale',
58+ 'description': """
59+Sale Service Just In Time
60+=========================
61+
62+When you make a SO with products and services, the workflow of the SO will not
63+reach the state done unless you deliver all products and procurements
64+linked to service products are done.
65+
66+Usually, when the MRP runs, it marks procurements of services' lines as
67+done. But, you may want to mark them as done like if you were using the
68+mrp_jit module.
69+
70+This module provide that feature: It bring the behavior of the mrp_jit module
71+but only on services products.
72+
73+Contributors
74+------------
75+
76+ * Joël Grand-Guillaume <joel.grand-guillaume@camptocamp.com>
77+ * Yannick Vaucher <yannick.vaucher@camptocamp.com>
78+
79+""",
80+ 'author': 'Camptocamp',
81+ 'depends': ['procurement'],
82+ 'website': 'http://www.camptocamp.com',
83+ 'data': [
84+ 'procurement_workflow.xml'
85+ ],
86+ 'test': [
87+ 'test/sale_service_jit_test.yml',
88+ ],
89+ 'demo': [],
90+ 'installable': True,
91+ 'active': False,
92+}
93
94=== added file 'sale_jit_on_services/procurement.py'
95--- sale_jit_on_services/procurement.py 1970-01-01 00:00:00 +0000
96+++ sale_jit_on_services/procurement.py 2014-04-08 13:42:21 +0000
97@@ -0,0 +1,36 @@
98+# -*- coding: utf-8 -*-
99+##############################################################################
100+#
101+# Author: Yannick Vaucher
102+# Copyright 2014 Camptocamp SA
103+#
104+# This program is free software: you can redistribute it and/or modify
105+# it under the terms of the GNU Affero General Public License as
106+# published by the Free Software Foundation, either version 3 of the
107+# License, or (at your option) any later version.
108+#
109+# This program is distributed in the hope that it will be useful,
110+# but WITHOUT ANY WARRANTY; without even the implied warranty of
111+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
112+# GNU Affero General Public License for more details.
113+#
114+# You should have received a copy of the GNU Affero General Public License
115+# along with this program. If not, see <http://www.gnu.org/licenses/>.
116+#
117+##############################################################################
118+from openerp.osv import orm
119+
120+class ProcurementOrder(orm.Model):
121+ """
122+ Procurement Orders
123+ """
124+ _inherit = 'procurement.order'
125+
126+ def is_service(self, cr, uid, ids):
127+ """ condition on the transition to go from 'confirm' activity to
128+ 'confirm_wait' activity """
129+ for procurement in self.browse(cr, uid, ids):
130+ product = procurement.product_id
131+ if product.type == 'service':
132+ return True
133+ return False
134
135=== added file 'sale_jit_on_services/procurement_workflow.xml'
136--- sale_jit_on_services/procurement_workflow.xml 1970-01-01 00:00:00 +0000
137+++ sale_jit_on_services/procurement_workflow.xml 2014-04-08 13:42:21 +0000
138@@ -0,0 +1,14 @@
139+<?xml version="1.0"?>
140+<openerp>
141+ <data>
142+
143+ <record model="workflow.transition" id="trans_direct_confirm_to_wait_services">
144+ <!-- Duplicates the transition between the act_confirm and act_confirm_wait activites
145+ but, this time, without the signal and only for services -->
146+ <field name="act_from" ref="procurement.act_confirm"/>
147+ <field name="act_to" ref="procurement.act_confirm_wait"/>
148+ <field name="condition">check_conditions_confirm2wait() and is_service()</field>
149+ </record>
150+
151+ </data>
152+</openerp>
153
154=== added directory 'sale_jit_on_services/test'
155=== added file 'sale_jit_on_services/test/sale_service_jit_test.yml'
156--- sale_jit_on_services/test/sale_service_jit_test.yml 1970-01-01 00:00:00 +0000
157+++ sale_jit_on_services/test/sale_service_jit_test.yml 2014-04-08 13:42:21 +0000
158@@ -0,0 +1,24 @@
159+-
160+ In order to test mrp_jit module with OpenERP, I create procurement order for
161+ Computer Case product and check whether it runs without scheduler or not.
162+-
163+ !record {model: procurement.order, id: procurement_order_test1}:
164+ company_id: base.main_company
165+ date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
166+ location_id: stock.stock_location_stock
167+ name: PROC/TEST/0001
168+ product_id: product.product_product_1
169+ product_qty: 1.0
170+ product_uom: product.product_uom_unit
171+ product_uos_qty: 0.0
172+-
173+ |
174+ I confirm the procurement order PROC/TEST/0001.
175+-
176+ !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test1}
177+-
178+ |
179+ I check that the procurement is scheduled automatically.
180+-
181+ !assert {model: procurement.order, id: procurement_order_test1, string: procstate}:
182+ - state<>'confirmed'

Subscribers

People subscribed via source and target branches