From 60f17e19a117ee744d04cfdf1ee4cdfe0c8f24df Mon Sep 17 00:00:00 2001
From: MTR <>
Date: Fri, 19 Mar 2010 19:30:47 +0530
Subject: [PATCH] [IMP] point_of_sale:convert wizard into osv_memory
bzr revid: sbh@tinyerp.com-20100319140047-ry2iubfps6aflcka
---
addons/point_of_sale/__terp__.py | 5 +-
addons/point_of_sale/pos_view.xml | 2 +-
addons/point_of_sale/pos_wizard.xml | 5 --
.../report/all_closed_cashbox_of_the_day.py | 2 +-
.../pos_receipt_without_remboursment.rml | 2 +-
addons/point_of_sale/statement_report.xml | 10 +--
addons/point_of_sale/statement_view.xml | 4 +-
addons/point_of_sale/statement_wizard.xml | 13 +---
addons/point_of_sale/wizard/__init__.py | 6 +-
...ay.py => all_closed_cashbox_of_the_day.py} | 39 ++++++++---
addons/point_of_sale/wizard/pos_receipt.py | 64 +++++++++++++++++++
addons/point_of_sale/wizard/wizard_receipt.py | 49 --------------
12 files changed, 114 insertions(+), 87 deletions(-)
rename addons/point_of_sale/wizard/{wizard_all_closed_cashbox_of_the_day.py => all_closed_cashbox_of_the_day.py} (52%)
create mode 100644 addons/point_of_sale/wizard/pos_receipt.py
delete mode 100644 addons/point_of_sale/wizard/wizard_receipt.py
diff --git a/addons/point_of_sale/__terp__.py b/addons/point_of_sale/__terp__.py
index 245265b110e..d307024a008 100644
--- a/addons/point_of_sale/__terp__.py
+++ b/addons/point_of_sale/__terp__.py
@@ -55,9 +55,10 @@ Main features :
'wizard/pos_payment_report_date_view.xml',
'wizard/pos_box_out.xml',
'wizard/pos_sales_user.xml',
- #'wizard/all_closed_cashbox_of_the_day.xml',
+ 'wizard/all_closed_cashbox_of_the_day.xml',
'wizard/pos_sales_user_current_user.xml',
- 'wizard/pos_sale_user_today.xml',
+ 'wizard/pos_sale_user_today.xml',
+ 'wizard/pos_receipt_view.xml',
'pos_report.xml',
'pos_wizard.xml',
'pos_view.xml',
diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml
index 40be0e58e69..2d4be75ec44 100644
--- a/addons/point_of_sale/pos_view.xml
+++ b/addons/point_of_sale/pos_view.xml
@@ -69,7 +69,7 @@
-->
-
+
diff --git a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
index 854acfde3a9..2490d5719cd 100644
--- a/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
+++ b/addons/point_of_sale/report/all_closed_cashbox_of_the_day.py
@@ -138,4 +138,4 @@ class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
res = self.cr.dictfetchall()
return res[0]['net_total'] or 0.0
-report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/statement/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day)
+report_sxw.report_sxw('report.all.closed.cashbox.of.the.day', 'account.bank.statement', 'addons/point_of_sale/report/all_closed_cashbox_of_the_day.rml', parser=all_closed_cashbox_of_the_day)
diff --git a/addons/point_of_sale/report/pos_receipt_without_remboursment.rml b/addons/point_of_sale/report/pos_receipt_without_remboursment.rml
index d863efd40f3..0eb0dba773a 100644
--- a/addons/point_of_sale/report/pos_receipt_without_remboursment.rml
+++ b/addons/point_of_sale/report/pos_receipt_without_remboursment.rml
@@ -71,7 +71,7 @@
Tel : [[ address and address.phone ]]E-mail : [[ address and address.email ]]Salesman : [[ o.user_id.name ]]
- Sale Date : [[ o.date_order ]]
+ Sale Date : [[ str(o.date_order) ]]Purchase Voucher : [[o.name]]
diff --git a/addons/point_of_sale/statement_report.xml b/addons/point_of_sale/statement_report.xml
index 256d0644583..4a9d8600ff2 100644
--- a/addons/point_of_sale/statement_report.xml
+++ b/addons/point_of_sale/statement_report.xml
@@ -9,7 +9,7 @@
name="pos.user.product"
auto="False"
multi="True"
- rml="statement/report/pos_users_product.rml"
+ rml="point_of_sale/report/pos_users_product.rml"
/>
@@ -435,5 +435,7 @@
string="Close Register"
action="action_pos_close_statement"
id="menu_close_statement" sequence="2" />
+
+
diff --git a/addons/point_of_sale/statement_wizard.xml b/addons/point_of_sale/statement_wizard.xml
index d00668a5657..dd9715db628 100644
--- a/addons/point_of_sale/statement_wizard.xml
+++ b/addons/point_of_sale/statement_wizard.xml
@@ -16,17 +16,10 @@
-->
-
-
+
+ parent="menu_point_report_register"/>
diff --git a/addons/point_of_sale/wizard/__init__.py b/addons/point_of_sale/wizard/__init__.py
index f9f66536d08..fc3f4a4543e 100644
--- a/addons/point_of_sale/wizard/__init__.py
+++ b/addons/point_of_sale/wizard/__init__.py
@@ -23,7 +23,7 @@
import wizard_pos_payment
import wizard_default_journal
import wizard_scan_product
-import wizard_receipt
+
import wizard_return
import wizard_pos_payment_report
@@ -32,7 +32,7 @@ import pos_payment_report_date
import wizard_pos_sales_user_current_user
import wizard_pos_details
#import wizard_open_statement
-import wizard_all_closed_cashbox_of_the_day
+
import pos_add_product
import pos_confirm
import pos_discount
@@ -45,6 +45,8 @@ import pos_details
import pos_sales_user
import pos_sales_user_today
import pos_sales_user_current_user
+import all_closed_cashbox_of_the_day
+import pos_receipt
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/point_of_sale/wizard/wizard_all_closed_cashbox_of_the_day.py b/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
similarity index 52%
rename from addons/point_of_sale/wizard/wizard_all_closed_cashbox_of_the_day.py
rename to addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
index bdb7f72cb93..4e148f6cf45 100644
--- a/addons/point_of_sale/wizard/wizard_all_closed_cashbox_of_the_day.py
+++ b/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
@@ -20,21 +20,40 @@
#
##############################################################################
-import pooler
import netsvc
-import wizard
+from osv import osv,fields
+from tools.translate import _
+from mx import DateTime
import time
+class all_closed_cashbox_of_the_day(osv.osv_memory):
+ _name = 'all.closed.cashbox.of.the.day'
+ _description = 'All closed cashbox of the day'
-class wizard_all_closed_cashbox_of_the_day(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type':'print', 'report':'all.closed.cashbox.of.the.day', 'state':'end'}
- },
+ _columns = {
+
}
+
+ def print_report(self, cr, uid, ids, context=None):
-wizard_all_closed_cashbox_of_the_day('all.closed.cashbox.of.the.day')
+ """
+ @summary: To get the date and print the report
+ @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 report
+ """
+ datas = {'ids' : context.get('active_ids',[])}
+ res = {}
+ datas['form'] = res
+
+ return {
+ 'type' : 'ir.actions.report.xml',
+ 'report_name':'all.closed.cashbox.of.the.day',
+ 'datas' : datas,
+ }
+
+all_closed_cashbox_of_the_day()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/point_of_sale/wizard/pos_receipt.py b/addons/point_of_sale/wizard/pos_receipt.py
new file mode 100644
index 00000000000..e41deb14c32
--- /dev/null
+++ b/addons/point_of_sale/wizard/pos_receipt.py
@@ -0,0 +1,64 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). 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 .
+#
+##############################################################################
+import netsvc
+from osv import osv,fields
+from tools.translate import _
+from mx import DateTime
+import time
+
+class pos_receipt(osv.osv_memory):
+ _name = 'pos.receipt'
+ _description = 'Point of sale receipt'
+
+ _columns = {
+
+ }
+ def view_init(self, cr , uid , fields_list, context=None):
+ order_lst =self. pool.get('pos.order').browse(cr,uid,context['active_id'])
+ for order in order_lst:
+ if order.state_2 in ('to_verify'):
+ raise osv.except_osv(_('Error!', 'Can not print the receipt because of discount and/or payment '))
+ True
+ def print_report(self, cr, uid, ids, context=None):
+
+ """
+ @summary: To get the date and print the report
+ @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 report
+ """
+ datas = {'ids' : context.get('active_ids',[])}
+ res = {}
+ datas['form'] = res
+
+ return {
+ 'type' : 'ir.actions.report.xml',
+ 'report_name':'pos.receipt',
+ 'datas' : datas,
+ }
+
+pos_receipt()
+
+
+
diff --git a/addons/point_of_sale/wizard/wizard_receipt.py b/addons/point_of_sale/wizard/wizard_receipt.py
deleted file mode 100644
index 64e8a2e5685..00000000000
--- a/addons/point_of_sale/wizard/wizard_receipt.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (). 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 .
-#
-##############################################################################
-
-
-#import time
-#import netsvc
-#from tools.misc import UpdateableStr
-#import pooler
-import wizard
-import pooler
-from tools.translate import _
-
-def _check(self,cr,uid,data,*a):
- pool = pooler.get_pool(cr.dbname)
- order_lst = pool.get('pos.order').browse(cr,uid,data['ids'])
- for order in order_lst:
- if order.state_2 in ('to_verify'):
- raise wizard.except_wizard('Error!', 'Can not print the receipt because of discount and/or payment ')
- return data
-
-class print_order_receipt(wizard.interface):
- states = {
- 'init': {
- 'actions': [_check],
- 'result': {'type':'print', 'report':'pos.receipt', 'state':'end'}
- }
- }
-
-print_order_receipt('ord.receipt')
-