[IMP] point_of_sale: conver the wizard_scan_product into osv_memory wizard and set...
authorsbh (Open ERP) <sbh@tinyerp.com>
Thu, 1 Apr 2010 10:05:40 +0000 (15:35 +0530)
committersbh (Open ERP) <sbh@tinyerp.com>
Thu, 1 Apr 2010 10:05:40 +0000 (15:35 +0530)
bzr revid: sbh@tinyerp.com-20100401100540-rp77of0qjwv1gi9x

addons/point_of_sale/__terp__.py
addons/point_of_sale/security/ir.model.access.csv
addons/point_of_sale/wizard/__init__.py
addons/point_of_sale/wizard/pos_receipt_view.xml
addons/point_of_sale/wizard/pos_scan_product.py [new file with mode: 0644]
addons/point_of_sale/wizard/wizard_default_journal.py [deleted file]
addons/point_of_sale/wizard/wizard_scan_product.py [deleted file]

index b1838a2..f1d847c 100644 (file)
@@ -62,6 +62,7 @@ Main features :
         'wizard/pos_payment_report_user.xml',  
         'wizard/pos_payment_report.xml',
         'wizard/pos_payment.xml',
+        'wizard/pos_scan_product_view.xml',
         'pos_report.xml',
         'pos_wizard.xml',
         'pos_view.xml',
index a761e78..a36d631 100644 (file)
 "access_pos_open_statement","pos.close.statement","model_pos_close_statement","point_of_sale.group_pos_user",1,0,0,0
 "acess_pos_box_entries ","pos.box.entries ","model_pos_box_entries","point_of_sale.group_pos_user",1,0,0,0
 "access_pos_box_out","pos.box.out","model_pos_box_out","point_of_sale.group_pos_user",1,0,0,0
-"acess_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_sale_user","pos.sale.user","model_pos_sale_user","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_sale_user","pos.sales.user.today","model_pos_sales_user_today","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_sales_user_today_current_user","pos.sales.user.today.current_user","model_pos_sales_user_today_current_user","point_of_sale.group_pos_user",1,0,0,0
+"access_all_closed_cashbox_of_the_day","all.closed.cashbox.of.the.day","model_all_closed_cashbox_of_the_day","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_receipt","pos.receipt ","model_pos_receipt","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_payment_report_user","pos.payment.report.user","model_pos_payment_report_user","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_payment_report_date ","pos.payment.report.date ","model_pos_payment_report_date","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_make_payment","pos.make.payment","model_pos_make_payment","point_of_sale.group_pos_user",1,0,0,0
+"access_pos_scan_product","pos.scan.product","model_pos_scan_product","point_of_sale.group_pos_user",1,0,0,0
index 1384fb8..ba62c1f 100644 (file)
 #
 ##############################################################################
 
-#import wizard_pos_payment
-import wizard_default_journal
-import wizard_scan_product
 import wizard_return
-#import wizard_open_statement
+
 import pos_add_product
 import pos_confirm
 import pos_discount
@@ -43,6 +40,7 @@ import pos_payment_report_user
 import pos_payment_report_date
 import pos_payment_report
 import pos_payment
+import pos_scan_product
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
index c046259..44b0750 100644 (file)
@@ -2,37 +2,30 @@
 <openerp>
 <data>
 
-    <!--   pos.details -->
+    <!--   Pos Receipt -->
 
-    <record id="view_pos_receipt" model="ir.ui.view">
-      <field name="name">Receipt</field>
-      <field name="model">pos.receipt</field>
-      <field name="type">form</field>
-      <field name="arch" type="xml">
-        <form string="Receipt :">
-          <button icon='gtk-cancel' special="cancel"
-                  string="Close" />
-          <button name="print_report" string="Print Report"
-                  colspan="1" type="object" icon="gtk-ok" />
-        </form>
-      </field>
-    </record>
+               <record id="view_pos_receipt" model="ir.ui.view">
+                     <field name="name">Receipt</field>
+                     <field name="model">pos.receipt</field>
+                     <field name="type">form</field>
+                     <field name="arch" type="xml">
+                       <form string="Receipt :">
+                         <button icon='gtk-cancel' special="cancel"
+                                 string="Close" />
+                         <button name="print_report" string="Print Report"
+                                 colspan="1" type="object" icon="gtk-print" />
+                       </form>
+                     </field>
+       </record>
 
