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
=== added directory 'sale_jit_on_services'
=== added file 'sale_jit_on_services/__init__.py'
--- sale_jit_on_services/__init__.py 1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/__init__.py 2014-04-08 13:42:21 +0000
@@ -0,0 +1,22 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Yannick Vaucher
5# Copyright 2014 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from . import procurement
023
=== added file 'sale_jit_on_services/__openerp__.py'
--- sale_jit_on_services/__openerp__.py 1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/__openerp__.py 2014-04-08 13:42:21 +0000
@@ -0,0 +1,60 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Joël Grand-Guillaume, Yannick Vaucher
5# Copyright 2013 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22{
23 'name': 'Sale Service Just In Time',
24 'version': '1.0',
25 'category': 'Generic Modules/Sale',
26 'description': """
27Sale Service Just In Time
28=========================
29
30When you make a SO with products and services, the workflow of the SO will not
31reach the state done unless you deliver all products and procurements
32linked to service products are done.
33
34Usually, when the MRP runs, it marks procurements of services' lines as
35done. But, you may want to mark them as done like if you were using the
36mrp_jit module.
37
38This module provide that feature: It bring the behavior of the mrp_jit module
39but only on services products.
40
41Contributors
42------------
43
44 * Joël Grand-Guillaume <joel.grand-guillaume@camptocamp.com>
45 * Yannick Vaucher <yannick.vaucher@camptocamp.com>
46
47""",
48 'author': 'Camptocamp',
49 'depends': ['procurement'],
50 'website': 'http://www.camptocamp.com',
51 'data': [
52 'procurement_workflow.xml'
53 ],
54 'test': [
55 'test/sale_service_jit_test.yml',
56 ],
57 'demo': [],
58 'installable': True,
59 'active': False,
60}
061
=== added file 'sale_jit_on_services/procurement.py'
--- sale_jit_on_services/procurement.py 1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/procurement.py 2014-04-08 13:42:21 +0000
@@ -0,0 +1,36 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Yannick Vaucher
5# Copyright 2014 Camptocamp SA
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21from openerp.osv import orm
22
23class ProcurementOrder(orm.Model):
24 """
25 Procurement Orders
26 """
27 _inherit = 'procurement.order'
28
29 def is_service(self, cr, uid, ids):
30 """ condition on the transition to go from 'confirm' activity to
31 'confirm_wait' activity """
32 for procurement in self.browse(cr, uid, ids):
33 product = procurement.product_id
34 if product.type == 'service':
35 return True
36 return False
037
=== added file 'sale_jit_on_services/procurement_workflow.xml'
--- sale_jit_on_services/procurement_workflow.xml 1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/procurement_workflow.xml 2014-04-08 13:42:21 +0000
@@ -0,0 +1,14 @@
1<?xml version="1.0"?>
2<openerp>
3 <data>
4
5 <record model="workflow.transition" id="trans_direct_confirm_to_wait_services">
6 <!-- Duplicates the transition between the act_confirm and act_confirm_wait activites
7 but, this time, without the signal and only for services -->
8 <field name="act_from" ref="procurement.act_confirm"/>
9 <field name="act_to" ref="procurement.act_confirm_wait"/>
10 <field name="condition">check_conditions_confirm2wait() and is_service()</field>
11 </record>
12
13 </data>
14</openerp>
015
=== added directory 'sale_jit_on_services/test'
=== added file 'sale_jit_on_services/test/sale_service_jit_test.yml'
--- sale_jit_on_services/test/sale_service_jit_test.yml 1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/test/sale_service_jit_test.yml 2014-04-08 13:42:21 +0000
@@ -0,0 +1,24 @@
1-
2 In order to test mrp_jit module with OpenERP, I create procurement order for
3 Computer Case product and check whether it runs without scheduler or not.
4-
5 !record {model: procurement.order, id: procurement_order_test1}:
6 company_id: base.main_company
7 date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
8 location_id: stock.stock_location_stock
9 name: PROC/TEST/0001
10 product_id: product.product_product_1
11 product_qty: 1.0
12 product_uom: product.product_uom_unit
13 product_uos_qty: 0.0
14-
15 |
16 I confirm the procurement order PROC/TEST/0001.
17-
18 !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test1}
19-
20 |
21 I check that the procurement is scheduled automatically.
22-
23 !assert {model: procurement.order, id: procurement_order_test1, string: procstate}:
24 - state<>'confirmed'

Subscribers

People subscribed via source and target branches