[IMP] point_of_sale:convert wizard into osv_memory

bzr revid: sbh@tinyerp.com-20100319140047-ry2iubfps6aflcka
This commit is contained in:
MTR 2010-03-19 19:30:47 +05:30 committed by sbh (Open ERP)
parent a48453fe16
commit 60f17e19a1
12 changed files with 114 additions and 87 deletions

View File

@ -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',

View File

@ -69,7 +69,7 @@
-->
<button name="%(pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance"/>
<button name="%(o_rec)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<!--

View File

@ -9,11 +9,6 @@
string="Return Goods"/>
<wizard string="Receipt" model="pos.order"
name="ord.receipt" id="o_rec"
keyword="client_print_multi"
menu="False"
/>
<!-- <wizard string="Box Entries" model="account.bank.statement"
name="pos.entry" id="pos_entry" menu="False"/>-->

View File

@ -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)

View File

@ -71,7 +71,7 @@
<para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
<para style="terp_default_Centre_9">E-mail : [[ address and address.email ]]</para>
<para style="terp_default_Centre_9">Salesman : [[ o.user_id.name ]]</para>
<para style="terp_default_Centre_9">Sale Date : [[ o.date_order ]]</para>
<para style="terp_default_Centre_9">Sale Date : [[ str(o.date_order) ]]</para>
<para style="P5">Purchase Voucher : [[o.name]]</para>
<para style="P4">
<font color="white"> </font>

View File

@ -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"
/>
<report
@ -19,7 +19,7 @@
name="account.statement"
auto="False"
multi="True"
rml="statement/report/account_statement.rml"
rml="point_of_sale/report/account_statement.rml"
/>
<report
@ -30,7 +30,7 @@
auto="False"
multi="True"
menu = 'False'
rml="statement/report/all_closed_cashbox_of_the_day.rml"
rml="point_of_sale/report/all_closed_cashbox_of_the_day.rml"
/>
<report
id="pos_users_product_re"
@ -39,7 +39,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"
/>
<report
@ -49,7 +49,7 @@
name="account.statement"
auto="False"
multi="True"
rml="statement/report/account_statement.rml"
rml="point_of_sale/report/account_statement.rml"
/>
<report

View File

@ -425,7 +425,7 @@
id="menu_open_statement" sequence="1" />
<menuitem icon="STOCK_PRINT"
action="wizard_all_closed_cashbox_of_the_day"
action="action_report_all_closed_cashbox_of_the_day"
id="menu_all_closed_cashbox_of_the_day"
parent="menu_statement_tree_all"
type="wizard"/>
@ -435,5 +435,7 @@
string="Close Register"
action="action_pos_close_statement"
id="menu_close_statement" sequence="2" />
</data>
</openerp>

View File

@ -16,17 +16,10 @@
-->
<wizard
id="wizard_all_closed_cashbox_of_the_day"
model="account.bank.statement"
menu="False"
name="all.closed.cashbox.of.the.day"
string="All Cashboxes Of the day"/>
<menuitem icon="STOCK_PRINT"
action="wizard_all_closed_cashbox_of_the_day"
action="action_report_all_closed_cashbox_of_the_day"
id="menu_all_closed_cashbox_of_the_day"
parent="menu_point_report_register"
type="wizard"/>
parent="menu_point_report_register"/>
</data>
</openerp>

View File

@ -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:

View File

@ -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:

View File

@ -0,0 +1,64 @@
# -*- 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 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()

View File

@ -1,49 +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 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')