-    <act_window name="Print Receipt"
-        res_model="pos.receipt"
-        src_model="pos.order"
-        view_mode="form"
-        target="new"
-        key2="client_action_multi"
-        id="action_report_pos_receipt"/>
 
-      <!--record id="action_report_pos_receipt" model="ir.actions.act_window">
+      <record id="action_report_pos_receipt" model="ir.actions.act_window">
             <field name="name">Receipt</field>
             <field name="res_model">pos.receipt</field>
             <field name="view_type">form</field>
             <field name="view_mode">form</field>
              <field name="target">new</field>
-        </record-->
+        </record>
 
 </data>
 </openerp>
diff --git a/addons/point_of_sale/wizard/pos_scan_product.py b/addons/point_of_sale/wizard/pos_scan_product.py
new file mode 100644 (file)
index 0000000..e9e01b6
--- /dev/null
@@ -0,0 +1,47 @@
+# -*- 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 osv,fields
+from tools.translate import _
+
+class pos_scan_product(osv.osv_memory):
+    _name = 'pos.scan.product'
+    _description = 'Scan product'
+    _columns = {
+        'gencod': fields.char('Barcode',size=13,required= True)
+    }
+    def scan(self, cr, uid, ids, context):
+        """ 
+         To get the gencod and scan product         
+         @param self: The object pointer.
+         @param cr: A database cursor
+         @param uid: ID of the user currently logged in
+         @param context: A standard dictionary 
+         @return : retrun gencod
+        """
+                
+        data=self.read(cr, uid, ids)[0]
+        record_id = context and context.get('active_id',False)
+        result =self. pool.get('pos.order.line')._scan_product(cr, uid, data['gencod'], 1, record_id)
+        return {'gencod': False}
+
+pos_scan_product()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/wizard_default_journal.py b/addons/point_of_sale/wizard/wizard_default_journal.py
deleted file mode 100644 (file)
index a33042b..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-#    $Id$
-#
-#    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 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 General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import wizard
-import pooler
-
-
-def _get_default_journal_selection(self, cr, uid, context):
-    pool = pooler.get_pool(cr.dbname)
-    obj = pool.get('account.journal')
-    ids = obj.search(cr, uid, [('type', '=', 'cash')])
-    res = obj.read(cr, uid, ids, ['id', 'name'], context)
-    res = [(r['id'], r['name']) for r in res]
-    res.insert(0, ('', ''))
-    return res
-
-default_journal_form = '''<?xml version="1.0"?>
-<form string="Select default journals">
-    <field name="default_journal" />
-    <newline />
-    <field name="default_journal_rebate" />
-    <newline />
-    <field name="default_journal_gift" />
-    <newline />
-</form>'''
-
-default_journal_fields = {
-    'default_journal': {'string': 'Default journal', 'type': 'selection',
-        'selection': _get_default_journal_selection,
-    },
-    'default_journal_rebate': {'string': 'Default rebate journal', 'type': 'selection',
-        'selection': _get_default_journal_selection,
-    },
-    'default_journal_gift': {'string': 'Default gift journal', 'type': 'selection',
-        'selection': _get_default_journal_selection,
-    },
-}
-
-
-class wizard_default_journal(wizard.interface):
-
-    def _set_default_journal(self, cr, uid, data, context):
-
-        def _update_default_journal_config(journal_type, journal_code, journal_descr, journal_codes, data):
-            default_journal_id = data.get('form', {}).get(journal_type) or None
-            dico = dict(name=journal_descr, code=journal_code, journal_id=default_journal_id)
-            if default_journal_id:
-                if journal_code in journal_codes:
-                    ids = [obj.id for obj in objs if obj.code == journal_code]
-                    pos_config_journal.write(cr, uid, ids, dico, context)
-                else:
-                    pos_config_journal.create(cr, uid, dico, context)
-            else:
-                ids = [obj.id for obj in objs if obj.code == journal_code]
-                pos_config_journal.write(cr, uid, ids, dico, context)
-
-        pool = pooler.get_pool(cr.dbname)
-        pos_config_journal = pool.get('pos.config.journal')
-        ids = pos_config_journal.search(cr, uid, [])
-        objs = pos_config_journal.browse(cr, uid, ids)
-        journal_codes = [str(obj.code) for obj in objs]
-
-        _update_default_journal_config('default_journal', 'DEFAULT', 'Default journal', journal_codes, data)
-        _update_default_journal_config('default_journal_rebate', 'REBATE', 'Default rebate journal', journal_codes, data)
-        _update_default_journal_config('default_journal_gift', 'GIFT', 'Default gift journal', journal_codes, data)
-
-        return {}
-
-    def _get_defaults(self, cr, uid, data, context):
-        pool = pooler.get_pool(cr.dbname)
-        pos_config_journal = pool.get('pos.config.journal')
-        ids = pos_config_journal.search(cr, uid, [])
-        objs = pos_config_journal.browse(cr, uid, ids)
-        journal_codes = {}
-        for obj in objs:
-            journal_codes[obj.code] = int(obj.journal_id.id)
-
-        form = data['form']
-        form['default_journal'] = journal_codes.get('DEFAULT') or False
-        form['default_journal_rebate'] = journal_codes.get('REBATE') or False
-        form['default_journal_gift'] = journal_codes.get('GIFT') or False
-
-        return form
-
-    states = {
-        'init': {
-            'actions': [_get_defaults],
-            'result': {
-                'type': 'form',
-                'arch': default_journal_form,
-                'fields': default_journal_fields,
-                'state': [
-                    ('end', 'Cancel'),
-                    ('set_default_journal', 'Define default journals')
-                ]
-            }
-        },
-        'set_default_journal': {
-            'actions': [_set_default_journal],
-            'result': {
-                'type': 'state',
-                'state': "end",
-            }
-        },
-    }
-
-wizard_default_journal('pos.config.journal')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/wizard_scan_product.py b/addons/point_of_sale/wizard/wizard_scan_product.py
deleted file mode 100644 (file)
index 04b1e64..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
-#    Copyright (c) 2008 SylĂ«am Info Services. (http://www.syleam.fr) All Rights Reserved.
-#
-#    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 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 General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import pooler
-import wizard
-
-form_gencod = """<?xml version="1.0"?>
-<form string="Scan product">
-<label string="Scan Barcode" colspan="4"/>
-<field name="gencod" colspan="4" nolabel="1"/>
-</form>
-"""
-
-fields_gencod = {
-    'gencod': {'string': 'Barcode',
-               'type': 'char',
-               'size': 13,
-               'required': True}
-}
-
-
-def _scan(self, cr, uid, data, context):
-    pool = pooler.get_pool(cr.dbname)
-    result = pool.get('pos.order.line')._scan_product(cr, uid, data['form']['gencod'], 1, data['id'])
-    return {'gencod': False}
-
-
-def _pre_init(self, cr, uid, data, context):
-    return {'gencod': False}
-
-
-class pos_scan_product(wizard.interface):
-    states = {
-        'init': {'actions' : [_pre_init],
-            'result': {
-               'type': 'form',
-               'arch': form_gencod,
-               'fields': fields_gencod,
-               'state': [('end', 'Cancel','gtk-cancel'),
-                         ('add', 'Add', 'gtk-ok', True)],
-            }
-        },
-        'add': {'actions' : [_scan],
-                'result': {
-                    'type': 'state',
-                    'state': 'init',
-                }
-        }
-    }
-
-pos_scan_product('pos.scan_product')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: