[IMP] stock: Task ID-581: Converted stock_ups and stock_replacement wizards into...
authormtr <mtr@mtr>
Fri, 23 Apr 2010 13:50:17 +0000 (19:20 +0530)
committermtr <mtr@mtr>
Fri, 23 Apr 2010 13:50:17 +0000 (19:20 +0530)
bzr revid: mtr@mtr-20100423135017-bg5iuwdyodj1dbao

addons/stock/wizard/__init__.py
addons/stock/wizard/stock_replacement.py [new file with mode: 0644]
addons/stock/wizard/stock_replacement_view.xml [new file with mode: 0644]
addons/stock/wizard/stock_ups.py [new file with mode: 0644]
addons/stock/wizard/stock_ups_view.xml [new file with mode: 0644]
addons/stock/wizard/wizard_replacement.py [deleted file]
addons/stock/wizard/wizard_ups.py [deleted file]

index 8fac304..8282500 100644 (file)
@@ -23,8 +23,8 @@ import stock_traceability
 import stock_move
 import stock_partial_picking
 import stock_partial_move
-import wizard_replacement
-import wizard_ups
+import stock_replacement
+import stock_ups
 import stock_inventory_merge
 import stock_inventory_set_stock_zero
 import stock_fill_inventory
diff --git a/addons/stock/wizard/stock_replacement.py b/addons/stock/wizard/stock_replacement.py
new file mode 100644 (file)
index 0000000..e753206
--- /dev/null
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 osv import fields, osv
+from service import web_services
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import wizard
+
+class stock_replacement(osv.osv_memory):
+    """
+        This class has been defined for replacement wizard
+    """
+    _name = "stock.replacement"
+    _description = "Stock Replacement"
+
+    def get_composant(self, cr, uid, ids, context):
+        return {}
+
+    def replace_composant(self, cr, uid, ids, context):
+        """ 
+           to open a new wizard that acknowledge, a replacement task 
+            
+           @return: it returns the replacement acknowledgement form
+        
+        """                
+        return {
+                    'name': False, 
+                    'view_type': 'form', 
+                    'view_mode': 'form', 
+                    'res_model': 'stock.replacement.result', 
+                    'type': 'ir.actions.act_window', 
+                    'target':'new',
+            }
+
+stock_replacement()
+
+class stock_replacement_result(osv.osv_memory):
+    """
+        This class has been defined for replacement result 
+    """
+    _name = "stock.replacement.result"
+    _description = "Stock Replacement result"
+
+stock_replacement_result()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/wizard/stock_replacement_view.xml b/addons/stock/wizard/stock_replacement_view.xml
new file mode 100644 (file)
index 0000000..ce5f7ef
--- /dev/null
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+       <record id="view_stock_replacement" model="ir.ui.view">
+                <field name="name">Stock Replacement</field>
+                <field name="model">stock.replacement</field>
+                <field name="type">form</field>
+                <field name="arch" type="xml">
+                       <form string="Replace a component">
+                               <label string="Component" colspan="4"/>
+                                               <separator string="" colspan="4" />
+                               <button icon='gtk-cancel' special="cancel" string="Cancel" />
+                               <button name="replace_composant" string="Replace" type="object" />
+                       </form>
+                   </field>
+               </record>               
+       
+                       <act_window name="Stock Replacement"                
+                               res_model="stock.replacement"
+                               src_model=""
+                               view_mode="form"
+                               target="new"        
+                               key2="client_action_multi"    
+                               id="action_view_stock_replacement"/>
+
+
+            <record id="view_stock_replacement_result" model="ir.ui.view">
+                <field name="name">Stock Replacement result</field>
+                <field name="model">stock.replacement.result</field>
+                <field name="type">form</field>
+                <field name="arch" type="xml">
+                       <form string="Replace result">
+                               <label string="Replacing successful !" colspan="4"/>
+                                               <separator string="" colspan="4" />
+                               <button special="cancel" string="Ok" />
+                       </form>
+                   </field>
+               </record>
+
+       </data>
+</openerp>
diff --git a/addons/stock/wizard/stock_ups.py b/addons/stock/wizard/stock_ups.py
new file mode 100644 (file)
index 0000000..ad6e157
--- /dev/null
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 osv import fields, osv
+from service import web_services
+from tools.translate import _
+import netsvc
+import pooler
+import time
+import wizard
+
+class stock_ups(osv.osv_memory):
+    _name = "stock.ups"
+    _description = "Stock ups"
+
+    def ups_save(self, cr, uid, ids, context):
+       
+        return {
+                    'name': False, 
+                    'view_type': 'form', 
+                    'view_mode': 'form', 
+                    'res_model': 'stock.ups.final', 
+                    'type': 'ir.actions.act_window', 
+                    'target':'new',
+            }
+    def ups_upload(self, cr, uid, ids, context):
+         
+        return {
+                    'name': False, 
+                    'view_type': 'form', 
+                    'view_mode': 'form', 
+                    'res_model': 'stock.ups.upload', 
+                    'type': 'ir.actions.act_window', 
+                    'target':'new',
+            }
+    _columns = {
+        'weight': fields.float('Lot weight', required=True), 
+    }
+
+    _defaults = {
+        'weight': lambda *a: 3.0,
+    }
+stock_ups()
+
+class stock_ups_final(osv.osv_memory):
+    _name = "stock.ups.final"
+    _description = "Stock ups final"
+
+#    def create_xmlfile(self, cr, uid, ids, context):
+#        report = netsvc._group['report']['report.stock.move.lot.ups_xml']
+#        data['report_type'] = 'raw'
+#        return {'xmlfile' : report.create(uid, context['active_id'], ids, {})}
+
+    _columns = {
+        'xmlfile': fields.binary('XML File'), 
+    }
+
+stock_ups_final()
+
+class stock_ups_upload(osv.osv_memory):
+    _name = "stock.ups.upload"
+    _description = "Stock ups upload"
+
+    def upload_xmlfile(self, cr, uid, ids, context):
+#        report = netsvc._group['report']['report.stock.move.lot.ups_xml']
+#        data['report_type'] = 'raw'
+#FIXME: this seems unfinished   
+#        fp = file('/tmp/test.xml', 'w').write(report.create(uid, context['active_id'], ids, {}))
+        return {}
+
+stock_ups_upload()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/stock/wizard/stock_ups_view.xml b/addons/stock/wizard/stock_ups_view.xml
new file mode 100644 (file)
index 0000000..89b5fe1
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+       <data>
+
+               <record id="view_stock_ups" model="ir.ui.view">
+                       <field name="name">Stock ups</field>
+                       <field name="model">stock.ups</field>
+                       <field name="type">form</field>
+                       <field name="arch" type="xml">
+                               <form string="UPS XML generator">
+                                       <separator string="UPS generator" colspan="4"/>
+                                       <field name="weight" />
+                                       <separator string="" colspan="4" />
+                                       <button icon='gtk-cancel' special="cancel" string="Cancel" />
+                                       <button name="ups_save" string="Get xml file" type="object" />
+                                       <button name="ups_upload" string="Upload xml file" type="object" />
+                               </form>
+                       </field>
+               </record>
+
+               <record id="view_stock_ups_final" model="ir.ui.view">
+                       <field name="name">Stock ups</field>
+                       <field name="model">stock.ups.final</field>
+                       <field name="type">form</field>
+                       <field name="arch" type="xml">
+                               <form string="UPS XML generator">
+                               <separator string="Save the attached file" colspan="4" />
+                                       <field name="xmlfile" />
+                                       <button  special="cancel" string="End" />
+                                       <button name="create_xmlfile" string="create xml file" type="object" />
+                               </form>
+                       </field>
+               </record>
+               
+               <record id="view_stock_ups_upload" model="ir.ui.view">
+                       <field name="name">Stock ups</field>
+                       <field name="model">stock.ups.upload</field>
+                       <field name="type">form</field>
+                       <field name="arch" type="xml">
+                               <form string="UPS XML generator">
+                                       <separator string="File uploaded" colspan="4" />
+                                       <button  special="cancel" string="End" />
+                                       <button name="upload_xmlfile" string="Upload xml file" type="object" />
+                               </form>
+                       </field>
+               </record>                       
+       
+               <act_window name="Stock ups"                
+                       res_model="stock.ups"
+                       src_model=""
+                       view_mode="form"
+                       target="new"        
+                       key2="client_action_multi"    
+                       id="action_view_stock_ups"/>
+</data>
+</openerp>
diff --git a/addons/stock/wizard/wizard_replacement.py b/addons/stock/wizard/wizard_replacement.py
deleted file mode 100644 (file)
index 5b066aa..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    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/>.     
-#
-##############################################################################
-
-import wizard
-
-class wizard_replacement(wizard.interface):
-
-    def getComposant(self, cr, uid, data, context):
-        return {}
-
-    def replaceComposant(self, cr, uid, data, context):
-        return {}
-
-    comp_form = '''<?xml version="1.0"?><form string="Replace a component"><label string="Component" colspan="4"/></form>'''
-    comp_fields = {}
-
-    replace_form = '''<?xml version="1.0"?><form string="Replace result"><label string="Replacing successful !" colspan="4" /></form>'''
-    replace_fields = {}
-
-    states = {
-            'init' : {
-                'actions' : [getComposant],
-                'result' : {
-                    'type' : 'form',
-                    'arch' : comp_form,
-                    'fields' : comp_fields,
-                    'state' : [('end', 'Cancel'), ('replace', 'Replace')]}
-                },
-            'replace' : {
-                'action' : [replaceComposant],
-                'result' : {
-                    'type' : 'form',
-                    'arch' : replace_form,
-                    'fields' : replace_fields,
-                    'state' : [('end', 'Ok')]}
-                },
-            }
-
-wizard_replacement('stock.move.replace')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/stock/wizard/wizard_ups.py b/addons/stock/wizard/wizard_ups.py
deleted file mode 100644 (file)
index f57128c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    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/>.     
-#
-##############################################################################
-import os
-
-import wizard
-import netsvc
-import time
-
-_ups_form = '''<?xml version="1.0"?>
-<form string="UPS XML generator">
-    <separator string="UPS generator" colspan="4"/>
-    <field name="weight" />
-</form>'''
-
-_ups_fields = {
-    'weight' : { 'string' : 'Lot weight', 'type' : 'float', 'default' : lambda *a: 3.0, 'required' : True },
-}
-
-_ups_finalform = '''<?xml version="1.0"?>
-<form string="UPS XML generator">
-    <separator string="Save the attached file" colspan="4" />
-    <field name="xmlfile" />
-</form>'''
-
-_ups_finalfields = {
-    'xmlfile' : { 'string' : 'XML File', 'type' : 'binary' },
-}
-
-_ups_uploadform = '''<?xml version="1.0"?>
-<form string="UPS XML generator">
-    <separator string="File uploaded" colspan="4" />
-</form>'''
-
-_ups_uploadfields = {}
-
-def create_xmlfile(self, cr, uid, data, context):
-    report = netsvc._group['report']['report.stock.move.lot.ups_xml']
-    data['report_type'] = 'raw'
-    return {'xmlfile' : report.create(uid, data['ids'], data, {})}
-
-def upload_xmlfile(self, cr, uid, data, context):
-    report = netsvc._group['report']['report.stock.move.lot.ups_xml']
-    data['report_type'] = 'raw'
-#FIXME: this seems unfinished   
-    fp = file('/tmp/test.xml', 'w').write(report.create(uid, data['ids'], data, {}))
-    return {}
-
-class wiz_ups(wizard.interface):
-    states = {
-        'init': {
-            'actions': [],
-            'result': {'type': 'form', 'arch' : _ups_form, 'fields' : _ups_fields, 'state':[('end','Cancel'),('ups_save','Get xml file'), ('ups_upload', 'Upload xml file')]}
-        },
-        'ups_save': {
-            'actions': [create_xmlfile],
-            'result': {'type': 'form', 'arch' : _ups_finalform, 'fields' : _ups_finalfields, 'state':[('end', 'End')]}
-        },
-        'ups_upload' : {
-            'actions' : [upload_xmlfile],
-            'result' : {'type' : 'form', 'arch' : _ups_uploadform, 'fields' : _ups_uploadfields, 'state' : [('end', 'End')]}
-        },
-    }
-wiz_ups('stock.ups_xml');
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-