[ADD,IMP] point_of_sale : new point of sale report added, improvemetns in cashbox
bzr revid: vir@tinyerp.com-20100615125036-0u76xmmnk2m98aox
This commit is contained in:
parent
343005c511
commit
06dd77aa00
|
@ -66,6 +66,7 @@ Main features :
|
|||
'pos_report.xml',
|
||||
# 'pos_wizard.xml',
|
||||
'pos_view.xml',
|
||||
'report/report_pos_order_view.xml',
|
||||
'pos_sequence.xml',
|
||||
'posrule_data.xml',
|
||||
'pos_data.xml',
|
||||
|
|
|
@ -246,6 +246,9 @@ class account_bank_statement(osv.osv):
|
|||
self.write(cr, uid, statement.id, {'balance_end_real':Decimal(str(val_statement_line))+Decimal(str(val2)),'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
||||
# self.write(cr, uid, statement.id, {'balance_end_real':bal_st+val_statement_line,'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
|
||||
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context=None)
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'draft'}, context=context)
|
||||
|
||||
account_bank_statement()
|
||||
|
||||
|
|
|
@ -37,5 +37,6 @@ import pos_sales_user_today_current_user
|
|||
import pos_receipt_with_remboursment
|
||||
import pos_receipt_without_remboursment
|
||||
import point_of_sale_report
|
||||
import report_pos_order
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
# -*- 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 tools
|
||||
from osv import fields,osv
|
||||
|
||||
class report_pos_order(osv.osv):
|
||||
_name = "report.pos.order"
|
||||
_description = "Point of Sale Orders Statistics"
|
||||
_auto = False
|
||||
_columns ={
|
||||
'date': fields.date('Date Order', readonly=True),
|
||||
'date_validation': fields.date('Date Confirm', readonly=True),
|
||||
'date_payment': fields.date('Date Confirm', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'state': fields.selection([('draft', 'Draft'), ('payment', 'Payment'),
|
||||
('advance','Advance'),
|
||||
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced'), ('cancel', 'Cancel')],
|
||||
'State'),
|
||||
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
'price_total':fields.float('Total Price', readonly=True),
|
||||
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
'product_qty':fields.float('# of Qty', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal'),
|
||||
}
|
||||
_order = 'date desc'
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_pos_order')
|
||||
cr.execute("""
|
||||
create or replace view report_pos_order as (
|
||||
select el.*,
|
||||
|
||||
(select 1) as nbr,
|
||||
to_date(to_char(po.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
|
||||
po.date_validation as date_validation,
|
||||
po.date_payment as date_payment,
|
||||
to_char(po.date_order, 'YYYY') as year,
|
||||
to_char(po.date_order, 'MM') as month,
|
||||
to_char(po.date_order, 'YYYY-MM-DD') as day,
|
||||
po.partner_id as partner_id,
|
||||
po.state as state,
|
||||
po.user_id as user_id,
|
||||
po.shop_id as shop_id,
|
||||
po.company_id as company_id,
|
||||
po.sale_journal as journal_id
|
||||
|
||||
from
|
||||
pos_order as po,
|
||||
( select pl.id as id,
|
||||
pl.product_id as product_id,
|
||||
pl.qty as product_qty,
|
||||
sum(pl.qty * pl.price_unit)- sum(pl.qty * pl.price_ded) as price_total,
|
||||
pl.order_id
|
||||
from
|
||||
pos_order_line as pl
|
||||
left join product_template pt on (pt.id=pl.product_id)
|
||||
group by
|
||||
pl.id,pl.order_id, pl.qty,pl.product_id) el
|
||||
where po.id = el.order_id
|
||||
)
|
||||
""")
|
||||
|
||||
report_pos_order()
|
|
@ -0,0 +1,98 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_report_pos_order_tree" model="ir.ui.view">
|
||||
<field name="name">report.pos.order.tree</field>
|
||||
<field name="model">report.pos.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Point of Sale Analysis">
|
||||
<field name="date" />
|
||||
<field name="date_validation" invisible="1"/>
|
||||
<field name="date_payment" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="shop_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="product_qty" sum="# of Qty"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="state" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_report_pos_order_search" model="ir.ui.view">
|
||||
<field name="name">report.pos.order.search</field>
|
||||
<field name="model">report.pos.order</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Point of Sale Analysis">
|
||||
<group>
|
||||
<filter icon="terp-go-year" string=" 365 Days "
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created last 365 days"/>
|
||||
<filter icon="terp-go-month" string=" 30 Days "
|
||||
name="month"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created in last 30 days"/>
|
||||
<filter icon="terp-go-week"
|
||||
string=" 7 Days "
|
||||
separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="POS ordered created last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-dolar"
|
||||
string="Paid"
|
||||
domain="[('state','=',('paid'))]"/>
|
||||
<filter icon="terp-dolar"
|
||||
string="Invoiced"
|
||||
domain="[('state','=',('invoiced'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-dolar"
|
||||
string="My Sales"
|
||||
help="My Sales"
|
||||
domain="[('user_id','=',uid)]"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Salesman" icon="terp-personal" name="User" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Shop" icon="terp-go-home" context="{'group_by':'shop_id'}"/>
|
||||
<filter string="Company" icon="terp-go-home" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_report_pos_order_all" model="ir.actions.act_window">
|
||||
<field name="name">Point of Sale Analysis</field>
|
||||
<field name="res_model">report.pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_report_pos_order_search"/>
|
||||
<field name="context">{'search_default_month':1,'search_default_User':1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_report_pos_order_all" id="menu_report_pos_order_all" parent="menu_point_rep" sequence="1"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -24,7 +24,7 @@
|
|||
<field name="model">account.bank.statement</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end)" string="Statement">
|
||||
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end);black:state in ('open');blue:state in ('draft')" string="Statement">
|
||||
<field name="date"/>
|
||||
<field name="name"/>
|
||||
<field name="journal_id"/>
|
||||
|
@ -34,6 +34,9 @@
|
|||
<field name="balance_end"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/>
|
||||
<button type="object" string="Confirm" name="button_confirm" states="open" icon="terp-gtk-go-back-rtl"/>
|
||||
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -349,11 +352,43 @@
|
|||
|
||||
<menuitem action="action_bank_statement_treenew" id="menu_statement_tree2" parent="menu_statement_tree_all" sequence="1"/>
|
||||
|
||||
<record id="view_account_bank_statment_filter" model="ir.ui.view">
|
||||
<field name="name">account.bank.statment.select</field>
|
||||
<field name="model">account.bank.statement</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Cashbox">
|
||||
<group col='9' colspan='4'>
|
||||
<filter icon="terp-camera_test" string="Open"
|
||||
domain="[('state','=','open')]"
|
||||
help="All open cashboxes"/>
|
||||
<filter icon="terp-dialog-close" string="To Close"
|
||||
domain="[('state','=','draft')]"
|
||||
help="All cashboxes to close"/>
|
||||
<filter icon="terp-go-today" name="Today" string="Today"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
|
||||
help="All cashboxes to opened today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="4" col="20">
|
||||
<filter string="Journal" icon="terp-folder-blue" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_account_bank_statment">
|
||||
<field name="name">All Cashboxes</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.bank.statement</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="context">{'search_default_Today':1}</field>
|
||||
<field name="search_view_id" ref="view_account_bank_statment_filter"/>
|
||||
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="act_statement_a1">
|
||||
<field name="sequence" eval="1"/>
|
||||
|
@ -367,7 +402,7 @@
|
|||
<field name="view_id" ref="view_bank_statement_form3"/>
|
||||
<field name="act_window_id" ref="action_pos_account_bank_statment"/>
|
||||
</record>
|
||||
<menuitem name="All Cashboxes" parent="menu_point_report_register"
|
||||
<menuitem name="All Cashboxes" parent="menu_statement_tree_all"
|
||||
action="action_pos_account_bank_statment" id="menu_pos_bank_statment_tree" groups="base.group_extended" sequence="4"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_my_all_pos_account_bank_statment">
|
||||
|
@ -414,8 +449,8 @@
|
|||
<field name="act_window_id" ref="action_cashboxes_to_close"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Cashboxes to Close" parent="menu_pos_bank_statment_tree"
|
||||
action="action_cashboxes_to_close" id="menu_cashboxes_to_close_tree" groups="base.group_extended"/>
|
||||
<!-- <menuitem name="Cashboxes to Close" parent="menu_statement_tree_all"-->
|
||||
<!-- action="action_cashboxes_to_close" id="menu_cashboxes_to_close_tree" groups="base.group_extended"/>-->
|
||||
|
||||
|
||||
<menuitem
|
||||
|
|
Loading…
Reference in New Issue