Changes in workflow of mrp_repair, some other changes

bzr revid: ruchakpatel@gmail.com-20081022044247-68tpgadty5gx7z1n
This commit is contained in:
Rucha Patel
2008-10-22 10:12:47 +05:30
parent 3d62f2b9da
commit 70792a1ddd
6 changed files with 159 additions and 12 deletions
+1 -1
View File
@@ -52,7 +52,7 @@
"category":"Custom",
"depends":["sale","account"],
"demo_xml":[],
"update_xml":["mrp_repair_view.xml", "mrp_repair_workflow.xml", "mrp_repair_report.xml"],
"update_xml":["mrp_repair_view.xml", "mrp_repair_workflow.xml", "mrp_repair_wizard.xml","mrp_repair_report.xml"],
"active": False,
"installable": True,
}
+16 -10
View File
@@ -2,15 +2,6 @@
<openerp>
<data>
<wizard
id="action_cancel_repair"
model="mrp.repair"
name="mrp.repair.cancel"
string="Cancel Repair"
menu = "False"
multi = "True"
/>
<record id="view_repair_order_form" model="ir.ui.view">
<field name="name">mrp.repair.form</field>
<field name="model">mrp.repair</field>
@@ -36,6 +27,7 @@
<field colspan="4" mode="tree,form" name="operations" nolabel="1" widget="one2many_list">
<form string="Operations">
<field name="type" on_change="onchange_operation_type(type)"/>
<field name="invoice"/>
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM"/>
@@ -45,6 +37,7 @@
<field name="delay"/>
<field name="location_id"/>
<field name="location_dest_id"/>
<newline/>
<field name="state"/>
</form>
<tree string="Operations lines"> <!-- editable="bottom"> -->
@@ -62,9 +55,22 @@
<newline/>
<group col="13" colspan="4">
<field name="state" select="2"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_cancel" states="manual,progress" string="Cancel Order" type="object"/>
<button name="cancel" states="draft" string="Cancel Order"/>
<button name="invoice_cancel" states="invoice_except" string="Cancel Order"/>
<button name="repair_confirm" states="draft" string="Confirm Repair"/>
<button name="repair_done" states="confirmed" string="Repair Done"/>
<button name="invoice_recreate" states="invoice_except" string="Recreate Invoice"/>
<button name="invoice_corrected" states="invoice_except" string="Invoice Corrected"/>
<button name="ship_recreate" states="shipping_except" string="Recreate Procurement"/>
<button name="ship_corrected" states="shipping_except" string="Procurement Corrected"/>
<button name="make_invoice" states="2binvoiced" string="Make Invoice"/>
<button name="ship_cancel" states="shipping_except" string="Cancel Order"/>
<button name="repair_done" states="confirmed" string="Repair Done"/>
<button name="%(action_cancel_repair)d" states="draft,confirmed,2binvoiced" string="Cancel Repair" type="action"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
</group>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<wizard
id="action_cancel_repair"
model="mrp.repair"
name="mrp.repair.cancel"
string="Cancel Repair"
menu = "False"
multi = "True"
/>
<wizard
id="wizard_mrp_repair_make_invoice"
keyword="client_action_multi"
model="mrp.repair"
name="mrp.repair.make_invoice"
multi="True"
string="Make invoices"/>
</data>
</openerp>
+1 -1
View File
@@ -180,7 +180,7 @@
<record id="trans_wait_invoice_invoice_manual" model="workflow.transition">
<field name="act_from" ref="act_wait_invoice"/>
<field name="act_to" ref="act_invoice"/>
<field name="signal">manual_invoice</field>
<field name="signal">make_invoice</field>
</record>
<record id="trans_invoice_invoice_end" model="workflow.transition">
+33
View File
@@ -0,0 +1,33 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import wizard_cancel_repair
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,86 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import wizard
import netsvc
import pooler
cancel_form = """<?xml version="1.0"?>
<form string="Cancel Repair...??">
<label colspan="4" string="This operation will cancel the Repair process, but not the Invoice or Packing generated.\nDo you want to continue?" />
</form>
"""
cancel_fields = {}
def check_state(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
repair_obj = pool.get('mrp.repair').browse(cr, uid, data['ids'])[0]
if repair_obj.state == 'draft':
pool.get('mrp.repair').write(cr,uid,data['ids'],{'state':'cancel'})
return 'end'
else:
return 'display'
def _cancel_repair(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
repair_obj = pool.get('mrp.repair').browse(cr, uid, data['ids'])[0]
pool.get('mrp.repair').write(cr,uid,data['ids'],{'state':'cancel'})
return {}
class repair_cancel(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'choice', 'next_state' : check_state}
},
'display' : {
'actions' : [],
'result' : {'type' : 'form',
'arch' : cancel_form,
'fields' : cancel_fields,
'state' : [('end', 'No'),('yes', 'Yes') ]}
},
'yes' : {
'actions' : [],
'result' : {'type' : 'action',
'action' : _cancel_repair,
'state' : 'end'}
},
'end' : {
'actions' : [],
'result': {'type': 'state', 'state': 'end'},
},
}
repair_cancel("mrp.repair.cancel")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: