← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

Joël Grand-Guillaume @ camptocamp has proposed merging lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge into lp:sale-wkfl.

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

Requested reviews:
  Sale Core Editors (sale-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge/+merge/198960

[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
-- 
https://code.launchpad.net/~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge/+merge/198960
Your team Sale Core Editors is requested to review the proposed merge of lp:~camptocamp/sale-wkfl/add-jit-module-for-service-product-jge into 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	2013-12-13 15:31:58 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
+#    Authors: Joel Grand-Guillaume
+#
+#    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 sale_stock
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== 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	2013-12-13 15:31:58 +0000
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
+#    Authors: Joel Grand-Guillaume
+#
+#    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 product and services, the workflow of the SO will not reach 
+the state done unless you deliver all the products and the procurements linked to
+services product are done.
+
+Usualy, the when the mrp run, it mark the procurement of services line 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>
+
+""",
+    'author': 'Camptocamp',
+    'depends': ['sale_stock' ],
+    'website': 'http://www.camptocamp.com',
+    'data': [
+            ],
+    'test': [
+        'test/sale_service_jit_test.yml',
+    ],
+    'demo': [],
+    'installable': True,
+    'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'sale_jit_on_services/sale_stock.py'
--- sale_jit_on_services/sale_stock.py	1970-01-01 00:00:00 +0000
+++ sale_jit_on_services/sale_stock.py	2013-12-13 15:31:58 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
+#    Authors: Joel Grand-Guillaume
+#
+#    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 fields, orm
+from openerp import netsvc
+import logging
+_logger = logging.getLogger(__name__)
+
+class sale_order(orm.Model):
+    _inherit = "sale.order"
+
+    def _create_pickings_and_procurements(self, cr, uid, order, order_lines,
+                                          picking_id=False, context=None):
+        """Override the method to launch the procurement automatically for 
+        all line with a service product.
+
+        :param browse_record order: sales order to which the order lines belong
+        :param list(browse_record) order_lines: sales order line records to procure
+        :param int picking_id: optional ID of a stock picking to which the created stock moves
+                               will be added. A new picking will be created if ommitted.
+        :return: True
+        """
+        res = super(sale_order, self)._create_pickings_and_procurements(cr,
+                                                                        uid,
+                                                                        order,
+                                                                        order_lines,
+                                                                        picking_id=picking_id,
+                                                                        context=context)
+        wf_service = netsvc.LocalService("workflow")
+        order.refresh()
+        for line in order.order_line:
+            if line.product_id and line.product_id.type == 'service':
+                if line.procurement_id:
+                    _logger.debug('Trigger button check on procurement`%s`, id %s', line.procurement_id.name, line.id)
+                    proc_id = line.procurement_id.id
+                    wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_check', cr)
+        return res


Follow ups