openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #05776
[Merge] lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge into lp:sale-wkfl
Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge into lp:sale-wkfl.
Requested reviews:
Nicolas Bessi - Camptocamp (nbessi-c2c): code review, no test
Guewen Baconnier @ Camptocamp (gbaconnier-c2c)
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter)
Yannick Vaucher @ Camptocamp (yvaucher-c2c)
For more details, see:
https://code.launchpad.net/~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge/+merge/214719
[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
--
https://code.launchpad.net/~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge/+merge/214719
Your team Sale Core Editors is subscribed to branch lp:sale-wkfl.
=== 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 11:12:09 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Yannick Vaucher
+# Copyright 2013 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from . import procurement
=== 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 11:12:09 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Joël Grand-Guillaume, Yannick Vaucher
+# Copyright 2013 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+ 'name': 'Sale Service Just In Time',
+ 'version': '1.0',
+ 'category': 'Generic Modules/Sale',
+ 'description': """
+Sale Service Just In Time
+=========================
+
+When you make a SO with products and services, the workflow of the SO will not
+reach the state done unless you deliver all products and procurements
+linked to service products are done.
+
+Usually, when the MRP runs, it marks procurements of services' lines as
+done. But, you may want to mark them as done like if you were using the
+mrp_jit module.
+
+This module provide that feature: It bring the behavior of the mrp_jit module
+but only on services products.
+
+Contributors
+------------
+
+ * Joël Grand-Guillaume <joel.grand-guillaume@xxxxxxxxxxxxxx>
+ * Yannick Vaucher <yannick.vaucher@xxxxxxxxxxxxxx>
+
+""",
+ 'author': 'Camptocamp',
+ 'depends': ['procurement'],
+ 'website': 'http://www.camptocamp.com',
+ 'data': [
+ 'procurement_workflow.xml'
+ ],
+ 'test': [
+ 'test/sale_service_jit_test.yml',
+ ],
+ 'demo': [],
+ 'installable': True,
+ 'active': False,
+}
=== 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 11:12:09 +0000
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Author: Yannick Vaucher
+# Copyright 2013 Camptocamp SA
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.osv import orm
+
+class ProcurementOrder(orm.Model):
+ """
+ Procurement Orders
+ """
+ _inherit = 'procurement.order'
+
+ def is_service(self, cr, uid, ids):
+ """ condition on the transition to go from 'confirm' activity to
+ 'confirm_wait' activity """
+ for procurement in self.browse(cr, uid, ids):
+ product = procurement.product_id
+ if product.type == 'service':
+ return True
+ return False
=== 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 11:12:09 +0000
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <record model="workflow.transition" id="trans_direct_confirm_to_wait_services">
+ <!-- Duplicates the transition between the act_confirm and act_confirm_wait activites
+ but, this time, without the signal and only for services -->
+ <field name="act_from" ref="procurement.act_confirm"/>
+ <field name="act_to" ref="procurement.act_confirm_wait"/>
+ <field name="condition">check_conditions_confirm2wait() and is_service()</field>
+ </record>
+
+ </data>
+</openerp>
=== 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 11:12:09 +0000
@@ -0,0 +1,24 @@
+-
+ In order to test mrp_jit module with OpenERP, I create procurement order for
+ Computer Case product and check whether it runs without scheduler or not.
+-
+ !record {model: procurement.order, id: procurement_order_test1}:
+ company_id: base.main_company
+ date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
+ location_id: stock.stock_location_stock
+ name: PROC/TEST/0001
+ product_id: product.product_product_1
+ product_qty: 1.0
+ product_uom: product.product_uom_unit
+ product_uos_qty: 0.0
+-
+ |
+ I confirm the procurement order PROC/TEST/0001.
+-
+ !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test1}
+-
+ |
+ I check that the procurement is scheduled automatically.
+-
+ !assert {model: procurement.order, id: procurement_order_test1, string: procstate}:
+ - state<>'confirmed'
Follow ups