forked from OCA/sale-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rewrite sale_jit_on_services using workflows
- Loading branch information
Showing
6 changed files
with
84 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# OpenERP, Open Source Management Solution | ||
# Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>) | ||
# Authors: Joel Grand-Guillaume | ||
# 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 | ||
|
@@ -43,12 +42,15 @@ | |
------------ | ||
* Joël Grand-Guillaume <[email protected]> | ||
* Yannick Vaucher <[email protected]> | ||
""", | ||
'author': 'Camptocamp', | ||
'depends': ['sale_stock'], | ||
'depends': ['procurement'], | ||
'website': 'http://www.camptocamp.com', | ||
'data': [], | ||
'data': [ | ||
'procurement_workflow.xml' | ||
], | ||
'test': [ | ||
'test/sale_service_jit_test.yml', | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |