[IMP]:pos:OSV_MEMORY wizards related to reports
bzr revid: mso@mso-20100319135833-4d79a9d092bk2wpx
This commit is contained in:
parent
fa91b75d00
commit
a48453fe16
|
@ -50,8 +50,10 @@ Main features :
|
|||
'wizard/pos_get_sale.xml',
|
||||
'wizard/pos_open_statement.xml',
|
||||
'wizard/pos_close_statement.xml',
|
||||
'wizard/pos_box_entries.xml',
|
||||
'wizard/pos_box_out.xml',
|
||||
'wizard/pos_box_entries.xml',
|
||||
'wizard/pos_payment_report_user_view.xml',
|
||||
'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/pos_sales_user_current_user.xml',
|
||||
|
|
|
@ -985,6 +985,11 @@ invoiced
|
|||
id="menu_pos_sales_user" parent="menu_trans_pos_tree" sequence="3" groups="base.group_extended" />
|
||||
|
||||
|
||||
<menuitem icon="STOCK_PRINT" action="action_report_pos_payment_repport_date"
|
||||
id="menu_pos_payment_report_date" parent="menu_trans_pos_tree" sequence="5" groups="base.group_extended"/>
|
||||
|
||||
<menuitem icon="STOCK_PRINT" action="action_report_pos_payment_report_user"
|
||||
id="menu_pos_payment_report_user" parent="menu_trans_pos_tree_today" sequence="6" groups="base.group_extended"/>
|
||||
<menuitem icon="STOCK_PRINT" action="action_pos_sales_user_today"
|
||||
id="menu_pos_sales_user_today" parent="menu_trans_pos_tree_today" sequence="2" groups="base.group_extended"/>
|
||||
|
||||
|
@ -995,6 +1000,7 @@ invoiced
|
|||
id="menu_pos_payment_report_user" parent="menu_trans_pos_tree_today" type="wizard" sequence="6" groups="base.group_extended"/>
|
||||
<menuitem icon="STOCK_PRINT" action="action_report_pos_sales_user_today_current_user"
|
||||
id="menu_pos_sales_user_today_current_user" parent="menu_cashboxes_by_day" sequence="7"/>
|
||||
|
||||
|
||||
<menuitem icon="STOCK_PRINT" action="action_report_pos_details"
|
||||
id="menu_pos_details" parent="menu_cashboxes_by_day" />
|
||||
|
|
|
@ -40,15 +40,14 @@
|
|||
<wizard id="wizard_pos_sales_user" menu="False"
|
||||
model="pos.order" name="pos.sales.user" string="Sales Report"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_pos_sales_user_today" menu="False"
|
||||
model="pos.order" name="pos.sales.user.today" string="Sales by Users"/>-->
|
||||
|
||||
<!--
|
||||
<wizard id="wizard_pos_payment_report_date" menu="False"
|
||||
model="pos.order" name="pos.payment.report.date" string="Sales lines Report"/>
|
||||
|
||||
<wizard id="wizard_pos_payment_report_user" menu="False"
|
||||
model="pos.order" name="pos.payment.report.user" string="Sales lines by Users"/>
|
||||
|
||||
-->
|
||||
|
||||
<wizard id="wizard_pos_sales_user_today_current_user" menu="False"
|
||||
model="pos.order" name="pos.sales.user.today.current.user" string="Sales for Current User"/>
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class pos_payment_report_date(report_sxw.rml_parse):
|
|||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and po.state in ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id in %s " \
|
||||
,(dt1,dt2,tuple(form['user_id'][0][-1])))
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
data=self.cr.dictfetchall()
|
||||
return data
|
||||
|
||||
|
@ -55,7 +55,7 @@ class pos_payment_report_date(report_sxw.rml_parse):
|
|||
"from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
|
||||
"where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
|
||||
"and po.state in ('paid','invoiced') and po.date_order >= %s and po.date_order <= %s and po.user_id in %s " \
|
||||
,(dt1,dt2,tuple(form['user_id'][0][-1])))
|
||||
,(dt1,dt2,tuple(form['user_id'])))
|
||||
res=self.cr.fetchone()[0]
|
||||
return res
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class pos_payment_report_user(report_sxw.rml_parse):
|
|||
|
||||
def __pos_payment_user__(self,form):
|
||||
data={}
|
||||
ids = form['user_id'][0][-1]
|
||||
ids = form['user_id']
|
||||
idss = map(str, ids)
|
||||
sql = "select pt.name,pol.qty,pol.discount,pol.price_unit, " \
|
||||
"(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
|
||||
|
|
|
@ -27,9 +27,9 @@ import wizard_receipt
|
|||
import wizard_return
|
||||
import wizard_pos_payment_report
|
||||
|
||||
import wizard_pos_payment_report_date
|
||||
import wizard_pos_payment_report_user
|
||||
|
||||
import pos_payment_report_user
|
||||
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
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from osv import fields
|
||||
import time
|
||||
class pos_payment_report_date(osv.osv_memory):
|
||||
'''
|
||||
Open ERP Model
|
||||
'''
|
||||
_name = 'pos.payment.report.date'
|
||||
_description = 'POS Payment Report according to date'
|
||||
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 = self.read(cr, uid, ids, ['date_start','date_end','user_id'])
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
|
||||
return {
|
||||
'type' : 'ir.actions.report.xml',
|
||||
'report_name':'pos.payment.report.date',
|
||||
'datas' : datas,
|
||||
}
|
||||
|
||||
_columns = {
|
||||
'date_start': fields.date('Start Date', required=True),
|
||||
'date_end': fields.date('End Date', required=True),
|
||||
'user_id':fields.many2many('res.users','res_user_sale','user_id','sale_id','Salesman')
|
||||
}
|
||||
_defaults = {
|
||||
'date_start': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'date_end': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
pos_payment_report_date()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="pos_payment_report_date_form" model="ir.ui.view">
|
||||
<field name="name">pos.payment.report.date.form</field>
|
||||
<field name="model">pos.payment.report.date</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sale by Date and User">
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="user_id"/>
|
||||
<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>
|
||||
|
||||
<act_window name="Sales lines Report"
|
||||
res_model="pos.payment.report.date"
|
||||
src_model="pos.order"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_report_pos_payment_repport_date"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,56 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from osv import fields
|
||||
|
||||
class pos_payment_report_user(osv.osv_memory):
|
||||
'''
|
||||
Open ERP Model
|
||||
'''
|
||||
_name = 'pos.payment.report.user'
|
||||
_description = 'Sales lines by Users'
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
|
||||
"""
|
||||
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 = self.read(cr, uid, ids, ['user_id'])
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
|
||||
return {
|
||||
'type' : 'ir.actions.report.xml',
|
||||
'report_name':'pos.payment.report.user',
|
||||
'datas' : datas,
|
||||
}
|
||||
|
||||
_columns = {
|
||||
'user_id':fields.many2many('res.users','res_user_sale','user_id','sale_id','Salesman')
|
||||
}
|
||||
pos_payment_report_user()
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="pos_payment_report_user_form" model="ir.ui.view">
|
||||
<field name="name">pos.payment.report.user.form</field>
|
||||
<field name="model">pos.payment.report.user</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sale by User">
|
||||
<field name="user_id"/>
|
||||
<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>
|
||||
|
||||
<act_window name="Sales lines by Users"
|
||||
res_model="pos.payment.report.user"
|
||||
src_model="pos.order"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_report_pos_payment_report_user"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,64 +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 pooler
|
||||
import netsvc
|
||||
import wizard
|
||||
import time
|
||||
|
||||
pos_payment_report_date_form= """<?xml version="1.0"?>
|
||||
<form string="Sale by User">
|
||||
<field name="date_start" />
|
||||
<field name="date_end"/>
|
||||
<field name="user_id"/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
pos_payment_report_date_field= {
|
||||
|
||||
'date_start': {'string':'Start Date','type':'date','required': True,'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'date_end': {'string':'End Date','type':'date','required': True,'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
'user_id': {'string': 'Salesman', 'type': 'many2many', 'relation': 'res.users', 'required': True},
|
||||
}
|
||||
|
||||
|
||||
class wizard_pos_payment_report_date(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'form',
|
||||
'arch' : pos_payment_report_date_form,
|
||||
'fields' : pos_payment_report_date_field,
|
||||
'state' : [('end', 'Cancel','gtk-cancel'),('print_report', 'Print Report','gtk-print') ]}
|
||||
},
|
||||
'print_report' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'print',
|
||||
'report':'pos.payment.report.date',
|
||||
'state' : 'end'}
|
||||
},
|
||||
}
|
||||
|
||||
wizard_pos_payment_report_date('pos.payment.report.date')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
import time
|
||||
import ir
|
||||
from mx import DateTime
|
||||
import datetime
|
||||
import pooler
|
||||
from tools import config
|
||||
import wizard
|
||||
import netsvc
|
||||
|
||||
|
||||
pos_payment_report_user_form= """<?xml version="1.0"?>
|
||||
<form string="Sale by User">
|
||||
<field name="user_id" />
|
||||
|
||||
</form>
|
||||
"""
|
||||
|
||||
pos_payment_report_user_field= {
|
||||
|
||||
'user_id': {'string': 'Salesman', 'type': 'many2many', 'relation': 'res.users', 'required': True},
|
||||
|
||||
}
|
||||
|
||||
|
||||
class wizard_pos_payment_report_user(wizard.interface):
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'form',
|
||||
'arch' : pos_payment_report_user_form,
|
||||
'fields' : pos_payment_report_user_field,
|
||||
'state' : [('end', 'Cancel','gtk-cancel'),('print_report', 'Print Report','gtk-print') ]}
|
||||
},
|
||||
'print_report' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'print',
|
||||
'report':'pos.payment.report.user',
|
||||
'state' : 'end'}
|
||||
},
|
||||
}
|
||||
wizard_pos_payment_report_user('pos.payment.report.user')
|
|
@ -451,7 +451,7 @@ class product_product(osv.osv):
|
|||
'default_code' : fields.char('Code', size=64),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the product without removing it."),
|
||||
'variants': fields.char('Variants', size=64),
|
||||
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True),
|
||||
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=False),
|
||||
'ean13': fields.char('EAN13', size=13),
|
||||
'packaging' : fields.one2many('product.packaging', 'product_id', 'Logistical Units', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."),
|
||||
'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Sale Price')),
|
||||
|
|
Loading…
Reference in New Issue