[MERGE]: Merge with lp:openobject-addons

bzr revid: rpa@tinyerp.com-20100521111609-00rg9sr3l3wvz1az
This commit is contained in:
rpa (Open ERP) 2010-05-21 16:46:09 +05:30
commit 48da42cb8d
125 changed files with 2790 additions and 2493 deletions

View File

@ -107,8 +107,11 @@ module named account_voucherss
'company_view.xml',
'account_installer.xml',
'report/account_invoice_report_view.xml',
'report/account_entries_report_view.xml',
'report/account_report_view.xml',
'report/account_analytic_report_view.xml',
'report/account_account_report_view.xml',
'report/account_analytic_entries_report_view.xml'
],
'demo_xml': [
#'demo/price_accuracy00.yml',

View File

@ -22,6 +22,7 @@
groups="group_account_user"/>
<menuitem id="menu_account_end_year_treatments" name="End of Year Treatments" parent="account.menu_finance_periodical_processing" sequence="20"/>
<menuitem id="menu_finance_statastic_report_statement" name="Satistic Reports" parent="account.menu_finance_reporting" sequence="3"/>
</data>
</openerp>

View File

@ -37,6 +37,8 @@ import compare_account_balance
import account_invoice_report
import account_report
import account_analytic_report
import account_account_report
import account_entries_report
import account_analytic_entries_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,86 @@
# -*- 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 account_account_report(osv.osv):
_name = "account.account.report"
_description = "Account Report"
_auto = False
_columns = {
'name': fields.char('Name', size=128, readonly=True),
'code': fields.char('Code', size=64, readonly=True),
'type': fields.selection([
('receivable', 'Receivable'),
('payable', 'Payable'),
('view', 'View'),
('consolidation', 'Consolidation'),
('other', 'Others'),
('closed', 'Closed'),
], 'Internal Type', readonly=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'currency_mode': fields.selection([('current', 'At Date'), ('average', 'Average Rate')], 'Outgoing Currencies Rate',readonly=True),
'user_type': fields.many2one('account.account.type', 'Account Type',readonly=True),
'quantity': fields.float('Quantity', readonly=True),
'amount_total': fields.float('Total Amount', readonly=True),
'credit': fields.float('Credit', readonly=True),
'debit': fields.float('Debit', readonly=True),
'balance': fields.float('Balance', readonly=True),
'nbr': fields.integer('#Accounts', readonly=True),
'parent_account_id': fields.many2one('account.account', 'Parent Account', required=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_account_report')
cr.execute("""
create or replace view account_account_report as (
select
min(a.id) as id,
count(distinct a.id) as nbr,
a.name,
a.code,
a.type as type,
a.company_id as company_id,
a.currency_mode as currency_mode,
a.user_type as user_type,
a.parent_id as parent_account_id,
sum(ail.quantity) as quantity,
sum(ail.price_subtotal) as amount_total,
sum(m.credit) as credit,
sum(m.debit) as debit,
(sum(m.credit)-sum(m.debit)) as balance
from
account_account as a
left join account_move_line as m on m.account_id=a.id
left join account_invoice_line as ail on ail.account_id=a.id
left join account_invoice as ai on ai.account_id=a.id
group by
a.name,
a.code,
a.type,
a.company_id,
a.currency_mode,
a.user_type,
m.account_id,
a.parent_id
)
""")
account_account_report()

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_account_report_tree" model="ir.ui.view">
<field name="name">account.account.report.tree</field>
<field name="model">account.account.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Account Report">
<field name="name" invisible="1" string="Account"/>
<field name="code" invisible="1"/>
<field name="type" invisible="1"/>
<field name="company_id" invisible="1" group="base.multi_company"/>
<field name="currency_mode" invisible="1"/>
<field name="nbr" sum="#Accounts"/>
<field name="user_type" invisible="1"/>
<field name="parent_account_id" invisible="1"/>
<field name="quantity" sum="Quantity"/>
<field name="amount_total" sum="Total Amount"/>
<field name="credit" sum="Credit"/>
<field name="debit" sum="Debit"/>
<field name="balance" sum="Balance"/>
</tree>
</field>
</record>
<record id="view_account_account_report_graph" model="ir.ui.view">
<field name="name">account.account.report.graph</field>
<field name="model">account.account.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Accounts" type="bar">
<field name="name"/>
<field name="credit" operator="+"/>
<field name="debit" operator="+"/>
<field name="balance" operator="+"/>
</graph>
</field>
</record>
<record id="view_account_account_report_search" model="ir.ui.view">
<field name="name">account.account.report.search</field>
<field name="model">account.account.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Accounts">
<group>
<filter icon="terp-account"
string="At Date"
domain="[('currency_mode','=', 'current')]"/>
<filter icon="terp-account"
string="Average Rate"
domain="[('currency_mode','=','average')]"/>
<separator orientation="vertical"/>
<field name="name" string="Account"/>
<field name="code"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="type" />
<field name="user_type" widget="selection"/>
<field name="parent_account_id" />
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Account" name="Account" icon="terp-account" context="{'group_by':'name'}"/>
<filter string="Code" icon="terp-account" context="{'group_by':'code'}"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Currencies Rate" icon="terp-account" context="{'group_by':'currency_mode'}"/>
<filter string="Internal Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="Account Type" icon="terp-account" context="{'group_by':'user_type'}"/>
<filter string="Parent Account" icon="terp-account" context="{'group_by':'parent_account_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_account_account_report" model="ir.actions.act_window">
<field name="name">Accounts</field>
<field name="res_model">account.account.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_Account":1,"search_default_At Date":1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_account_account_report_search"/>
</record>
<menuitem action="action_account_account_report" id="menu_action_account_account_report" parent="account.menu_finance_statastic_report_statement" sequence="6"/>
</data>
</openerp>

View File

@ -0,0 +1,83 @@
# -*- 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 analytic_entries_report(osv.osv):
_name = "analytic.entries.report"
_description = "Analytic Entries Statistics"
_auto = False
_columns = {
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, 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),
'user_id' : fields.many2one('res.users', 'User',readonly=True),
'name': fields.char('Description', size=64, readonly=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'currency_id': fields.many2one('res.currency', 'Currency', required=True),
'account_id': fields.many2one('account.analytic.account', 'Account', required=True),
'general_account_id': fields.many2one('account.account', 'General Account', required=True),
'journal_id': fields.many2one('account.analytic.journal', 'Journal', required=True),
'move_id': fields.many2one('account.move.line', 'Move', required=True),
'product_id': fields.many2one('product.product', 'Product', required=True),
'product_uom_id': fields.many2one('product.uom', 'Product UOM', required=True),
'amount': fields.float('Amount', readonly=True),
'unit_amount': fields.float('Unit Amount', readonly=True),
'amount_currency': fields.float('Amount Currency', readonly=True),
'nbr': fields.integer('#Entries', readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'analytic_entries_report')
cr.execute("""
create or replace view analytic_entries_report as (
select
min(a.id) as id,
count(distinct a.id) as nbr,
a.create_date as date,
to_char(a.create_date, 'YYYY') as year,
to_char(a.create_date, 'MM') as month,
to_char(a.create_date, 'YYYY-MM-DD') as day,
a.user_id as user_id,
a.name as name,
a.company_id as company_id,
a.currency_id as currency_id,
a.account_id as account_id,
a.general_account_id as general_account_id,
a.journal_id as journal_id,
a.move_id as move_id,
a.product_id as product_id,
a.product_uom_id as product_uom_id,
sum(a.amount) as amount,
sum(a.unit_amount) as unit_amount,
sum(a.amount_currency) as amount_currency
from
account_analytic_line a
group by
a.create_date, a.user_id,a.name,company_id,a.currency_id,
a.account_id,a.general_account_id,a.journal_id,
a.move_id,a.product_id,a.product_uom_id
)
""")
analytic_entries_report()

View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_analytic_entries_report_tree" model="ir.ui.view">
<field name="name">analytic.entries.report.tree</field>
<field name="model">analytic.entries.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Analytic Entries Statistics">
<field name="date" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="name" invisible="1"/>
<field name="company_id" invisible="1" groups="base.multi_company"/>
<field name="currency_id" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="general_account_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_uom_id" invisible="1"/>
<field name="nbr" sum="Entries"/>
<field name="amount" sum="Amount"/>
<field name="unit_amount" sum="Unit Amount"/>
<field name="amount_currency" sum="Amount Currency"/>
</tree>
</field>
</record>
<record id="view_analytic_entries_report_search" model="ir.ui.view">
<field name="name">analytic.entries.report.search</field>
<field name="model">analytic.entries.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Analytic Entries">
<group col="10" colspan="12">
<filter icon="terp-account" string="Last 365 DAys"
domain="[('day','&lt;=', time.strftime('%%Y-%%m-%%d')),('day','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Analytic Entries of the year"/>
<filter icon="terp-account" string="Last 30 Days"
name="month"
domain="[('day','&lt;=', time.strftime('%%Y-%%m-%%d')), ('day','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Analytic Entries of this month"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('day','&lt;=', time.strftime('%%Y-%%m-%%d')), ('day','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Analytic Entries during last 7 days"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner" domain="[('user_id','=',uid)]" help="My Case"/>
</field>
<field name="currency_id"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="account_id" />
<field name="general_account_id" widget="selection"/>
<field name="journal_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="product_id" />
<field name="product_uom_id" widget="selection"/>
<field name="company_id" widget="selection" groups="base.multi_company"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.multi_company"/>
<separator orientation="vertical"/>
<filter string="Account" icon="terp-account" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-account" context="{'group_by':'general_account_id'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Product UOM" icon="terp-account" context="{'group_by':'product_uom_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="view_account_analytic_entries_search" model="ir.ui.view">
<field name="name">account.analytic.entries.graph</field>
<field name="model">analytic.entries.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Analytic Entries" type="bar">
<field name="user_id"/>
<field name="amount" operator="+"/>
<field name="unit_amount" operator="+"/>
<field name="amount_currency" operator="+"/>
</graph>
</field>
</record>
<record id="action_analytic_entries_report" model="ir.actions.act_window">
<field name="name">Analytic Entries</field>
<field name="res_model">analytic.entries.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_analytic_entries_report_search"/>
</record>
<menuitem action="action_analytic_entries_report" id="menu_action_analytic_entries_report" parent="account.menu_finance_statastic_report_statement" sequence="4"/>
</data>
</openerp>

View File

@ -35,7 +35,7 @@ class analytic_report(osv.osv):
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', readonly=True),
'user_id' : fields.many2one('res.users', 'Account Manager',readonly=True),
'product_id' : fields.many2one('product.product', 'Product',readonly=True),
'quantity': fields.float('Quantity',readonly=True),
'total_quantity': fields.float('# Total Quantity',readonly=True),
'debit' : fields.float('Debit',readonly=True),
'credit' : fields.float('Credit',readonly=True),
'balance' : fields.float('Balance',readonly=True),
@ -43,6 +43,11 @@ class analytic_report(osv.osv):
'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),
'nbr':fields.integer('# of Lines', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'type': fields.selection([('view','View'), ('normal','Normal')], 'Account Type'),
'state': fields.selection([('draft','Draft'),
('open','Open'),
('pending','Pending'),
@ -50,6 +55,7 @@ class analytic_report(osv.osv):
('close','Close'),
('template', 'Template')],
'State', readonly=True),
}
_order = 'date_start desc'
def init(self, cr):
@ -60,15 +66,18 @@ class analytic_report(osv.osv):
min(s.id) as id,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
l.journal_id,
l.product_id,
s.parent_id,
s.date_start,
s.date as date_end,
s.user_id,
s.company_id,
s.type,
s.name,
s.partner_id,
s.quantity,
sum(s.quantity) as total_quantity,
s.debit,
s.credit,
s.balance,
@ -77,7 +86,8 @@ class analytic_report(osv.osv):
from account_analytic_account s
left join account_analytic_line l on (s.id=l.account_id)
GROUP BY s.create_date,s.state,l.journal_id,s.name,
s.partner_id,s.date_start,s.date,s.user_id,s.quantity,
s.partner_id,s.date_start,s.date,s.user_id,
s.company_id,s.type,
s.debit,s.credit,s.balance,s.parent_id,l.product_id
)
""")

View File

@ -9,23 +9,26 @@
<tree string="Analytic Accounts Statistics">
<field name="parent_id" invisible="1" string="Analytic Account"/>
<field name="product_id" invisible="1"/>
<field name="name"/>
<field name="partner_id"/>
<field name="journal_id" string="Analytic Journal"/>
<field name="user_id"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="quantity"/>
<field name="name" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="journal_id" string="Analytic Journal" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="date_start" invisible="1"/>
<field name="date_end" invisible="1"/>
<field name="total_quantity" sum=" # Total Quantity"/>
<field name="nbr" sum ="# of Lines"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="type" invisible="1"/>
<field name="debit"/>
<field name="credit"/>
<field name="balance"/>
<field name="state"/>
<field name="state" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="year" invisible="1"/>
</tree>
</field>
</record>
<record id="view_analytic_report_search" model="ir.ui.view">
<field name="name">analytic.report.search</field>
<field name="model">analytic.report</field>
@ -38,18 +41,15 @@
domain="[('year','=',time.strftime('%%Y'))]"/>
<filter icon="terp-account"
string="This Month"
name="This Month"
domain="[('month','=',time.strftime('%%m'))]"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('day','&lt;=', time.strftime('%%Y-%%m-%%d')), ('day','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Entries during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Start" icon="terp-account" domain="[('date_start','=',time.strftime('%%Y/%%m/%%d'))]"/>
<filter string="End" icon="terp-account" domain="[('date_end','=',time.strftime('%%Y/%%m/%%d'))]"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="user_id" widget="selection"/>
<field name="partner_id"/>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<filter icon="terp-account"
<filter icon="terp-account"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-account"
@ -58,6 +58,18 @@
<filter icon="terp-account"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="user_id" widget="selection">
<filter icon="terp-account"
string="My Accounts"
help="My Account"
domain="[('user_id','=',uid)]"/>
</field>
<field name="partner_id"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-account"
string="Close"
domain="[('state','=','close')]"/>
@ -65,40 +77,59 @@
string="Template"
domain="[('state','=','template')]"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="parent_id"/>
<field name="journal_id"/>
<field name="product_id"/>
<field name="journal_id" widget="selection"/>
<newline/>
<field name="product_id" />
<field name="type"/>
<separator orientation="vertical"/>
<field name="date_start"/>
<field name="date_end"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="User" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="User" name="User" icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Associated Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Analytic Account" icon="terp-account" context="{'group_by':'parent_id'}"/>
<filter string="Analytic Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Analytic Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Analytic Account" icon="terp-account" context="{'group_by':'parent_id'}"/>
<filter string="Account Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="view_account_analytic_report_search" model="ir.ui.view">
<field name="name">account.analytic.report.graph</field>
<field name="model">analytic.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Analytic Accounts" type="bar">
<field name="user_id"/>
<field name="credit" operator="+"/>
<field name="debit" operator="+"/>
<field name="balance" operator="+"/>
<field name="nbr" operator="+"/>
</graph>
</field>
</record>
<record id="action_analytic_report_all" model="ir.actions.act_window">
<field name="name">Analytic Accounts</field>
<field name="res_model">analytic.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="context">{'search_default_User':1,'search_default_user_id':uid}</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_This Month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_analytic_report_search"/>
</record>
<menuitem action="action_analytic_report_all" id="menu_action_analytic_report_all" parent="account.menu_finance_reporting" sequence="0"/>
<menuitem action="action_analytic_report_all" id="menu_action_analytic_report_all" parent="account.menu_finance_statastic_report_statement" sequence="8"/>
</data>
</openerp>

View File

@ -0,0 +1,123 @@
# -*- 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 account_entries_report(osv.osv):
_name = "account.entries.report"
_description = "Entries"
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.date('Effective Date', readonly=True),
'date_created': fields.date('Date Created', readonly=True),
'date_maturity': fields.date('Date Maturity', readonly=True),
'nbr':fields.integer('# of Entries', readonly=True),
'nbl':fields.integer('# of Lines', readonly=True),
'amount': fields.float('Amount',readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=128, 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),
'ref': fields.char('Reference', size=64,readonly=True),
'period_id': fields.many2one('account.period', 'Period', readonly=True),
'account_id': fields.many2one('account.account', 'Account', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State',readonly=True,
help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'),
'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True,
help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'),
'partner_id': fields.many2one('res.partner','Partner', readonly=True),
'period_id2': fields.many2one('account.period', 'Move Line Period', readonly=True),
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
'journal_id2': fields.many2one('account.journal', 'Move Line Journal', readonly=True),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Type',readonly=True),
'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
}
_order = 'date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')
cr.execute("""
create or replace view account_entries_report as (
select
min(l.id) as id,
am.ref as ref,
sum(l.quantity) as quantity,
am.state as state,
l.state as state_2,
am.date as date,
count(l.id) as nbr,
count(distinct am.id) as nbl,
l.debit as amount,
to_char(am.date, 'YYYY') as year,
to_char(am.date, 'MM') as month,
to_char(am.date, 'YYYY-MM-DD') as day,
am.company_id as company_id,
l.account_id as account_id,
l.analytic_account_id as analytic_account_id,
l.date_created as date_created,
l.date_maturity as date_maturity,
am.journal_id as journal_id,
l.journal_id as journal_id2,
l.period_id as period_id2,
am.period_id as period_id,
l.partner_id as partner_id,
l.product_id as product_id,
am.type as type
from
account_move_line l
left join
account_move am on (am.id=l.move_id)
group by am.ref,
am.state,
am.date,
am.company_id,
am.journal_id,
l.journal_id,
am.period_id,
l.period_id,
am.type,
l.partner_id,
l.analytic_account_id,
l.product_id,
l.date_created,
l.date_maturity,
l.account_id,
l.state,
l.debit
)
""")
account_entries_report()

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_account_entries_report_tree" model="ir.ui.view">
<field name="name">account.entries.report.tree</field>
<field name="model">account.entries.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoices Statistics">
<field name="date" invisible="1"/>
<field name="date_created" invisible="1"/>
<field name="date_maturity" invisible="1"/>
<field name="ref" invisible="1"/>
<field name="state" invisible="1"/>
<field name="state_2" 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="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="journal_id" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="analytic_account_id" invisible="1"/>
<field name="period_id" invisible="1"/>
<field name="period_id2" invisible="1"/>
<field name="type" invisible="1"/>
<field name="nbr" sum="# of Entries "/>
<field name="nbl" sum="# of Lines "/>
<field name="amount" sum="# of Amount "/>
<field name="quantity" sum="# of Products Qty "/>
</tree>
</field>
</record>
<record id="view_account_entries_report_graph" model="ir.ui.view">
<field name="name">account.entries.report.graph</field>
<field name="model">account.entries.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Entries" type="bar">
<field name="partner_id"/>
<field name="amount"/>
</graph>
</field>
</record>
<record id="view_account_entries_report_search" model="ir.ui.view">
<field name="name">account.entries.report.search</field>
<field name="model">account.entries.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Entries">
<group colspan="10" col="12">
<filter icon="terp-account" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Entries of the year"/>
<filter icon="terp-account" string="This Month"
name="This Month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Entries of this month"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Entries during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-account"
domain="[('state','=','draft')]"
help = "Draft tasks"/>
<separator orientation="vertical"/>
<field name="journal_id" widget="selection"/>
<field name="account_id"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="partner_id" />
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter string="Posted"
icon="terp-account"
domain="[('state','=','posted')]"
help = "Posted tasks"/>
<field name="state_2"/>
<separator orientation="vertical"/>
<field name="period_id" widget="selection"/>
<field name="period_id2" widget="selection"/>
<field name="type"/>
<field name="product_id" />
<field name="analytic_account_id"/>
<newline/>
<separator orientation="vertical"/>
<field name="date_created"/>
<field name="date"/>
<field name="date_maturity"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Journal" name="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Account" name="Account" icon="terp-account" context="{'group_by':'account_id'}"/>
<filter string="Analytic Account" name="Analytic Account" icon="terp-account" context="{'group_by':'analytic_account_id'}"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<filter string="State of Move Line" icon="terp-account" context="{'group_by':'state_2'}"/>
<filter string="Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<filter string="Period of Move Line" icon="terp-account" context="{'group_by':'period_id2'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
<record id="action_account_entries_report_all" model="ir.actions.act_window">
<field name="name">Entries</field>
<field name="res_model">account.entries.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_This Month':1,'search_default_Journal':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_account_entries_report_search"/>
</record>
<menuitem action="action_account_entries_report_all" id="menu_action_account_entries_report_all" parent="account.menu_finance_statastic_report_statement" sequence="2"/>
</data>
</openerp>

View File

@ -61,6 +61,13 @@ class account_invoice_report(osv.osv):
('paid','Done'),
('cancel','Cancelled')
], 'Order State', readonly=True),
'date_due': fields.date('Due Date', readonly=True),
'address_contact_id': fields.many2one('res.partner.address', 'Contact Address Name', readonly=True),
'address_invoice_id': fields.many2one('res.partner.address', 'Invoice Address Name', readonly=True),
'account_id': fields.many2one('account.account', 'Account',readonly=True),
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',readonly=True),
'residual':fields.float('Total Residual', readonly=True),
'delay_to_pay':fields.float('Avg. Delay To Pay', readonly=True, group_operator="avg"),
}
_order = 'date desc'
def init(self, cr):
@ -87,12 +94,24 @@ class account_invoice_report(osv.osv):
(sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
s.type as type,
s.state
from
s.state,
s.date_due as date_due,
s.address_contact_id as address_contact_id,
s.address_invoice_id as address_invoice_id,
s.account_id as account_id,
s.partner_bank as partner_bank,
s.residual as residual,
case when s.state != 'paid' then null else
extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
end as delay_to_pay
from
account_invoice_line l
left join
account_invoice s on (s.id=l.invoice_id)
left join product_uom u on (u.id=l.uos_id)
left join product_uom u on (u.id=l.uos_id),
account_move_line am left join account_invoice i on (i.move_id=am.move_id)
where
am.account_id=i.account_id
group by
s.type,
s.date_invoice,
@ -101,12 +120,18 @@ class account_invoice_report(osv.osv):
l.uos_id,
s.user_id,
s.state,
s.residual,
s.company_id,
s.payment_term,
s.period_id,
s.fiscal_position,
s.currency_id,
s.journal_id
s.journal_id,
s.date_due,
s.address_contact_id,
s.address_invoice_id,
s.account_id,
s.partner_bank
)
""")
account_invoice_report()

View File

@ -27,6 +27,13 @@
<field name="fiscal_position" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="date_due" invisible="1"/>
<field name="address_contact_id" invisible="1"/>
<field name="address_invoice_id" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="partner_bank" invisible="1"/>
<field name="residual" sum="Total Residual"/>
<field name="delay_to_pay" avg="Avg. Delay To Pay"/>
</tree>
</field>
</record>
@ -49,7 +56,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Invoices">
<group>
<group col="10" colspan="12">
<filter icon="terp-account" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Invoices of the year"/>
@ -76,7 +83,6 @@
domain="[('state', '=' ,'open')]"
help = "In progress tasks"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-account"
@ -84,6 +90,7 @@
help="Invoices Non Users"
domain="[('user_id','=',False)]"/>
</field>
<field name="product_id"/>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
@ -98,34 +105,50 @@
domain="[('state', '=' ,'cancel')]"
help = "Cancelled tasks"/>
<separator orientation="vertical"/>
<field name="type"/>
<field name="payment_term" widget="selection"/>
<separator orientation="vertical"/>
<field name="currency_id" widget="selection"/>
<field name="journal_id" widget="selection"/>
<newline/>
<field name="type"/>
<field name="address_contact_id"/>
<field name="address_invoice_id"/>
<separator orientation="vertical"/>
<field name="account_id"/>
<field name="partner_bank" widget="selection"/>
<separator orientation="vertical"/>
<field name="period_id" widget="selection"/>
<field name="fiscal_position" widget="selection"/>
<field name="date"/>
<newline/>
<field name="date" string="Date Invoiced"/>
<separator orientation="vertical"/>
<field name="date_due"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Salesman" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="Payment Term" icon="terp-account" context="{'group_by':'payment_term'}"/>
<separator orientation="vertical"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<filter string="Account" icon="terp-account" context="{'group_by':'account_id'}"/>
<filter string="Bank Account" icon="terp-account" context="{'group_by':'partner_bank'}"/>
<newline/>
<filter string="Contact Address Name" icon="terp-account" context="{'group_by':'address_contact_id'}"/>
<filter string="Invoice Address Name" icon="terp-account" context="{'group_by':'address_invoice_id'}"/>
<separator orientation="vertical"/>
<filter string="Force Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<filter string="Fiscal Position" icon="terp-account" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search>
@ -141,7 +164,7 @@
<field name="search_view_id" ref="view_account_invoice_report_search"/>
</record>
<menuitem action="action_account_invoice_report_all" id="menu_action_account_invoice_report_all" parent="account.menu_finance_reporting" sequence="0"/>
<menuitem action="action_account_invoice_report_all" id="menu_action_account_invoice_report_all" parent="account.menu_finance_statastic_report_statement" sequence="0"/>
</data>
</openerp>

View File

@ -47,7 +47,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
</record>
<menuitem action="action_account_receivable_graph" id="menu_account_receivable_graph" parent="account.menu_finance_reporting"/>
<!-- <menuitem action="action_account_receivable_graph" id="menu_account_receivable_graph" parent="account.menu_finance_reporting"/> -->
<!-- Report for Aged Receivable -->
@ -116,7 +116,7 @@
</record>
<!-- <menuitem id="menu_report_this_month" name="This Month" parent="account.menu_finance_reporting"/>-->
<menuitem id="menu_report_all_months" name="Sales by Account" parent="account.menu_finance_reporting"/>
<!-- <menuitem id="menu_report_all_months" name="Sales by Account" parent="account.menu_finance_reporting"/> -->
<!-- Report of the sales by product and account -->
<record id="view_report_account_sales_tree" model="ir.ui.view">
<field name="name">report.account.sales.tree</field>
@ -169,7 +169,7 @@
<field name="view_mode">graph,tree</field>
<field name="search_view_id" ref="view_report_account_sales_search"/>
</record>
<menuitem action="action_report_account_sales_tree_all" id="menu_report_account_sales_all" parent="menu_report_all_months"/>
<!-- <menuitem action="action_report_account_sales_tree_all" id="menu_report_account_sales_all" parent="menu_report_all_months"/> -->
<!-- Report of the sales by product and account type -->
<record id="view_report_account_type_sales_tree" model="ir.ui.view">
@ -237,7 +237,7 @@
<field name="view_mode">graph,tree</field>
<field name="search_view_id" ref="view_report_account_type_sales_search"/>
</record>
<menuitem action="action_report_account_type_sales_tree_all" id="menu_report_account_type_sales_all" parent="menu_report_all_months"/>
<!-- <menuitem action="action_report_account_type_sales_tree_all" id="menu_report_account_type_sales_all" parent="menu_report_all_months"/> -->
</data>
</openerp>

View File

@ -36,7 +36,7 @@ class audittrail_rule(osv.osv):
"name": fields.char("Rule Name", size=32, required=True),
"object_id": fields.many2one('ir.model', 'Object', required=True),
"user_id": fields.many2many('res.users', 'audittail_rules_users',
'user_id', 'rule_id', 'Users', help="if User is not added then it will applicable for all users"),
'user_id', 'rule_id', 'Users'),
"log_read": fields.boolean("Log reads"),
"log_write": fields.boolean("Log writes"),
"log_unlink": fields.boolean("Log deletes"),

View File

@ -16,9 +16,8 @@
<field name="log_write" />
<field name="log_unlink" />
<field name="log_create" />
<separator string="Users (if User is not added then it will applicable for all users)" colspan="4" />
<field name="user_id" select="1" colspan="4" nolabel="1" />
<field name="action_id" colspan="4" readonly="1" groups="base.group_extended"/>
<field name="action_id" colspan="4" readonly="1"/>
<field name="user_id" select="1" colspan="4"/>
<field name="state" select="1" readonly="1" />
<group colspan="2" col="2">
<button string="Subscribe" name="subscribe"
@ -38,49 +37,16 @@
<tree string="AuditTrail Rules">
<field name="name" />
<field name="object_id"/>
<field name="user_id"/>
<field name="user_id" />
<field name="log_read" />
<field name="log_write" />
<field name="log_unlink" />
<field name="log_create" />
<field name="state" />
<button string="Subscribe" name="subscribe"
type="object" states="draft" icon="gtk-go-forward"/>
</tree>
</field>
</record>
<!-- Audittrail rule Search View -->
<record id="view_audittrail_rule_filter" model="ir.ui.view">
<field name="name">Audittrail-rule Search</field>
<field name="model">audittrail.rule</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search rule">
<group>
<filter icon="terp-project"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-project"
name="subscribed"
string="Subscribed"
domain="[('state','=','subscribed')]"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="object_id" widget="selection"/>
<field name="user_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/>
<filter string="Object" icon="terp-crm" domain="[]" context="{'group_by':'object_id'}"/>
</group>
<newline/>
</search>
</field>
</record>
<!-- Action for audittrail rule -->
<record model="ir.actions.act_window" id="action_audittrail_rule_tree">
@ -89,7 +55,7 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_audittrail_rule_filter"/>
<!--<field name="view_id" ref="view_audittrail_rule_form" />-->
</record>
<menuitem name="Audittrails" id="menu_action_audittrail"
@ -123,16 +89,14 @@
<field name="res_id" readonly="1"/>
<field name="name" readonly="1" select="1"/>
<field name="line_ids" colspan="4" mode="tree,form"
widget="one2many_list" readonly="1" nolabel="1">
widget="one2many_list" readonly="1">
<form string="Log Lines">
<group colspan="4" col="2">
<field name="field_id"
readonly="1" colspan="4"/>
<field name="field_id" colspan="4"
readonly="1" />
<newline />
<field name="field_description"
readonly="1" colspan="4"/>
<field name="field_description" colspan="4"
readonly="1" />
<newline />
</group>
<separator string="Old Value : "
colspan="2" />
<separator string="New Value : "
@ -178,31 +142,6 @@
</tree>
</field>
</record>
<record id="view_audittrail_log_filter" model="ir.ui.view">
<field name="name">Audittrail-log Search</field>
<field name="model">audittrail.log</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search log">
<group>
<field name="timestamp" />
<field name="name" />
<field name="object_id" widget="selection"/>
<field name="method" />
<field name="user_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="Log Date" icon="terp-crm" domain="[]" context="{'group_by':'timestamp'}"/>
<filter string="Log Method" icon="terp-crm" domain="[]" context="{'group_by':'method'}"/>
<filter string="Object" icon="terp-crm" domain="[]" context="{'group_by':'object_id'}"/>
<filter string="User" icon="terp-partner" name="user" domain="[]" context="{'group_by':'user_id'}"/>
</group>
<newline/>
</search>
</field>
</record>
<!-- Action for Audittrail Log -->
@ -210,12 +149,13 @@
<field name="name">Logs</field>
<field name="res_model">audittrail.log</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_audittrail_log_filter"/>
</record>
<menuitem name="Logs" id="menu_action_audittrail_log_tree"
action="action_audittrail_log_tree" parent="menu_action_audittrail" />
<!-- <wizard string="View log" menu="False" model="audittrail.log" name="audittrail.view.log" id="wizard_audittrail_log"/>-->
<menuitem name="View Logs" id="menu_action_log_tree2"
action="action_audittrail_view_log" parent="menu_action_audittrail" />
</data>
</openerp>

View File

@ -96,7 +96,7 @@ def real_id2base_calendar_id(real_id, recurrent_date):
return '%d-%s' % (real_id, recurrent_date)
return real_id
def _links_get(self, cr, uid, context={}):
def _links_get(self, cr, uid, context=None):
"""
Get request link.
@param cr: the current row, from the database cursor,
@ -212,7 +212,9 @@ class calendar_attendee(osv.osv):
def _get_address(self, name=None, email=None):
"""
Get Email Address
Gives email information in ical CAL-ADDRESS type format
@param name: Name for CAL-ADDRESS value
@param email: Email address for CAL-ADDRESS value
"""
if name and email:
name += ':'
@ -220,7 +222,7 @@ class calendar_attendee(osv.osv):
def _compute_data(self, cr, uid, ids, name, arg, context):
"""
Compute data on field.
Compute data on function fields for attendee values .
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs.
@ -240,6 +242,7 @@ class calendar_attendee(osv.osv):
else:
result[id][name] = self._get_address(attdata.sent_by_uid.name, \
attdata.sent_by_uid.address_id.email)
if name == 'cn':
if attdata.user_id:
result[id][name] = attdata.user_id.name
@ -247,40 +250,47 @@ class calendar_attendee(osv.osv):
result[id][name] = attdata.partner_address_id.name or attdata.partner_id.name
else:
result[id][name] = attdata.email or ''
if name == 'delegated_to':
todata = []
for child in attdata.child_ids:
if child.email:
todata.append('MAILTO:' + child.email)
result[id][name] = ', '.join(todata)
if name == 'delegated_from':
fromdata = []
for parent in attdata.parent_ids:
if parent.email:
fromdata.append('MAILTO:' + parent.email)
result[id][name] = ', '.join(fromdata)
if name == 'event_date':
if attdata.ref:
result[id][name] = attdata.ref.date
else:
result[id][name] = False
if name == 'event_end_date':
if attdata.ref:
result[id][name] = attdata.ref.date_deadline
else:
result[id][name] = False
if name == 'sent_by_uid':
if attdata.ref:
result[id][name] = (attdata.ref.user_id.id, attdata.ref.user_id.name)
else:
result[id][name] = uid
if name == 'language':
user_obj = self.pool.get('res.users')
lang = user_obj.read(cr, uid, uid, ['context_lang'], context=context)['context_lang']
result[id][name] = lang.replace('_', '-')
return result
def _links_get(self, cr, uid, context={}):
def _links_get(self, cr, uid, context=None):
"""
Get request link for ref field in calendar attendee.
@param cr: the current row, from the database cursor,
@ -296,7 +306,7 @@ class calendar_attendee(osv.osv):
def _lang_get(self, cr, uid, context={}):
"""
Get language for language function field.
Get language for language selection field.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
@ -433,16 +443,19 @@ property or property parameter."),
attendee_add.value = 'MAILTO:' + attendee.email
res = cal.serialize()
return res
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}):
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
"""
Send mail for calendar attendee.
Send mail for event invitation to event attendees.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs.
@param ids: List of attendees IDs.
@param email_from: Email address for user sending the mail
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
context = {}
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name
for att in self.browse(cr, uid, ids, context=context):
@ -470,12 +483,12 @@ property or property parameter."),
attach = self.get_ics_file(cr, uid, res_obj, context=context)
if mail_to and email_from:
tools.email_send(
email_from,
mail_to,
sub,
body,
attach=attach and [('invitation.ics', attach)] or None,
subtype='html',
email_from,
mail_to,
sub,
body,
attach=attach and [('invitation.ics', attach)] or None,
subtype='html',
reply_to=email_from
)
return True
@ -486,7 +499,7 @@ property or property parameter."),
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs.
@param user_id: User id
@param user_id: Changed value of User id
@return: dictionary of value. which put value in email and availability fields.
"""
@ -497,24 +510,27 @@ property or property parameter."),
return {'value': {'email': user.address_id.email, 'availability':user.availability}}
def do_tentative(self, cr, uid, ids, context=None, *args):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs
@param *args: Get Tupple value
@param context: A standard dictionary for contextual values """
""" Makes event invitation as Tentative
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs
@param *args: Get Tupple value
@param context: A standard dictionary for contextual values
"""
self.write(cr, uid, ids, {'state': 'tentative'}, context)
def do_accept(self, cr, uid, ids, context=None, *args):
"""
Update state which value is accepted.
Update state of invitation as Accepted and
if the invited user is other then event user it will make a copy of this event for invited user
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs.
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
context = {}
@ -531,21 +547,23 @@ property or property parameter."),
return True
def do_decline(self, cr, uid, ids, context=None, *args):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs
@param *args: Get Tupple value
@param context: A standard dictionary for contextual values """
""" Marks event invitation as Declined
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar attendees IDs
@param *args: Get Tupple value
@param context: A standard dictionary for contextual values """
self.write(cr, uid, ids, {'state': 'declined'}, context)
def create(self, cr, uid, vals, context=None):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param vals: Get Values
@param context: A standard dictionary for contextual values """
""" Overrides orm create method.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param vals: Get Values
@param context: A standard dictionary for contextual values """
if not context:
context = {}
@ -560,8 +578,10 @@ property or property parameter."),
calendar_attendee()
class res_alarm(osv.osv):
"""Resource Alarm """
_name = 'res.alarm'
_description = 'Basic Alarm Information'
_columns = {
'name':fields.char('Name', size=256, required=True),
'trigger_occurs': fields.selection([('before', 'Before'), \
@ -589,17 +609,19 @@ true, it will allow you to hide the event alarm information without removing it.
'active': lambda *x: 1,
}
def do_alarm_create(self, cr, uid, ids, model, date, context={}):
def do_alarm_create(self, cr, uid, ids, model, date, context=None):
"""
Create Alarm for meeting.
Create Alarm for event.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of res alarms IDs.
@param model: Model name.
@param date: Event date
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
context = {}
alarm_obj = self.pool.get('calendar.alarm')
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
@ -637,16 +659,17 @@ true, it will allow you to hide the event alarm information without removing it.
cr.commit()
return True
def do_alarm_unlink(self, cr, uid, ids, model, context={}):
def do_alarm_unlink(self, cr, uid, ids, model, context=None):
"""
Delete alarm specified in ids
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of res alarms IDs.
@param model: Model name.
@param model: Model name for which alarm is to be cleared.
@return: True
"""
if not context:
context = {}
alarm_obj = self.pool.get('calendar.alarm')
ir_obj = self.pool.get('ir.model')
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
@ -669,51 +692,53 @@ class calendar_alarm(osv.osv):
__attribute__ = {}
_columns = {
'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'),
'alarm_id': fields.many2one('res.alarm', 'Basic Alarm', ondelete='cascade'),
'name': fields.char('Summary', size=124, help="""Contains the text to be \
used as the message subject for email \
or contains the text to be used for display"""),
or contains the text to be used for display"""),
'action': fields.selection([('audio', 'Audio'), ('display', 'Display'), \
('procedure', 'Procedure'), ('email', 'Email') ], 'Action', \
required=True, help="Defines the action to be invoked when an alarm is triggered"),
required=True, help="Defines the action to be invoked when an alarm is triggered"),
'description': fields.text('Description', help='Provides a more complete \
description of the calendar component, than that \
provided by the "SUMMARY" property'),
provided by the "SUMMARY" property'),
'attendee_ids': fields.many2many('calendar.attendee', 'alarm_attendee_rel', \
'alarm_id', 'attendee_id', 'Attendees', readonly=True),
'alarm_id', 'attendee_id', 'Attendees', readonly=True),
'attach': fields.binary('Attachment', help="""* Points to a sound resource,\
which is rendered when the alarm is triggered for audio,
* File which is intended to be sent as message attachments for email,
* Points to a procedure resource, which is invoked when\
the alarm is triggered for procedure."""),
'res_id': fields.integer('Resource ID'),
'model_id': fields.many2one('ir.model', 'Model'),
'user_id': fields.many2one('res.users', 'Owner'),
'event_date': fields.datetime('Event Date'),
'event_end_date': fields.datetime('Event End Date'),
'trigger_date': fields.datetime('Trigger Date', readonly="True"),
the alarm is triggered for procedure."""),
'res_id': fields.integer('Resource ID'),
'model_id': fields.many2one('ir.model', 'Model'),
'user_id': fields.many2one('res.users', 'Owner'),
'event_date': fields.datetime('Event Date'),
'event_end_date': fields.datetime('Event End Date'),
'trigger_date': fields.datetime('Trigger Date', readonly="True"),
'state':fields.selection([
('draft', 'Draft'),
('run', 'Run'),
('stop', 'Stop'),
('done', 'Done'),
], 'State', select=True, readonly=True),
('draft', 'Draft'),
('run', 'Run'),
('stop', 'Stop'),
('done', 'Done'),
], 'State', select=True, readonly=True),
}
_defaults = {
'action': lambda *x: 'email',
'state': lambda *x: 'run',
}
def create(self, cr, uid, vals, context={}):
def create(self, cr, uid, vals, context=None):
"""
create new record.
Overrides orm create method.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param vals: dictionary of fields value.{name_of_the_field: value, ...}
@param context: A standard dictionary for contextual values
@return: new record id for calendar_alarm.
"""
if not context:
context = {}
event_date = vals.get('event_date', False)
if event_date:
dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S")
@ -730,7 +755,7 @@ class calendar_alarm(osv.osv):
def do_run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, \
context=None):
"""
"""Scheduler for event reminder
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -807,7 +832,7 @@ class calendar_event(osv.osv):
return [(x.lower(), x) for x in pytz.all_timezones]
def onchange_allday(self, cr, uid, ids, allday, context={}):
"""
"""Sets duration as 24 Hours if event is selcted for all day
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -819,23 +844,23 @@ class calendar_event(osv.osv):
return {}
event = self.browse(cr, uid, ids, context=context)[0]
value = {
'date': event.date and event.date[:11] + '00:00:00',
'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00',
'duration': 24
'duration': 24
}
return {'value': value}
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}):
"""
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context=None):
"""Returns duration and/or end date based on values passed
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of calendar events IDs.
@param start_date: Get starting date
@param duration: Get Duration between start date and end date or False
@param end_date: Get Ending Date or False
@param start_date: Starting date
@param duration: Duration between start date and end date
@param end_date: Ending Datee
@param context: A standard dictionary for contextual values
"""
if not context:
context = {}
value = {}
if not start_date:
return value
@ -844,10 +869,7 @@ class calendar_event(osv.osv):
value['duration'] = duration
if allday: # For all day event
start = start_date[:11] + '00:00:00'
value = {
'date': start,
'date_deadline': start,
'duration': 24
}
return {'value': value}
@ -864,15 +886,17 @@ class calendar_event(osv.osv):
return {'value': value}
def _set_rrulestring(self, cr, uid, id, name, value, arg, context):
def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None):
"""
Set rule string.
Sets values of fields that defines event recurrence from the value of rrule string
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param id: List of calendar event's ids.
@param context: A standard dictionary for contextual values
@return: dictionary of rrule value.
"""
if not context:
context = {}
cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\
mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\
day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id))
@ -949,7 +973,7 @@ class calendar_event(osv.osv):
def _get_rulestring(self, cr, uid, ids, name, arg, context=None):
"""
Get rule string.
Gets Recurrence rule string according to value type RECUR of iCalendar from the values given.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param id: List of calendar event's ids.
@ -978,15 +1002,15 @@ class calendar_event(osv.osv):
_columns = {
'id': fields.integer('ID'),
'sequence': fields.integer('Sequence'),
'name': fields.char('Description', size=64, required=True),
'name': fields.char('Description', size=64, required=False),
'date': fields.datetime('Date'),
'date_deadline': fields.datetime('Deadline'),
'create_date': fields.datetime('Created', readonly=True),
'duration': fields.float('Duration'),
'description': fields.text('Your action'),
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
('confidential', 'Confidential')], 'Mark as'),
'location': fields.char('Location', size=264, help="Location of Event"),
('confidential', 'Confidential')], 'Mark as'),
'location': fields.char('Location', size=264, help="Location of Event"),
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \
'Show as'),
'base_calendar_url': fields.char('Caldav URL', size=264),
@ -1036,12 +1060,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
('SU', 'Sunday')], 'Weekday'),
'byday': fields.selection([('1', 'First'), ('2', 'Second'), \
('3', 'Third'), ('4', 'Fourth'), \
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
'month_list': fields.selection(months.items(), 'Month'),
'end_date': fields.date('Repeat Until'),
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
'month_list': fields.selection(months.items(), 'Month'),
'end_date': fields.date('Repeat Until'),
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \
'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day'),
'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day'),
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
}
@ -1082,29 +1106,29 @@ true, it will allow you to hide the event alarm information without removing it.
id4 = data_obj.browse(cr, uid, id4, context=context).res_id
for id in ids:
value = {
'name': _('Event'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'calendar.event',
'view_id': False,
'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
'type': 'ir.actions.act_window',
'res_id': base_calendar_id2real_id(id),
'name': _('Event'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'calendar.event',
'view_id': False,
'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
'type': 'ir.actions.act_window',
'res_id': base_calendar_id2real_id(id),
'nodestroy': True
}
return value
def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args):
"""
"""Modifies only one event record out of virtual recurrent events
and creates new event as a specific instance of a Recurring Event",
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param event_id: Get Event_id
@param real_date: Get Real Date
@param event_id: Id of Recurring Event
@param real_date: Date of event recurrence that is being modified
@param context: A standard dictionary for contextual values
@param *args: Get Tuppel Value
@param *args: Get Tupple Value
"""
event_id = base_calendar_id2real_id(event_id)
@ -1124,10 +1148,11 @@ true, it will allow you to hide the event alarm information without removing it.
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):
"""
Modify name, date, date_deadline fields.
Modifies the recurring event
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param event_ids: List of crm meetings IDs.
@param context: A standard dictionary for contextual values
@return: True
"""
@ -1149,7 +1174,8 @@ true, it will allow you to hide the event alarm information without removing it.
return True
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100):
"""
"""Gives virtual event ids for recurring events based on value of Recurrence Rule
This method gives ids of dates that comes between start date and end date of calendar views
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -1231,12 +1257,13 @@ true, it will allow you to hide the event alarm information without removing it.
def compute_rule_string(self, cr, uid, datas, context=None, *args):
"""
Compute rule string.
Compute rule string according to value type RECUR of iCalendar from the values given.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param datas: dictionary of freq and interval value.
@return: string value which compute FREQILY;INTERVAL
@param context: A standard dictionary for contextual values
@return: String value of the format RECUR of iCalendar
"""
weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
@ -1294,6 +1321,8 @@ true, it will allow you to hide the event alarm information without removing it.
@param args: list of tuples of form [(name_of_the_field, operator, value), ...].
@param offset: The Number of Results to Pass
@param limit: The Number of Results to Return
@param context: A standard dictionary for contextual values
@param count: If its True the method returns number of records instead of ids
@return: List of id
"""
args_without_date = []
@ -1319,12 +1348,13 @@ true, it will allow you to hide the event alarm information without removing it.
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
"""
Writes values in one or several fields.
Overrides orm write method.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of crm meeting's ids
@param vals: Dictionary of field value.
@param context: A standard dictionary for contextual values
@return: True
"""
if not context:
@ -1364,6 +1394,7 @@ true, it will allow you to hide the event alarm information without removing it.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of crm meeting's ids
@param context: A standard dictionary for contextual values
@return: the object list.
"""
if isinstance(ids, (str, int, long)):
@ -1378,15 +1409,19 @@ true, it will allow you to hide the event alarm information without removing it.
return res
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
"""
Overrides orm Read method.Read List of fields for calendar event.
@param cr: the current row, from the database cursor,
@param user: the current users ID for security checks,
@param ids: List of calendar event's id.
@param fields: List of fields.
@param context: A standard dictionary for contextual values
@return: List of Dictionary of form [{name_of_the_field: value, ...}, ...]
"""
if not context:
context = {}
if isinstance(ids, (str, int, long)):
select = [ids]
else:
@ -1408,14 +1443,17 @@ true, it will allow you to hide the event alarm information without removing it.
return result and result[0] or False
return result
def copy(self, cr, uid, id, default=None, context={}):
def copy(self, cr, uid, id, default=None, context=None):
"""
Duplicate record on specified id.
@param self: the object pointer.
@param cr: the current row, from the database cursor,
@param id: id of record from which we duplicated.
@param context: A standard dictionary for contextual values
@return: Duplicate record id.
"""
if not context:
context = {}
res = super(calendar_event, self).copy(cr, uid, base_calendar_id2real_id(id), default, context)
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date')
@ -1428,6 +1466,7 @@ true, it will allow you to hide the event alarm information without removing it.
@param self: the object pointer.
@param cr: the current row, from the database cursor,
@param id: List of calendar event's id.
@param context: A standard dictionary for contextual values
@return: True
"""
res = False
@ -1454,15 +1493,18 @@ true, it will allow you to hide the event alarm information without removing it.
alarm_obj.do_alarm_unlink(cr, uid, ids, self._name)
return res
def create(self, cr, uid, vals, context={}):
def create(self, cr, uid, vals, context=None):
"""
Create new record.
@param self: the object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param vals: dictionary of every field value.
@param context: A standard dictionary for contextual values
@return: new created record id.
"""
if not context:
context = {}
res = super(calendar_event, self).create(cr, uid, vals, context)
alarm_obj = self.pool.get('res.alarm')
alarm_obj.do_alarm_create(cr, uid, [res], self._name, 'date')
@ -1582,7 +1624,7 @@ class ir_values(osv.osv):
return super(ir_values, self).set(cr, uid, key, key2, name, new_model, \
value, replace, isobject, meta, preserve_user, company)
def get(self, cr, uid, key, key2, models, meta=False, context={}, \
def get(self, cr, uid, key, key2, models, meta=False, context=None, \
res_id_req=False, without_user=True, key2_req=True):
"""
Get IR Values
@ -1591,7 +1633,8 @@ class ir_values(osv.osv):
@param uid: the current users ID for security checks,
@param model: Get The Model
"""
if not context:
context = {}
new_model = []
for data in models:
if type(data) in (list, tuple):
@ -1607,20 +1650,19 @@ class ir_model(osv.osv):
_inherit = 'ir.model'
def read(self, cr, uid, ids, fields=None, context={},
def read(self, cr, uid, ids, fields=None, context=None,
load='_classic_read'):
"""
Read IR Model
"""
Overrides orm read method.
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of IR Models IDs.
@param context: A standard dictionary for contextual values
"""
new_ids = isinstance(ids, (str, int, long)) and [ids] or ids
data = super(ir_model, self).read(cr, uid, new_ids, fields=fields, \
if not context:
context = {}
data = super(ir_model, self).read(cr, uid, ids, fields=fields, \
context=context, load=load)
if data:
for val in data:
@ -1656,8 +1698,8 @@ class res_users(osv.osv):
_inherit = 'res.users'
def _get_user_avail(self, cr, uid, ids, context=None):
"""
Get USer Availability
"""
Get User Availability
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -1687,8 +1729,8 @@ class res_users(osv.osv):
return res
def _get_user_avail_fun(self, cr, uid, ids, name, args, context=None):
"""
Get USer Availability Function
"""
Get User Availability Function
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -1703,6 +1745,7 @@ class res_users(osv.osv):
selection=[('free', 'Free'), ('busy', 'Busy')], \
string='Free/Busy', method=True),
}
res_users()

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Attendee form view-->
<record id="base_calendar_attendee_form_view" model="ir.ui.view">
<field name="name">calendar.attendee.form</field>
@ -65,6 +67,8 @@
</form>
</field>
</record>
<!-- Attendee tree view-->
<record id="base_calendar_attendee_tree_view" model="ir.ui.view">
<field name="name">calendar.attendee.tree</field>
@ -77,10 +81,14 @@
<field name="partner_address_id" string="Contact" />
<field name="role" />
<field name="state" />
<field name="cutype" invisible="1"/>
<field name="rsvp" invisible="1"/>
</tree>
</field>
</record>
<!-- Attendee search view-->
<record id="base_calendar_attendee_search_view" model="ir.ui.view">
<field name="name">calendar.attendee.search</field>
<field name="model">calendar.attendee</field>
@ -99,11 +107,26 @@
<separator orientation="vertical"/>
<field name="cutype" string="Invitation type" select="1"/>
<field name="event_date" select="1"/>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Type" icon="terp-project" help="Invitation Type"
domain="[]" context="{'group_by':'cutype'}" />
<filter string="Role" icon="terp-project"
domain="[]" context="{'group_by':'role'}" />
<filter string="Required Reply" icon="terp-crm"
domain="[]" context="{'group_by':'rsvp'}" />
<separator orientation="vertical" />
<filter string="User" icon="terp-partner" domain="[]"
context="{'group_by':'user_id'}" />
<filter string="Contact" icon="terp-partner" domain="[]"
context="{'group_by':'partner_address_id'}" />
</group>
</search>
</field>
</record>
<!-- Action for attendee view-->
<record id="action_view_attendee_form" model="ir.actions.act_window">
<field name="name">Event Invitations</field>
<field name="type">ir.actions.act_window</field>
@ -115,10 +138,12 @@
</record>
<!-- Calenadar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" />
<!-- Invitation menu -->
<menuitem id="menu_attendee_invitations"
name="Event Invitations" parent="base.menu_calendar_configuration"
sequence="10" action="action_view_attendee_form" />
@ -138,9 +163,6 @@
<field name="trigger_interval" select="1" />
<field name="trigger_occurs" select="1" />
<field name="trigger_related" select="1" />
<separator string="" colspan="4" />
<field name="duration" />
<field name="repeat" />
</form>
</field>
</record>
@ -162,7 +184,8 @@
</field>
</record>
<!-- Action for alarms view-->
<record id="action_res_alarm_view" model="ir.actions.act_window">
<field name="name">Available Alarms</field>
<field name="type">ir.actions.act_window</field>
@ -170,6 +193,8 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Menu for Alarms-->
<menuitem id="menu_crm_meeting_avail_alarm"
groups="base.group_extended"
@ -405,6 +430,7 @@
</record>
<!-- Event menu -->
<menuitem id="menu_events"
name="Events" parent="base.menu_calendar_configuration"
sequence="5" action="action_view_event" />

View File

@ -212,8 +212,8 @@ class res_partner_job(osv.osv):
'name': fields.related('address_id', 'partner_id', type='many2one',\
relation='res.partner', string='Partner', help="You may\
enter Address first,Partner will be linked automatically if any."),
'address_id': fields.many2one('res.partner.address', 'Address', domain=[('partner_id', '=', name)], \
help='Address which is linked to the Partner'),
'address_id': fields.many2one('res.partner.address', 'Address', \
help='Address which is linked to the Partner'), # TO Correct: domain=[('partner_id', '=', name)]
'contact_id': fields.many2one('res.partner.contact','Contact', required=True, ondelete='cascade'),
'function_id': fields.many2one('res.partner.function','Partner Function', \
help="Function of this contact with this partner"),

View File

@ -143,8 +143,7 @@ class board_board(osv.osv):
_columns = {
'name': fields.char('Dashboard', size=64, required=True),
'view_id': fields.many2one('ir.ui.view', 'Board View'),
'line_ids': fields.one2many('board.board.line', 'board_id', 'Action Views'),
'menu_id':fields.many2one('ir.ui.menu', 'Menu', required=False),
'line_ids': fields.one2many('board.board.line', 'board_id', 'Action Views')
}
# the following lines added to let the button on dashboard work.

View File

@ -25,12 +25,11 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Note">
<field name="name" select="1"/>
<field name="type" select="1" required="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<separator string="Notes" colspan="4"/>
<field colspan="4" name="note" nolabel="1"/>
<field name="name" select="1"/>
<field name="type" select="1" required="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field colspan="4" name="note"/>
</form>
</field>
</record>
@ -66,15 +65,12 @@
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<form string="Dashboard">
<group col="6" colspan="4">
<field name="name" select="1" />
<field name="menu_id" colspan="2"/>
<button
name="%(action_board_menu_create)d"
string="Create Menu" type="action"
icon="gtk-justify-fill" attrs="{'invisible':[('menu_id','!=',False)]}"/>
</group>
<field colspan="4" name="line_ids" nolabel="1">
<field name="name" select="1"/>
<button colspan="2"
name="%(action_board_menu_create)d"
string="Create Menu" type="action"
icon="gtk-justify-fill" />
<field colspan="4" name="line_ids">
<tree string="Dashboard View">
<field name="name"/>
<field name="sequence"/>

View File

@ -69,17 +69,14 @@ class board_menu_create(osv.osv_memory):
'view_id': board.view_id.id,
})
obj_menu = self.pool.get('ir.ui.menu')
obj_board = self.pool.get('board.board')
#start Loop
for data in self.read(cr, uid, ids):
id = obj_menu.create(cr, uid, {
'name': data.get('menu_name'),
'parent_id': data.get('menu_parent_id'),
'icon': 'STOCK_SELECT_COLOR',
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
obj_board.write(cr, uid, [context_id], { "menu_id": id})
obj_menu.create(cr, uid, {
'name': data.get('menu_name'),
'parent_id': data.get('menu_parent_id'),
'icon': 'STOCK_SELECT_COLOR',
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
#End Loop
return {}

View File

@ -17,10 +17,9 @@
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<label string=" " colspan="2"/>
<button icon="gtk-close" special="cancel"
string="Close" />
<button icon="gtk-ok" string="Create"
<button icon="gtk-cancel" special="cancel"
string="Cancel" />
<button icon="gtk-save" string="Create Menu"
name="board_menu_create" type="object" />
</group>
</form>

View File

@ -11,7 +11,7 @@
<field name="name">My Expenses</field>
<field name="res_model">hr.expense.expense</field>
<field name="view_type">form</field>
<field name="domain">[('state','=','draft'),('user_id','=',uid)]</field>
<field name="domain">[('state','in',('draft', 'confirm')),('user_id','=',uid)]</field>
<field name="view_id" ref="hr_expense.view_editable_expenses_tree"/>
</record>

View File

@ -7,24 +7,72 @@
<field name="res_model">project.issue</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('create_date', '&gt;=', time.strftime('%Y-%m-%d 00:00:00')),('create_date', '&lt;=', time.strftime('%Y-%m-%d 23:59:59'))]</field>
<field name="domain">[('user_id','=',uid),('state','in',['draft','open'])]</field>
<field name="view_id" ref="project_issue.project_issue_tree_view"/>
</record>
<record id="action_view_pending_project_issue_tree" model="ir.actions.act_window">
<field name="name">Project issues</field>
<field name="res_model">project.issue</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('user_id','=',uid),('state','=','pending')]</field>
<field name="view_id" ref="project_issue.project_issue_tree_view"/>
</record>
<record id="action_project_issue_graph_state" model="ir.actions.act_window">
<field name="name">Project Issue</field>
<field name="res_model">project.issue.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="project_issue.view_project_issue_report_graph"/>
</record>
<record id="view_project_issue_graph_stage" model="ir.ui.view">
<field name="name">project.issue.report.graph</field>
<field name="model">project.issue.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="vertical" string="Project Issue" type="bar">
<field name="stage_id"/>
<field name="nbr" operator="+"/>
<field group="True" name="user_id"/>
</graph>
</field>
</record>
<record id="action_project_issue_graph_stage" model="ir.actions.act_window">
<field name="name">Project Issue</field>
<field name="res_model">project.issue.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph</field>
<field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="view_project_issue_graph_stage"/>
</record>
<record id="board_project_issue_form" model="ir.ui.view">
<field name="name">board.project.issue.form</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Project Issue Board">
<vpaned>
<form string="My Board">
<hpaned>
<child1>
<action colspan="4" height="220" name="%(action_view_current_project_issue_tree)d" string="Current Project Issues" width="510"/>
<action colspan="4" name="%(action_view_current_project_issue_tree)d" string="Current Issues" width="510"/>
<action colspan="4" name="%(action_view_pending_project_issue_tree)d" string="Pending Issues" width="510"/>
</child1>
<child2>
<action colspan="4" height="220" name="%(project.action_task_by_days_graph)d" string="Project Tasks By Days" width="510"/>
<vpaned>
<child1>
<action colspan="4" name="%(action_project_issue_graph_state)d" string="Issues By State" />
</child1>
<child2>
<action colspan="4" name="%(action_project_issue_graph_stage)d" string="Issues By Stage" />
</child2>
</vpaned>
</child2>
</vpaned>
</hpaned>
</form>
</field>
</record>

View File

@ -8,6 +8,15 @@
name="Purchase"
parent="base.dashboard"/>
<record id="purchase_draft" model="ir.actions.act_window">
<field name="name">Draft Purchases</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('date_order','&gt;',time.strftime('%Y-01-01 00:00:00')),('date_order','&lt;',time.strftime('%Y-12-31 23:59:59')), ('state','=','draft')]</field>
<field name="search_view_id" ref="purchase.purchase_order_tree"/>
</record>
<record id="purchase_waiting" model="ir.actions.act_window">
<field name="name">Quotation Request</field>
<field name="type">ir.actions.act_window</field>
@ -26,7 +35,7 @@
<form string="My Board">
<hpaned>
<child1>
<action colspan="4" height="220" name="%(purchase.purchase_rfq)d" string="Draft Purchase Order" width="510"/>
<action colspan="4" height="220" name="%(purchase_draft)d" string="Draft Purchase Order" width="510"/>
<action colspan="4" height="220" name="%(purchase_waiting)d" string="Purchase Order in Waiting" width="510"/>
</child1>
<child2>

View File

@ -17,10 +17,10 @@
<record model="ir.ui.view" id="view_calendar_collection_tree">
<field name="name">Calendar Collections : Tree</field>
<field name="model">document.directory</field>
<field name="type">tree</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Calendar Collections" toolbar="1">
<field name="name"/>
<field name="name"/>
<field name="user_id"/>
<field name="create_date"/>
<field name="write_date"/>
@ -53,8 +53,8 @@
<field name="view_id" ref="view_calendar_collection_form"/>
<field name="act_window_id" ref="action_calendar_collection_form"/>
</record>
<menuitem
<menuitem
id="menu_calendar"
name="Calendar"
parent="base.menu_document_configuration"/>
@ -73,7 +73,7 @@
<field name="name"/>
<field name="type"/>
<field name="user_id"/>
<field name="collection_id" required="1"/>
<field name="collection_id" required="1"/>
<field name="line_ids" mode="form,tree" colspan="4" nolabel="1">
<form string="Calendar Lines">
<field name="name" required="1" select="1" />
@ -110,11 +110,11 @@
<record model="ir.ui.view" id="view_caldav_tree">
<field name="name">Calendar : Tree</field>
<field name="model">basic.calendar</field>
<field name="type">tree</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Calendars" toolbar="1">
<field name="name"/>
<field name="type"/>
<field name="name"/>
<field name="type"/>
<field name="user_id"/>
<field name="create_date"/>
<field name="write_date"/>
@ -127,8 +127,8 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">basic.calendar</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<field name="view_mode">tree,form</field>
</record>
<record id="action_caldav_view1" model="ir.actions.act_window.view">
<field eval="10" name="sequence"/>
@ -147,6 +147,5 @@
action="action_caldav_form"
id="menu_caldav_directories"
parent="menu_calendar"/>
</data>
</openerp>

View File

@ -202,7 +202,11 @@ class crm_case(object):
return {'value': {'email_from': False}}
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def _history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
mailgate_pool = self.pool.get('mailgate.thread')
return mailgate_pool._history(cr, uid, cases, keyword, history=history, email=email, details=details, email_from=email_from, message_id=message_id, context=context)
def case_open(self, cr, uid, ids, *args):
"""Opens Case
@param self: The object pointer
@ -311,6 +315,107 @@ class crm_case(object):
self._action(cr, uid, cases, 'draft')
return True
def remind_partner(self, cr, uid, ids, context={}, attach=False):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Remind Partner's IDs
@param context: A standard dictionary for contextual values
"""
return self.remind_user(cr, uid, ids, context, attach,
destination=False)
def remind_user(self, cr, uid, ids, context={}, attach=False,destination=True):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Remind user's IDs
@param context: A standard dictionary for contextual values
"""
for case in self.browse(cr, uid, ids):
if not case.section_id.reply_to:
raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team"))
if not case.email_from:
raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case"))
if case.section_id.reply_to and case.email_from:
src = case.email_from
dest = case.section_id.reply_to
body = ""
body = case.email_last or case.description
if not destination:
src, dest = dest, src
if body and case.user_id.signature:
body += '\n\n%s' % (case.user_id.signature)
body = self.format_body(body)
dest = [dest]
attach_to_send = None
if attach:
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'mailgate.thread'), ('res_id', '=', case.id)])
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
# Send an email
flag = tools.email_send(
src,
dest,
"Reminder: [%s] %s" % (str(case.id), case.name, ),
body,
reply_to=case.section_id.reply_to,
openobject_id=str(case.id),
attach=attach_to_send
)
self._history(cr, uid, [case], _('Send'), history=True, email=dest, details=body, email_from=src)
#if flag:
# raise osv.except_osv(_('Email!'),("Email Successfully Sent"))
#else:
# raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully"))
return True
def _check(self, cr, uid, ids=False, context={}):
"""
Function called by the scheduler to process cases for date actions
Only works on not done and cancelled cases
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
cr.execute('select * from crm_case \
where (date_action_last<%s or date_action_last is null) \
and (date_action_next<=%s or date_action_next is null) \
and state not in (\'cancel\',\'done\')',
(time.strftime("%Y-%m-%d %H:%M:%S"),
time.strftime('%Y-%m-%d %H:%M:%S')))
ids2 = map(lambda x: x[0], cr.fetchall() or [])
cases = self.browse(cr, uid, ids2, context)
return self._action(cr, uid, cases, False, context=context)
def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
if not context:
context = {}
context['state_to'] = state_to
rule_obj = self.pool.get('base.action.rule')
model_obj = self.pool.get('ir.model')
model_ids = model_obj.search(cr, uid, [('model','=',self._name)])
rule_ids = rule_obj.search(cr, uid, [('name','=',model_ids[0])])
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context)
def format_body(self, body):
return self.pool.get('base.action.rule').format_body(body)
def format_mail(self, obj, body):
return self.pool.get('base.action.rule').format_mail(obj, body)
class crm_case_section(osv.osv):
"""Sales Team"""
@ -507,61 +612,6 @@ def _links_get(self, cr, uid, context=None):
res = obj.read(cr, uid, ids, ['object', 'name'], context)
return [(r['object'], r['name']) for r in res]
class crm_case_log(osv.osv):
""" Case Communication History """
_name = "crm.case.log"
_description = "Case Communication History"
_order = "id desc"
_columns = {
'name': fields.char('Status', size=64),
'date': fields.datetime('Date'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'model_id': fields.many2one('ir.model', "Model"),
'res_id': fields.integer('Resource ID'),
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
crm_case_log()
class crm_case_history(osv.osv):
"""Case history"""
_name = "crm.case.history"
_description = "Case history"
_order = "id desc"
_inherits = {'crm.case.log': "log_id"}
def _note_get(self, cursor, user, ids, name, arg, context=None):
""" Gives case History Description
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of case Historys IDs
@param context: A standard dictionary for contextual values
"""
res = {}
for hist in self.browse(cursor, user, ids, context or {}):
res[hist.id] = (hist.email_from or '/') + ' (' + str(hist.date) + ')\n'
res[hist.id] += (hist.description or '')
return res
_columns = {
'description': fields.text('Description'),
'note': fields.function(_note_get, method=True, string="Description", type="text"),
'email_to': fields.char('Email To', size=84),
'email_from' : fields.char('Email From', size=84),
'log_id': fields.many2one('crm.case.log','Log',ondelete='cascade'),
'message_id': fields.char('Message Id', size=1024, readonly=True, help="Message Id on Email Server.", select=True),
}
crm_case_history()
class users(osv.osv):
_inherit = 'res.users'
_description = "Users"

View File

@ -34,138 +34,24 @@ from osv.orm import except_orm
import crm
class case(osv.osv):
""" Case """
_inherit = 'mailgate.thread'
_description = 'case'
_columns = {
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
}
def remind_partner(self, cr, uid, ids, context={}, attach=False):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Remind Partner's IDs
@param context: A standard dictionary for contextual values
"""
return self.remind_user(cr, uid, ids, context, attach,
destination=False)
def remind_user(self, cr, uid, ids, context={}, attach=False,destination=True):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Remind user's IDs
@param context: A standard dictionary for contextual values
"""
for case in self.browse(cr, uid, ids):
if not case.section_id.reply_to:
raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team"))
if not case.email_from:
raise osv.except_osv(_('Error!'), ("Partner Email is not specified in Case"))
if case.section_id.reply_to and case.email_from:
src = case.email_from
dest = case.section_id.reply_to
body = ""
body = case.email_last or case.description
if not destination:
src, dest = dest, src
if body and case.user_id.signature:
body += '\n\n%s' % (case.user_id.signature)
body = self.format_body(body)
dest = [dest]
attach_to_send = None
if attach:
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'mailgate.thread'), ('res_id', '=', case.id)])
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
# Send an email
flag = tools.email_send(
src,
dest,
"Reminder: [%s] %s" % (str(case.id), case.name, ),
body,
reply_to=case.section_id.reply_to,
openobject_id=str(case.id),
attach=attach_to_send
)
self._history(cr, uid, [case], _('Send'), history=True, email=dest, details=body, email_from=src)
#if flag:
# raise osv.except_osv(_('Email!'),("Email Successfully Sent"))
#else:
# raise osv.except_osv(_('Email Fail!'),("Email is not sent successfully"))
return True
def _check(self, cr, uid, ids=False, context={}):
"""
Function called by the scheduler to process cases for date actions
Only works on not done and cancelled cases
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values
"""
cr.execute('select * from crm_case \
where (date_action_last<%s or date_action_last is null) \
and (date_action_next<=%s or date_action_next is null) \
and state not in (\'cancel\',\'done\')',
(time.strftime("%Y-%m-%d %H:%M:%S"),
time.strftime('%Y-%m-%d %H:%M:%S')))
ids2 = map(lambda x: x[0], cr.fetchall() or [])
cases = self.browse(cr, uid, ids2, context)
return self._action(cr, uid, cases, False, context=context)
def _action(self, cr, uid, cases, state_to, scrit=None, context={}):
if not context:
context = {}
context['state_to'] = state_to
rule_obj = self.pool.get('base.action.rule')
model_obj = self.pool.get('ir.model')
model_ids = model_obj.search(cr, uid, [('model','=',self._name)])
rule_ids = rule_obj.search(cr, uid, [('name','=',model_ids[0])])
return rule_obj._action(cr, uid, rule_ids, cases, scrit=scrit, context=context)
def format_body(self, body):
return self.pool.get('base.action.rule').format_body(body)
def format_mail(self, obj, body):
return self.pool.get('base.action.rule').format_mail(obj, body)
case()
class base_action_rule(osv.osv):
""" Base Action Rule """
_inherit = 'base.action.rule'
_description = 'Action Rules'
_columns = {
'trg_section_id': fields.many2one('crm.case.section', 'Sales Team'),
'trg_max_history': fields.integer('Maximum Communication History'),
'trg_categ_id': fields.many2one('crm.case.categ', 'Category'),
'regex_history' : fields.char('Regular Expression on Case History', size=128),
'act_section_id': fields.many2one('crm.case.section', 'Set Team to'),
'act_categ_id': fields.many2one('crm.case.categ', 'Set Category to'),
'act_mail_to_partner': fields.boolean('Mail to partner',help="Check \
this if you want the rule to send an email to the partner."),
'trg_section_id': fields.many2one('crm.case.section', 'Sales Team'),
'trg_max_history': fields.integer('Maximum Communication History'),
'trg_categ_id': fields.many2one('crm.case.categ', 'Category'),
'regex_history' : fields.char('Regular Expression on Case History', size=128),
'act_section_id': fields.many2one('crm.case.section', 'Set Team to'),
'act_categ_id': fields.many2one('crm.case.categ', 'Set Category to'),
'act_mail_to_partner': fields.boolean('Mail to Partner', help="Check \
this if you want the rule to send an email to the partner."),
}
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from',False), context={}):
def email_send(self, cr, uid, obj, emails, body, emailfrom=tools.config.get('email_from', False), context={}):
body = self.format_mail(obj, body)
if not emailfrom:
if hasattr(obj, 'user_id') and obj.user_id and obj.user_id.address_id and obj.user_id.address_id.email:
@ -178,7 +64,7 @@ this if you want the rule to send an email to the partner."),
else:
reply_to = emailfrom
if not emailfrom:
raise osv.except_osv(_('Error!'),
raise osv.except_osv(_('Error!'),
_("No E-Mail ID Found for your Company address!"))
return tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, openobject_id=str(obj.id))
@ -253,7 +139,7 @@ this if you want the rule to send an email to the partner."),
@param context: A standard dictionary for contextual values """
res = super(base_action_rule, self).state_get(cr, uid, context=context)
return res + [('escalate','Escalate')] + crm.AVAILABLE_STATES
return res + [('escalate', 'Escalate')] + crm.AVAILABLE_STATES
def priority_get(self, cr, uid, context={}):

View File

@ -34,7 +34,8 @@ class crm_lead(osv.osv, crm_case):
_name = "crm.lead"
_description = "Lead"
_order = "priority, id desc"
_inherit = ['res.partner.address', 'mailgate.thread']
_inherit = ['res.partner.address']
_inherits = {'mailgate.thread': 'thread_id'}
def _compute_day(self, cr, uid, ids, fields, args, context={}):
"""
@ -95,6 +96,10 @@ class crm_lead(osv.osv, crm_case):
_columns = {
# From crm.case
'name': fields.char('Name', size=64),
'active': fields.boolean('Active', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'email_from': fields.char('Email', size=128, help="These people will receive email."),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
@ -107,6 +112,7 @@ and users by email"),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'categ_id': fields.many2one('crm.case.categ', 'Lead Source', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]"),
@ -148,7 +154,7 @@ and users by email"),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
def case_open(self, cr, uid, ids, *args):
"""Overrides cancel for crm_case for setting Open Date
@param self: The object pointer

View File

@ -10,7 +10,7 @@
<field name="view_id" ref="crm_case_tree_view_leads"/>
<field name="context">{"search_default_user_id":uid,'search_default_current':1}</field>
<field name="search_view_id" ref="crm.view_crm_case_leads_filter"/>
<field name="context">{'search_default_current':1}</field>
<field name="context">{'search_default_current':1, 'default_type': 'lead'}</field>
</record>
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_leads_all">

View File

@ -43,7 +43,8 @@ class crm_meeting(osv.osv, crm_case):
_name = 'crm.meeting'
_description = "Meeting"
_order = "id desc"
_inherit = ["mailgate.thread", "calendar.event"]
_inherit = ["calendar.event"]
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
# From crm.case
@ -58,6 +59,7 @@ class crm_meeting(osv.osv, crm_case):
'id': fields.integer('ID'),
# Meeting fields
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'categ_id': fields.many2one('crm.case.categ', 'Meeting Type', \
domain="[('object_id.model', '=', 'crm.meeting')]", \
),

View File

@ -24,18 +24,18 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Meetings">
<group col="6" colspan="4">
<group col="6" colspan="4">
<field name="name" select="1" string="Summary"
colspan="2" />
required="1" colspan="2" />
<field name="categ_id" widget="selection"
string="Meeting Type"
groups="base.group_extended"
domain="[('object_id.model', '=', 'crm.meeting')]" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
<field name="date" string="Start Date" required="1"
on_change="onchange_dates(date,duration,False)" />
<field name="allday" colspan="2" on_change="onchange_allday(allday)" />
<field name="date" string="Start Date" required="1"
on_change="onchange_dates(date,duration,False,allday)" />
<field name="duration" widget="float_time"
on_change="onchange_dates(date,duration,False)" />
on_change="onchange_dates(date,duration,False,allday)" />
<field name="date_deadline" string="End Date"
required="1"
on_change="onchange_dates(date,False,date_deadline)" />
@ -323,7 +323,7 @@
</field>
</field>
</record>
<!-- Partners inherited form -->
<record id="view_meeting_partner_info_form" model="ir.ui.view">

View File

@ -27,7 +27,7 @@
<field name="res_model">crm.lead</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('type','=','opportunity')]</field>
<field name="context">{'search_default_current':1}</field>
<field name="context">{'search_default_current':1, 'default_type': 'opportunity'}</field>
<field name="view_id" ref="crm_case_tree_view_oppor"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="crm.view_crm_case_opportunities_filter"/>

View File

@ -56,7 +56,7 @@
<field name="arch" type="xml">
<form string="Opportunities">
<group colspan="4" col="7">
<field name="name" string="Opportunity"/>
<field name="name" required="1" string="Opportunity"/>
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"

View File

@ -31,10 +31,13 @@ class crm_phonecall(osv.osv, crm_case):
_name = "crm.phonecall"
_description = "Phonecall"
_order = "id desc"
_inherit = 'mailgate.thread'
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
# From crm.case
'name': fields.char('Name', size=64),
'active': fields.boolean('Active', required=False),
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),

View File

@ -19,17 +19,15 @@
<field name="name" select="1" colspan="2"/>
<field name="parent_id" select="2" widget="selection"/>
<field name="code" select="1"/>
<field name="resource_calendar_id" select="2"/>
<newline/>
<field name="user_id" select="2"/>
<field name="resource_calendar_id" select="2" widget="selection"/>
<field name="active" select="2"/>
</group>
<notebook colspan="4">
<page string="Sales Team">
<group col="2" colspan="1">
<separator string="Responsible" colspan="2"/>
<field name="parent_id" select="2" widget="selection"/>
<field name="user_id" select="2"/>
</group>
<group col="2" colspan="1">
<separator string="Contact Information" colspan="2"/>
<separator string="Mailgateway" colspan="2"/>
<field name="reply_to" select="2"/>
</group>
<group col="2" colspan="1">
@ -38,8 +36,9 @@
</group>
<separator string="Team Members" colspan="4"/>
<field name="member_ids" nolabel="1" colspan="4"/>
</page><page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="note" select="1" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
@ -233,313 +232,6 @@
</field>
</record>
<!--Case History Tree View -->
<record id="crm_case_history_tree-view" model="ir.ui.view">
<field name="name">crm.case.history.tree</field>
<field name="model">crm.case.history</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Case History">
<field name="date"/>
<field name="name"/>
<field name="user_id"/>
<!--
<field name="som"/>
<field name="canal_id"/>
-->
</tree>
</field>
</record>
<!-- Case Calendar View -->
<record id="crm_case_calendar-view" model="ir.ui.view">
<field name="name">crm.case.calendar</field>
<field name="model">mailgate.thread</field>
<field name="type">calendar</field>
<field name="arch" type="xml">
<calendar color="user_id" date_start="create_date"
date_stop="date_deadline" day_length="12"
string="Cases">
<field name="name" />
<field name="partner_id" />
<field name="state" />
</calendar>
</field>
</record>
<!-- Case Tree View -->
<record id="crm_case_tree-view" model="ir.ui.view">
<field name="name">crm.case.tree</field>
<field name="model">mailgate.thread</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:date_deadline&lt;current_date and state=='open';black:state in ('draft', 'cancel','done','pending')" string="Cases">
<field name="id"/>
<field name="section_id"/>
<field name="create_date"/>
<field name="date_deadline"/>
<field name="name"/>
<field name="partner_id"/>
<field name="user_id"/>
<field name="state"/>
<button name="case_close"
states="open,draft,pending" string="Close"
type="object" icon="gtk-close" />
<button name="case_open" states="draft,pending"
string="Open" type="object" icon="gtk-go-forward" />
<button name="case_cancel"
states="draft,open,pending" string="Cancel"
type="object" icon="gtk-cancel" />
<button name="case_pending" states="draft,open"
string="Pending" type="object"
icon="gtk-media-pause" />
<button name="case_escalate"
states="open,draft,pending" string="Escalate"
groups="base.group_extended"
type="object" icon="gtk-go-up" />
<button name="case_reset" states="done,cancel"
string="Reset to Draft" type="object"
icon="gtk-convert" />
</tree>
</field>
</record>
<!-- Case Form View -->
<record id="crm_case-view" model="ir.ui.view">
<field name="name">crm.case.form</field>
<field name="model">mailgate.thread</field>
<field name="type">form</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<form string="Cases">
<field colspan="4" name="name" select="1"/>
<field colspan="2" name="section_id" widget="selection"/>
<field name="create_date" select="1"/>
<field name="date_deadline"/>
<newline />
<notebook colspan="4">
<page string="General">
<group col="8" colspan="4">
<field colspan="4" name="partner_id"
on_change="onchange_partner_id(partner_id, email_from)"
select="1" />
<field colspan="3"
name="partner_address_id"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
/>
<newline />
<field colspan="3" name="email_from"
/>
<button name="remind_partner"
states="open,pending"
string="Send Reminder" type="object"
icon="gtk-go-forward" />
<field name="user_id" select="1" />
<button name="remind_user"
states="open,pending"
string="Send Reminder" type="object"
icon="gtk-go-forward" />
</group>
<separator colspan="4" string="Description"/>
<field name="description" colspan="4" nolabel="1"/>
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1"/>
<button name="case_close"
states="open,draft,pending"
string="Close" type="object"
icon="gtk-close" />
<button name="case_open"
states="draft,pending" string="Open"
type="object" icon="gtk-go-forward" />
<button name="case_cancel"
states="draft,open,pending"
string="Cancel" type="object"
icon="gtk-cancel" />
<button name="case_pending"
states="draft,open" string="Pending"
type="object" icon="gtk-media-pause" />
<button name="case_escalate"
states="open,draft,pending"
string="Escalate" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_reset"
states="done,cancel"
string="Reset to Draft" type="object"
icon="gtk-convert" />
</group>
</page>
<page string="History" groups="base.group_extended">
<field name="id" select="1"/>
<field name="active"/>
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field colspan="4" name="log_ids" nolabel="1">
<form string="Actions">
<separator colspan="4" string="Action Information"/>
<field colspan="4" name="name"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.case'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.case'}"
icon="gtk-go-forward" type="action" />
</page>
</notebook>
</form>
</field>
</record>
<!-- Case Search View -->
<record id="view_crm_case_filter" model="ir.ui.view">
<field name="name">crm.case.select</field>
<field name="model">mailgate.thread</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Case">
<group col='6' colspan='4'>
<field name="state" select="1">
<filter icon="gtk-new"
domain="[('state','in',('draft', 'open'))]"
help="Current Cases" />
<filter icon="gtk-yes"
domain="[('state','=','open')]" help="Open Cases" />
<filter icon="gtk-media-pause"
domain="[('state','=','pending')]"
help="Pending Cases" />
</field>
<separator orientation="vertical" />
<field name="name" select='1' />
<field name="user_id" select="1"
widget="selection" />
</group>
<field name="section_id"
default="context.get('section_id', False)" select="1"
widget="selection"/>
</search>
</field>
</record>
<record id="crm_case_categ0-act" model="ir.actions.act_window">
<field name="name">Cases</field>
<field name="res_model">mailgate.thread</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm_case_tree-view"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_crm_case_filter"/>
</record>
<record id="crm_case_categ0-act_open" model="ir.actions.act_window">
<field name="name">Open Cases</field>
<field name="res_model">mailgate.thread</field>
<field name="view_type">form</field>
<field name="domain">
[('state','&lt;&gt;','done'),('state','&lt;&gt;','cancel'),('state','&lt;&gt;','pending')]
</field>
<field name="search_view_id" ref="view_crm_case_filter"/>
</record>
<record id="crm_case_section_open_act" model="ir.actions.act_window">
<field name="name">Cases</field>
<field name="res_model">mailgate.thread</field>
<field name="domain">[('section_id','child_of',[active_id])]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
</record>
<record id="ir_open_section_case" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>
<field eval="'crm.case.section'" name="model"/>
<field name="name">Open Cases</field>
<field eval="'ir.actions.act_window,%d'%crm_case_section_open_act" name="value"/>
<field eval="True" name="object"/>
</record>
<!--Case History Form View -->
<record id="crm_case_history-view" model="ir.ui.view">
<field name="name">crm.case.history.form</field>
<field name="model">crm.case.history</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cases">
<separator colspan="4" string="Case Description"/>
<field colspan="4" name="name" select="1"/>
<field name="date" select="1"/>
<field name="user_id" select="1"/>
<field name="model_id"/>
<field name="res_id"/>
<field name="som"/>
<field name="canal_id"/>
<field colspan="4" name="description"/>
</form>
</field>
</record>
<!--Case History Search View -->
<record id="crm_case_history_search" model="ir.ui.view">
<field name="name">crm.case.history.select</field>
<field name="model">crm.case.history</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Histories">
<group col="6" colspan="2">
<field name="date" select="1"/>
<field name="user_id" select="1" widget="selection"/>
<field name="section_id"
default="context.get('section_id', False)"
select="1" widget="selection"/>
</group>
</search>
</field>
</record>
<!--Case History Action -->
<record id="crm_case_history-act" model="ir.actions.act_window">
<field name="name">Histories</field>
<field name="res_model">crm.case.history</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="crm_case_history_tree-view"/>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="crm_case_history_search"/>
</record>
<!-- Segmentation line Tree View -->

View File

@ -21,6 +21,7 @@
from osv import fields,osv
import tools
import crm_report
AVAILABLE_STATES = [
('draft','Draft'),
@ -35,7 +36,7 @@ class crm_lead_report(osv.osv):
_name = "crm.lead.report"
_auto = False
_description = "CRM Lead Report"
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@ -89,7 +90,7 @@ class crm_lead_report(osv.osv):
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
@ -98,12 +99,17 @@ class crm_lead_report(osv.osv):
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
],'Type', help="Type is used to separate Leads and Opportunities"),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
'type_id': fields.many2one('crm.case.resource.type', 'Lead Type', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]"),
'date_closed': fields.datetime('Closed', readonly=True),
'date_open': fields.datetime('Opened', readonly=True),
'date_deadline': fields.date('Deadline', readonly=True),
'opportunity_id': fields.many2one('crm.opportunity', 'Opportunity',readonly=True),
'country_id': fields.many2one('res.country', 'Country' , readonly=True),
'state_id': fields.many2one('res.country.state', 'State' , readonly=True)
}
def init(self, cr):
@ -132,6 +138,14 @@ class crm_lead_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
c.priority as priority,
c.type_id as type_id,
c.date_closed as date_closed,
c.date_open as date_open,
c.opportunity_id as opportunity_id,
c.country_id as country_id,
c.state_id as state_id,
c.date_deadline as date_deadline,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
@ -139,6 +153,8 @@ class crm_lead_report(osv.osv):
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id,c.stage_id,categ_id,c.partner_id,c.company_id, c.type
,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
,c.priority,c.type_id,c.date_closed,c.date_open
,c.opportunity_id,c.country_id,c.state_id,c.date_deadline
)""")
crm_lead_report()

View File

@ -22,7 +22,14 @@
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="date_closed" invisible="1"/>
<field name="date_open" invisible="1"/>
<field name="opportunity_id" invisible="1"/>
<field name="country_id" invisible="1"/>
<field name="state_id" invisible="1" string="State of Country"/>
<field name="date_deadline" invisible="1"/>
</tree>
</field>
</record>
@ -69,129 +76,55 @@
<field name="model">crm.lead.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="8">
<!-- <filter string="This Year" name="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"/>-->
<filter string="This Year" icon="terp-hr"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
<!-- <filter string="This Month" name="This Year" icon="terp-hr"
domain="[('month','=',time.strftime('%%m'))]" />-->
<filter string="This Month" icon="terp-hr" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="gtk-media-rewind" string="7 Days" separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical" />
<filter icon="terp-hr"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-hr"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-hr"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id"
default="context.get('section_id', False)"
widget="selection"
context="{'invisible_section': False}">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My section" />
</field>
<field name="company_id" widget="selection">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12" groups="base.group_extended">
<filter icon="terp-sale"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="terp-sale"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
</group>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
</field>
</record>
<!-- Opportunity tree view -->
<record id="view_report_crm_opportunity_tree" model="ir.ui.view">
<field name="name">crm.lead.report.tree</field>
<field name="model">crm.lead.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1" groups="base.group_extended"/>
<field name="user_id" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_extended"/>
<field name="partner_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
<field name="delay_close" sum='Avg Closing Delay'/>
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="type" invisible="1"/>
</tree>
<data>
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
<group>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<separator orientation="vertical"/>
<field name="priority" />
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
<newline/>
<field name="opportunity_id" />
<field name="partner_id" />
<separator orientation="vertical"/>
<field name="country_id" />
<field name="state_id" string="State of Country"/>
<separator orientation="vertical"/>
<field name="date_deadline" />
<newline/>
<field name="date_closed" />
<separator orientation="vertical"/>
<field name="date_open" />
</group>
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="State"]'
position='after'>
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="Category"]'
position='after'>
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
<separator orientation="vertical"/>
<filter string="Opportunity" icon="terp-sale" domain="[]"
context="{'group_by':'opportunity_id'}" />
<filter string="Partner" icon="terp-sale" domain="[]"
context="{'group_by':'partner_id'}" />
<newline/>
<filter string="Country" icon="terp-sale" domain="[]"
context="{'group_by':'country_id'}" />
<filter string="State of Country" icon="terp-sale" domain="[]"
context="{'group_by':'state_id'}" />
</xpath>
</data>
</field>
</record>

View File

@ -21,6 +21,7 @@
from osv import fields,osv
import tools
import crm_report
AVAILABLE_STATES = [
('draft','Draft'),
@ -98,6 +99,13 @@ class crm_phonecall_report(osv.osv):
('object_id.model', '=', 'crm.phonecall')]"),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True),
'opportunity_id': fields.many2one ('crm.opportunity', 'Opportunity'),
'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.phonecall')]"),
'duration': fields.float('Duration',readonly=True),
'date': fields.datetime('Planned Date'),
'partner_address_id': fields.many2one('res.partner.address', 'Contact Name', readonly=True)
}
def init(self, cr):
@ -124,6 +132,13 @@ class crm_phonecall_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
c.priority as priority,
c.date_closed as date_closed,
c.opportunity_id as opportunity_id,
c.canal_id as canal_id,
c.date as date,
c.partner_address_id as partner_address_id,
sum(c.duration) as duration,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
@ -131,6 +146,8 @@ class crm_phonecall_report(osv.osv):
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id, c.categ_id,c.partner_id,c.company_id
,to_char(c.create_date, 'YYYY-MM-DD'),c.create_date
,c.priority,c.date_closed,opportunity_id,canal_id,c.date
,partner_address_id
)""")
crm_phonecall_report()

View File

@ -16,11 +16,18 @@
<field name="user_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="partner_address_id" invisible="1"/>
<field name="nbr" string="#Phone calls" sum="#Phone calls"/>
<field name="delay_close" avg="Avg Closing Delay"/>
<field name="state" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="date_closed" invisible="1"/>
<field name="opportunity_id" invisible="1"/>
<field name="canal_id" invisible="1"/>
<field name="duration" sum="Total Duration"/>
<field name="date" invisible="1"/>
</tree>
</field>
</record>
@ -63,108 +70,46 @@
</record>
<!-- Phone calls by user and section Search View -->
<record id="view_report_crm_phonecall_filter" model="ir.ui.view">
<field name="name">crm.phonecall.report.select</field>
<field name="model">crm.phonecall.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="8">
<!-- <filter string="This Year" name="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"/>-->
<filter string="This Year" icon="terp-hr"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
<!-- <filter string="This Month" name="This Year" icon="terp-hr"
domain="[('month','=',time.strftime('%%m'))]" />-->
<filter string="This Month" icon="terp-hr" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="gtk-media-rewind" string="7 Days" separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical" />
<filter icon="terp-hr"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-hr"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-hr"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id"
default="context.get('section_id', False)"
widget="selection"
context="{'invisible_section': False}">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My section" />
</field>
<field name="company_id" widget="selection">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="terp-sale"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
</group>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
<data>
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
<group>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<field name="priority" />
<separator orientation="vertical"/>
<field name="opportunity_id"/>
<field name="canal_id" widget="selection" />
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="partner_address_id"/>
<newline/>
<field name="date_closed"/>
<field name="date"/>
</group>
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="Category"]'
position='after'>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<separator orientation="vertical"/>
<filter string="Opportunities" icon="terp-sale" domain="[]"
context="{'group_by':'opportunity_id'}" />
<filter string="Channel" icon="terp-sale" domain="[]"
context="{'group_by':'canal_id'}" />
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-sale" domain="[]"
context="{'group_by':'partner_id'}" />
<filter string="Contact Name" icon="terp-sale" domain="[]"
context="{'group_by':'partner_address_id'}" />
</xpath>
</data>
</field>
</record>

View File

@ -6,12 +6,8 @@
"access_crm_meeting","crm.meeting","model_crm_meeting","crm.group_crm_manager",1,1,1,1
"access_crm_lead","crm.lead","model_crm_lead","crm.group_crm_manager",1,1,1,1
"access_crm_phonecall","crm.phonecall","model_crm_phonecall","crm.group_crm_manager",1,1,1,1
"access_crm_case_log","crm.case.log","model_crm_case_log","crm.group_crm_user",1,1,1,1
"access_crm_case_history","crm.case.history","model_crm_case_history","crm.group_crm_user",1,1,1,1
"o","crm.case.section.manager","model_crm_case_section","crm.group_crm_manager",1,1,1,1
"access_crm_case_section_manager","crm.case.section.manager","model_crm_case_section","crm.group_crm_manager",1,1,1,1
"access_crm_case_categ_manager","crm.case.categ.manager","model_crm_case_categ","crm.group_crm_manager",1,1,1,1
"access_crm_case_log_manager","crm.case.log manager","model_crm_case_log","crm.group_crm_manager",1,1,1,1
"access_crm_case_history_manager","crm.case.history manager","model_crm_case_history","crm.group_crm_manager",1,1,1,1
"access_crm_case_stage","crm.case.stage","model_crm_case_stage","crm.group_crm_user",1,0,0,0
"access_crm_case_stage_manager","crm.case.stage","model_crm_case_stage","crm.group_crm_manager",1,1,1,1
"access_crm_case_resource_type_user","crm_case_resource_type user","model_crm_case_resource_type","crm.group_crm_user",1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_crm_meeting crm.meeting model_crm_meeting crm.group_crm_manager 1 1 1 1
7 access_crm_lead crm.lead model_crm_lead crm.group_crm_manager 1 1 1 1
8 access_crm_phonecall crm.phonecall model_crm_phonecall crm.group_crm_manager 1 1 1 1
9 access_crm_case_log access_crm_case_section_manager crm.case.log crm.case.section.manager model_crm_case_log model_crm_case_section crm.group_crm_user crm.group_crm_manager 1 1 1 1
access_crm_case_history crm.case.history model_crm_case_history crm.group_crm_user 1 1 1 1
o crm.case.section.manager model_crm_case_section crm.group_crm_manager 1 1 1 1
10 access_crm_case_categ_manager crm.case.categ.manager model_crm_case_categ crm.group_crm_manager 1 1 1 1
access_crm_case_log_manager crm.case.log manager model_crm_case_log crm.group_crm_manager 1 1 1 1
access_crm_case_history_manager crm.case.history manager model_crm_case_history crm.group_crm_manager 1 1 1 1
11 access_crm_case_stage crm.case.stage model_crm_case_stage crm.group_crm_user 1 0 0 0
12 access_crm_case_stage_manager crm.case.stage model_crm_case_stage crm.group_crm_manager 1 1 1 1
13 access_crm_case_resource_type_user crm_case_resource_type user model_crm_case_resource_type crm.group_crm_user 1 0 0 0

View File

@ -176,7 +176,6 @@ class crm_lead_forward_to_partner(osv.osv_memory):
this = self.browse(cr, uid, ids[0], context=context)
hist_obj = self.pool.get('crm.case.history')
smtp_pool = self.pool.get('email.smtpclient')
case_pool = self.pool.get(model)
case = case_pool.browse(cr, uid, res_id, context=context)

View File

@ -57,7 +57,6 @@ class crm_lead2opportunity(osv.osv_memory):
lead_obj = self.pool.get('crm.lead')
data_obj = self.pool.get('ir.model.data')
history_obj = self.pool.get('crm.case.history')
model_obj = self.pool.get('ir.model')
# Get Opportunity views

View File

@ -42,12 +42,15 @@
</record>
<!-- Lead to Partner wizard -->
<act_window id="action_crm_lead2partner"
key2="client_action_multi" name="Create a Partner"
res_model="crm.lead2partner" src_model="crm.lead"
view_id="view_crm_lead2partner_create"
view_mode="form" target="new" view_type="form" />
<record id="action_crm_lead2partner" model="ir.actions.act_window">
<field name="name">Create a Partner</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.lead2partner</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_crm_lead2partner_create"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -43,11 +43,15 @@
<!-- Phonecall to Partner wizard -->
<act_window id="action_crm_phonecall2partner"
key2="client_action_multi" name="Create a Partner"
res_model="crm.phonecall2partner" src_model="crm.phonecall"
view_id="view_crm_phonecall2partner_create"
view_mode="form" target="new" view_type="form" />
<record id="action_crm_phonecall2partner" model="ir.actions.act_window">
<field name="name">Create a Partner</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.phonecall2partner</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_crm_phonecall2partner_create"/>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -98,7 +98,9 @@ class crm_send_new_email(osv.osv_memory):
message_id = hist.message_id
model = hist.model_id.model
model_pool = self.pool.get(model)
case = model_pool.browse(cr, uid, hist.res_id)
res_ids = model_pool.search(cr, uid, [('thread_id','=', hist.thread_id.id)])
res_id = res_ids and res_ids[0] or False
case = model_pool.browse(cr, uid, res_id)
emails = [obj.email_to] + (obj.email_cc or '').split(',')
emails = filter(None, emails)
body = obj.text
@ -197,7 +199,9 @@ class crm_send_new_email(osv.osv_memory):
return {}
model_pool = self.pool.get(model)
case = model_pool.browse(cr, uid, hist.res_id)
res_ids = model_pool.search(cr, uid, [('thread_id','=', hist.thread_id.id)])
res_id = res_ids and res_ids[0] or False
case = model_pool.browse(cr, uid, res_id)
if 'email_to' in fields:
res.update({'email_to': case.email_from or hist.email_from or False})
if 'email_from' in fields:

View File

@ -29,10 +29,15 @@ class crm_claim(osv.osv, crm.crm_case):
_name = "crm.claim"
_description = "Claim Cases"
_order = "id desc"
_inherit = 'mailgate.thread'
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'id': fields.integer('ID', readonly=True),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'description': fields.text('Description'),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Update Date' , readonly=True),

View File

@ -113,6 +113,12 @@ class crm_claim_report(osv.osv):
'type_id': fields.many2one('crm.case.resource.type', 'Claim Type',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]"),
'date_closed': fields.datetime('Closed', readonly=True),
'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.claim')]"),
'som': fields.many2one('res.partner.som', 'State of Mind'),
'claim_date': fields.datetime('Date Of Claim',readonly=True),
'deadline_date': fields.datetime('Deadline ',readonly=True),
'partner_address_id': fields.many2one('res.partner.address','Contact Name',readonly=True),
}
def init(self, cr):
@ -142,6 +148,12 @@ class crm_claim_report(osv.osv):
0.0 as perc_cancel,
c.priority as priority,
c.type_id as type_id,
c.date_closed as date_closed,
c.canal_id as canal_id,
c.som as som,
c.create_date as claim_date,
c.date_deadline as deadline_date,
c.partner_address_id as partner_address_id,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
from
@ -149,7 +161,8 @@ class crm_claim_report(osv.osv):
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), \
c.state, c.user_id,c.section_id, c.stage_id,\
c.categ_id,c.partner_id,c.company_id,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
,c.priority,c.type_id,c.som
,c.priority,c.type_id,c.date_closed,c.canal_id,c.som
,c.create_date,c.date_deadline,c.partner_address_id
)""")
crm_claim_report()

View File

@ -24,6 +24,12 @@
<field name="categ_id" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="date_closed" invisible="1"/>
<field name="canal_id" invisible="1"/>
<field name="som" invisible="1"/>
<field name="claim_date" invisible="1"/>
<field name="deadline_date" invisible="1"/>
<field name="partner_address_id" string="Contact Name" invisible="1"/>
</tree>
</field>
</record>
@ -67,121 +73,59 @@
</record>
<!-- CRM Claim Report Search View -->
<record id="view_report_crm_claim_filter" model="ir.ui.view">
<field name="name">crm.claim.report.select</field>
<field name="model">crm.claim.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="8">
<!-- <filter string="This Year" name="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"/>-->
<filter string="This Year" icon="terp-hr"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
<!-- <filter string="This Month" name="This Year" icon="terp-hr"
domain="[('month','=',time.strftime('%%m'))]" />-->
<filter string="This Month" icon="terp-hr" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="gtk-media-rewind" string="7 Days" separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical" />
<filter icon="terp-hr"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-hr"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-hr"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id"
default="context.get('section_id', False)"
widget="selection"
context="{'invisible_section': False}">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My section" />
</field>
<field name="company_id" widget="selection">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="terp-sale"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<separator orientation="vertical"/>
<field name="priority" />
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
</group>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
<data>
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
<group>
<separator orientation="vertical"/>
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<separator orientation="vertical"/>
<field name="priority" />
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
<newline/>
<field name="canal_id" widget="selection" />
<field name="som" widget="selection" />
<separator orientation="vertical"/>
<field name="partner_id" />
<field name="partner_address_id" />
<newline/>
<field name="claim_date" />
<field name="date_closed" />
<field name="deadline_date" />
</group>
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="State"]'
position='after'>
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="Category"]'
position='after'>
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
<separator orientation="vertical"/>
<filter string="Channel" icon="terp-sale" domain="[]"
context="{'group_by':'canal_id'}" />
<filter string="State of Mind" icon="terp-sale" domain="[]"
context="{'group_by':'som'}" />
<newline/>
<filter string="Partner" icon="terp-sale" domain="[]"
context="{'group_by':'partner_id'}" />
<filter string="Contact" icon="terp-sale" domain="[]"
context="{'group_by':'partner_address_id'}" />
</xpath>
</data>
</field>
</record>

View File

@ -28,11 +28,15 @@ class crm_fundraising(osv.osv, crm.crm_case):
_name = "crm.fundraising"
_description = "Fund Raising Cases"
_order = "id desc"
_inherit ='mailgate.thread'
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'id': fields.integer('ID'),
'name': fields.char('Name', size=128, required=True),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'description': fields.text('Description'),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Update Date' , readonly=True),

View File

@ -21,14 +21,7 @@
from osv import fields,osv
import tools
AVAILABLE_STATES = [
('draft','Draft'),
('open','Open'),
('cancel', 'Cancelled'),
('done', 'Closed'),
('pending','Pending')
]
import crm_report
class crm_fundraising_report(osv.osv):
"""CRM Fundraising Report"""
@ -36,7 +29,7 @@ class crm_fundraising_report(osv.osv):
_name = "crm.fundraising.report"
_auto = False
_description = "CRM Fundraising Report"
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@ -90,7 +83,7 @@ class crm_fundraising_report(osv.osv):
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.fundraising')]"),
@ -100,6 +93,13 @@ class crm_fundraising_report(osv.osv):
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'partner_id': fields.many2one('res.partner', 'Partner'),
'company_id': fields.many2one('res.company', 'Company'),
'priority': fields.selection(crm_report.AVAILABLE_PRIORITIES, 'Priority'),
'date_closed': fields.datetime('Closed', readonly=True),
'canal_id': fields.many2one('res.partner.canal','Channel',domain="[('section_id','=',section_id),('object_id.model', '=', 'crm.fundraising')]"),
'som': fields.many2one('res.partner.som', 'State of Mind'),
'type_id': fields.many2one('crm.case.resource.type', 'Fundraising Type', \
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.fundraising')]"),
}
def init(self, cr):
@ -126,6 +126,11 @@ class crm_fundraising_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
c.priority as priority,
c.date_closed as date_closed,
c.canal_id as canal_id,
c.som as som,
c.type_id as type_id,
date_trunc('day',c.create_date) as create_date,
sum(planned_revenue) as amount_revenue,
sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
@ -135,7 +140,8 @@ class crm_fundraising_report(osv.osv):
crm_fundraising c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id,
c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
c.create_date,to_char(c.create_date, 'YYYY-MM-DD'),c.priority,c.date_closed
,c.canal_id,c.som,c.type_id
)""")
crm_fundraising_report()

View File

@ -24,6 +24,11 @@
<field name="state" invisible="1"/>
<field name="categ_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="date_closed" invisible="1"/>
<field name="canal_id" invisible="1"/>
<field name="som" invisible="1"/>
<field name="type_id" invisible="1" string="Payment Mode"/>
</tree>
</field>
@ -72,103 +77,34 @@
<field name="model">crm.fundraising.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="8">
<!-- <filter string="This Year" name="This Year" icon="terp-hr"
domain="[('name','=',time.localtime()[0])]"/>-->
<filter string="This Year" icon="terp-hr"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
<!-- <filter string="This Month" name="This Year" icon="terp-hr"
domain="[('month','=',time.strftime('%%m'))]" />-->
<filter string="This Month" icon="terp-hr" name="This Month"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
<filter icon="gtk-media-rewind" string="7 Days" separator="1"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
<separator orientation="vertical" />
<filter icon="terp-hr"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-hr"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-hr"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical" />
<field name="section_id"
default="context.get('section_id', False)"
widget="selection"
context="{'invisible_section': False}">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id','=',uid)]"
help="My section" />
</field>
<field name="company_id" widget="selection">
<filter icon="terp-crm"
context="{'invisible_section': False}"
domain="[('section_id.user_id.company_id','=',uid)]"
help="My company"/>
</field>
<field name="user_id" select="1" widget="selection">
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale"
string="Done"
domain="[('state','=','done')]"/>
<filter icon="terp-sale"
string="Cancel"
domain="[('state','=','cancel')]"/>
<group>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
</group>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search>
<data>
<xpath expr='//search[@string="Search"]/group[@string="Extended options..."]/filter[@string="Cancel"]' position='after'>
<group>
<separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
<field name="priority"/>
<separator orientation="vertical"/>
<field name="canal_id" widget="selection" />
<field name="som" widget="selection" />
<field name="type_id" widget="selection" string="Payment Mode" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
<newline/>
<field name="date_closed" />
</group>
</xpath>
<xpath
expr='//search[@string="Search"]/group[@string="Group By..."]/filter[@string="Category"]'
position='after'>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<separator orientation="vertical"/>
<filter string="Channel" icon="terp-sale" domain="[]"
context="{'group_by':'canal_id'}" />
<filter string="State of Mind" icon="terp-sale" domain="[]"
context="{'group_by':'som'}" />
<filter string="Payment Mode" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
</xpath>
</data>
</field>
</record>

View File

@ -28,11 +28,15 @@ class crm_helpdesk(osv.osv, crm.crm_case):
_name = "crm.helpdesk"
_description = "Helpdesk Cases"
_order = "id desc"
_inherit = 'mailgate.thread'
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'id': fields.integer('ID', readonly=True),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'description': fields.text('Description'),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Update Date' , readonly=True),

View File

@ -118,7 +118,7 @@
<record model="ir.ui.view" id="view_document_directory_tree">
<field name="name">document.directory</field>
<field name="model">document.directory</field>
<field name="type">tree</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Directories" toolbar="1">
<field name="name"/>

View File

@ -23,32 +23,32 @@
<record model="document.directory.ics.fields" id="dir_field1">
<field name="name">dtstart</field>
<field name="field_id" ref="crm.field_crm_case_create_date"/>
<field name="field_id" ref="crm.field_crm_meeting_create_date"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>
<record model="document.directory.ics.fields" id="dir_field6">
<field name="name">dtend</field>
<field name="field_id" ref="crm.field_crm_case_date_deadline"/>
<field name="field_id" ref="crm.field_crm_meeting_date_deadline"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>
<record model="document.directory.ics.fields" id="dir_field2">
<field name="name">summary</field>
<field name="field_id" ref="crm.field_crm_case_name"/>
<field name="field_id" ref="crm.field_crm_meeting_name"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>
<record model="document.directory.ics.fields" id="dir_field3">
<field name="name">uid</field>
<field name="field_id" ref="field_crm_case_code"/>
<field name="field_id" ref="field_crm_meeting_code"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>
<record model="document.directory.ics.fields" id="dir_field4">
<field name="name">description</field>
<field name="field_id" ref="crm.field_crm_case_description"/>
<field name="field_id" ref="crm.field_crm_meeting_description"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>
<record model="document.directory.ics.fields" id="dir_field5">
<field name="name">url</field>
<field name="field_id" ref="crm.field_crm_case_email_from"/>
<field name="field_id" ref="crm.field_crm_meeting_email_from"/>
<field name="content_id" ref="dir_content_calendar"/>
</record>

View File

@ -45,7 +45,7 @@
<field name="type">form</field>
<field name="inherit_id" ref="crm.crm_case_form_view_meet"/>
<field name="arch" type="xml">
<field name="priority" position="after">
<field name="show_as" position="after">
<field name="code"/>
</field>
</field>

View File

@ -27,23 +27,12 @@ import tools
from tools.translate import _
from crm import crm
class crm_case_log(osv.osv):
_inherit = 'crm.case.log'
_description = 'crm.case.log'
def create(self, cr, uid, vals, *args, **kwargs):
if not 'name' in vals:
vals['name']='Historize'
return super(osv.osv,self).create(cr, uid, vals, *args, **kwargs)
_defaults = {
'user_id': lambda self,cr,uid,context: uid,
}
crm_case_log()
class event_type(osv.osv):
_name = 'event.type'
_description= 'Event type'
_columns = {
'name': fields.char('Event type', size=64, required=True),
'name': fields.char('Event type', size=64, required=True),
}
event_type()
@ -54,58 +43,53 @@ class event(osv.osv):
_order = 'date_begin'
def copy(self, cr, uid, id, default=None, context=None):
return super(event, self).copy(cr, uid,id, default={'code': self.pool.get('ir.sequence').get(cr, uid, 'event.event'),'state':'draft'})
return super(event, self).copy(cr, uid, id, default={'code': self.pool.get('ir.sequence').get(cr, uid, 'event.event'), 'state': 'draft'})
def button_draft(self, cr, uid, ids, context={}):
return self.write(cr, uid, ids, {'state':'draft'})
return self.write(cr, uid, ids, {'state': 'draft'})
def button_cancel(self, cr, uid, ids, context={}):
return self.write(cr, uid, ids, {'state':'cancel'})
return self.write(cr, uid, ids, {'state': 'cancel'})
def button_done(self, cr, uid, ids, context={}):
return self.write(cr, uid, ids, {'state':'done'})
return self.write(cr, uid, ids, {'state': 'done'})
def button_confirm(self, cr, uid, ids, context={}):
for eve in self.browse(cr, uid, ids):
if eve.mail_auto_confirm:
#send reminder that will confirm the event for all the people that were already confirmed
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id','=',eve.id),('state','not in',['draft','cancel'])])
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id', '=', eve.id), ('state', 'not in', ['draft', 'cancel'])])
if reg_ids:
self.pool.get('event.registration').mail_user_confirm(cr, uid, reg_ids)
return self.write(cr, uid, ids, {'state':'confirm'})
return self.write(cr, uid, ids, {'state': 'confirm'})
def _get_register(self, cr, uid, ids, name, args, context=None):
res={}
for event in self.browse(cr, uid, ids, context):
query = """select sum(nb_register) from crm_case c left join crm_case_section s on (c.section_id=s.id) right join event_event e on (e.section_id=s.id) right join event_registration r on (r.case_id=c.id) where e.section_id = %s and c.state in ('open','done')"""
cr.execute(query,(event.section_id.id,))
res[event.id] = {}
state = 'draft'
if name[0] == 'register_current':
state = 'open'
query = """SELECT sum(r.nb_register)
from event_registration r
where state=%s and event_id=%s"""
cr.execute(query, (state, event.id, ))
res2 = cr.fetchone()
if res2 and res2[0]:
res[event.id] = res2[0]
res[event.id][name[0]] = res2[0]
else:
res[event.id] = 0
res[event.id][name[0]] = 0
return res
def _get_prospect(self, cr, uid, ids, name, args, context=None):
res={}
for event in self.browse(cr, uid, ids, context):
query = """select sum(nb_register) from crm_case c left join crm_case_section s on (c.section_id=s.id) right join event_event e on (e.section_id=s.id) right join event_registration r on (r.case_id=c.id) where e.section_id = %s and c.state = 'draft'"""
cr.execute(query,(event.section_id.id,))
res2 = cr.fetchone()
if res2 and res2[0]:
res[event.id] = res2[0]
else:
res[event.id] = 0
return res
def write(self, cr, uid, ids,vals, *args, **kwargs):
res = super(event,self).write(cr, uid, ids,vals, *args, **kwargs)
def write(self, cr, uid, ids, vals, *args, **kwargs):
res = super(event, self).write(cr, uid, ids, vals, *args, **kwargs)
if 'date_begin' in vals and vals['date_begin']:
for eve in self.browse(cr, uid, ids):
#change the deadlines of the registration linked to this event
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id','=',eve.id)])
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id', '=', eve.id)])
if reg_ids:
self.pool.get('event.registration').write(cr, uid, reg_ids, {'date_deadline':vals['date_begin']})
self.pool.get('event.registration').write(cr, uid, reg_ids, {'date_deadline': vals['date_begin']})
#change the description of the registration linked to this event
if 'mail_auto_confirm' in vals:
@ -117,36 +101,36 @@ class event(osv.osv):
vals['mail_confirm']=False
if 'mail_confirm' in vals:
for eve in self.browse(cr, uid, ids):
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id','=',eve.id)])
reg_ids = self.pool.get('event.registration').search(cr, uid, [('event_id', '=', eve.id)])
if reg_ids:
self.pool.get('event.registration').write(cr, uid, reg_ids, {'description':vals['mail_confirm']})
self.pool.get('event.registration').write(cr, uid, reg_ids, {'description': vals['mail_confirm']})
return res
_columns = {
'type': fields.many2one('event.type', 'Type'),
'section_id': fields.many2one('crm.case.section', 'Case section', required=True),
'register_max': fields.integer('Maximum Registrations'),
'register_min': fields.integer('Minimum Registrations'),
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations'),
'register_prospect': fields.function(_get_prospect, method=True, string='Unconfirmed Registrations'),
'date_begin': fields.datetime('Beginning date', required=True),
'date_end': fields.datetime('Ending date', required=True),
'state': fields.selection([('draft','Draft'),('confirm','Confirmed'),('done','Done'),('cancel','Cancelled')], 'State', readonly=True, required=True,
'type': fields.many2one('event.type', 'Type'),
'section_id': fields.many2one('crm.case.section', 'Case section', required=True),
'register_max': fields.integer('Maximum Registrations'),
'register_min': fields.integer('Minimum Registrations'),
'register_current': fields.function(_get_register, method=True, string='Confirmed Registrations', multi='register_current'),
'register_prospect': fields.function(_get_register, method=True, string='Unconfirmed Registrations', multi='register_prospect'),
'date_begin': fields.datetime('Beginning date', required=True),
'date_end': fields.datetime('Ending date', required=True),
'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled')], 'State', readonly=True, required=True,
help='If event is created, the state is \'Draft\'.\n If event is confirmed for the particular dates the state is set to \'Confirmed\'.\
\nIf the event is over, the state is set to \'Done\'.\n If event is cancelled the state is set to \'Cancelled\'.'),
'mail_auto_registr':fields.boolean('Mail Auto Register',help='Check this box if you want to use the automatic mailing for new registration'),
'mail_auto_confirm':fields.boolean('Mail Auto Confirm',help='Check this box if you want ot use the automatic confirmation emailing or the reminder'),
'mail_registr':fields.text('Registration Email',help='This email will be sent when someone subscribes to the event.'),
'mail_confirm': fields.text('Confirmation Email', help="This email will be sent when the event gets confimed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."),
'product_id':fields.many2one('product.product','Product', required=True),
\nIf the event is over, the state is set to \'Done\'.\n If event is cancelled the state is set to \'Cancelled\'.'),
'mail_auto_registr': fields.boolean('Mail Auto Register', help='Check this box if you want to use the automatic mailing for new registration'),
'mail_auto_confirm': fields.boolean('Mail Auto Confirm', help='Check this box if you want ot use the automatic confirmation emailing or the reminder'),
'mail_registr': fields.text('Registration Email', help='This email will be sent when someone subscribes to the event.'),
'mail_confirm': fields.text('Confirmation Email', help="This email will be sent when the event gets confimed or when someone subscribes to a confirmed event. This is also the email sent to remind someone about the event."),
'product_id': fields.many2one('product.product', 'Product', required=True),
}
_defaults = {
'state': lambda *args: 'draft',
'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'event.event'),
'user_id': lambda self,cr,uid,ctx: uid,
'state': lambda *args: 'draft',
'code': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'event.event'),
'user_id': lambda self, cr, uid, ctx: uid,
}
event()
class event_registration(osv.osv):
@ -156,48 +140,45 @@ class event_registration(osv.osv):
current_registration = self.browse(cr, uid, [ids[0]])[0]
total_confirmed = current_registration.event_id.register_current + current_registration.nb_register
if total_confirmed <= current_registration.event_id.register_max or current_registration.event_id.register_max == 0:
self.write(cr, uid, [ids[0]], {'state':'open'}, context=context)
self.write(cr, uid, [ids[0]], {'state': 'open'}, context=context)
self._history(cr, uid, [ids[0]], 'Open', history=True)
self.mail_user(cr, uid, [ids[0]])
return True
else:
model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_event_confirm_registration')], context=context)
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_event_confirm_registration')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
context.update({'reg_id': ids[0]})
return {
'name': _('Confirm Registration'),
'context': context,
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.confirm.registration',
'views': [(resource_id,'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'name': _('Confirm Registration'),
'context': context,
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'event.confirm.registration',
'views': [(resource_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
'nodestroy': True
}
def _history(self, cr, uid,ids,keyword, history=False, email=False, context={}):
def _history(self, cr, uid, ids, keyword, history=False, email=False, context={}):
for case in self.browse(cr, uid, ids):
if not case.case_id:
return True
data = {
'name': keyword,
'som': case.som.id,
'canal_id': case.canal_id.id,
'user_id': uid,
'case_id': case.case_id.id
'name': keyword,
'som': case.som.id,
'canal_id': case.canal_id.id,
'user_id': uid,
}
obj = self.pool.get('crm.case.log')
obj.create(cr, uid, data, context)
obj = self.pool.get('mailgate.message')
obj.create(cr, uid, data, context=context)
return True
def button_reg_close(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state':'done',})
self.write(cr, uid, ids, {'state': 'done', })
self._history(cr, uid, ids, 'Done', history=True)
return True
def button_reg_cancel(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state':'cancel',})
self.write(cr, uid, ids, {'state': 'cancel', })
self._history(cr, uid, ids, 'Cancel', history=True)
return True
@ -207,7 +188,7 @@ class event_registration(osv.osv):
args[0]['date_deadline']= event.date_begin
args[0]['description']= event.mail_confirm
res = super(event_registration, self).create(cr, uid, *args, **argv)
self._history(cr, uid,[res], 'Created', history=True)
self._history(cr, uid, [res], 'Created', history=True)
return res
def write(self, cr, uid, *args, **argv):
@ -228,7 +209,7 @@ class event_registration(osv.osv):
if reg_id.email_cc:
dest += [reg_id.email_cc]
if dest and src:
tools.email_send(src, dest,'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.case_id.id))
tools.email_send(src, dest, 'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.id))
if not src:
raise osv.except_osv(_('Error!'), _('You must define a reply-to address in order to mail the participant. You can do this in the Mailing tab of your event. Note that this is also the place where you can configure your event to not send emails automaticly while registering'))
return False
@ -244,49 +225,50 @@ class event_registration(osv.osv):
dest += [reg_id.email_cc]
if reg_id.event_id.mail_auto_confirm or reg_id.event_id.mail_auto_registr:
if dest and src:
if reg_id.event_id.state in ['draft', 'fixed', 'open','confirm','running'] and reg_id.event_id.mail_auto_registr:
tools.email_send(src, dest,'Auto Registration: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_registr, openobject_id = str(reg_id.case_id.id))
if (reg_id.event_id.state in ['confirm','running']) and reg_id.event_id.mail_auto_confirm:
tools.email_send(src, dest,'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.case_id.id))
if reg_id.event_id.state in ['draft', 'fixed', 'open', 'confirm', 'running'] and reg_id.event_id.mail_auto_registr:
tools.email_send(src, dest, 'Auto Registration: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_registr, openobject_id = str(reg_id.id))
if (reg_id.event_id.state in ['confirm', 'running']) and reg_id.event_id.mail_auto_confirm:
tools.email_send(src, dest, 'Auto Confirmation: '+'['+str(reg_id.id)+']'+' '+reg_id.name, reg_id.event_id.mail_confirm, openobject_id = str(reg_id.id))
if not src:
raise osv.except_osv(_('Error!'), _('You must define a reply-to address in order to mail the participant. You can do this in the Mailing tab of your event. Note that this is also the place where you can configure your event to not send emails automaticly while registering'))
return False
def _create_invoice_lines(self, cr, uid, ids, vals):
return self.pool.get('account.invoice.line').create(cr, uid,vals )
return self.pool.get('account.invoice.line').create(cr, uid, vals)
_name= 'event.registration'
_description = 'Event Registration'
_inherits = {'crm.case': 'case_id'}
_inherit = 'crm.meeting'
_columns = {
'case_id':fields.many2one('crm.case','Case'),
'nb_register': fields.integer('Number of Registration', readonly=True, states={'draft':[('readonly',False)]}),
'event_id':fields.many2one('event.event', 'Event Related', required=True),
"partner_invoice_id":fields.many2one('res.partner', 'Partner Invoiced'),
"contact_id":fields.many2one('res.partner.contact', 'Partner Contact'), #TODO: filter only the contacts that have a function into the selected partner_id
"unit_price": fields.float('Unit Price'),
"badge_title":fields.char('Badge Title',size=128),
"badge_name":fields.char('Badge Name',size=128),
"badge_partner":fields.char('Badge Partner',size=128),
"invoice_label":fields.char("Label Invoice",size=128,required=True),
"tobe_invoiced":fields.boolean("To be Invoiced"),
"invoice_id":fields.many2one("account.invoice","Invoice"),
'date_closed': fields.datetime('Closed', readonly=True),
'ref' : fields.reference('Reference', selection=crm._links_get, size=128),
'ref2' : fields.reference('Reference 2', selection=crm._links_get, size=128),
'categ_id': fields.many2one('crm.case.categ','Category', domain="[('section_id','=',section_id)]"),
'canal_id': fields.many2one('res.partner.canal', 'Channel',help="The channels represent the different communication modes available with the customer." \
" With each commercial opportunity, you can indicate the canall which is this opportunity source."),
'email_cc': fields.text('Watchers Emails', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'nb_register': fields.integer('Number of Registration', readonly=True, states={'draft': [('readonly', False)]}),
'event_id': fields.many2one('event.event', 'Event Related', required=True),
"partner_invoice_id": fields.many2one('res.partner', 'Partner Invoiced'),
"contact_id": fields.many2one('res.partner.contact', 'Partner Contact'), #TODO: filter only the contacts that have a function into the selected partner_id
"unit_price": fields.float('Unit Price'),
"badge_title": fields.char('Badge Title', size=128),
"badge_name": fields.char('Badge Name', size=128),
"badge_partner": fields.char('Badge Partner', size=128),
"invoice_label": fields.char("Label Invoice", size=128, required=True),
"tobe_invoiced": fields.boolean("To be Invoiced"),
"invoice_id": fields.many2one("account.invoice", "Invoice"),
'date_closed': fields.datetime('Closed', readonly=True),
'ref': fields.reference('Reference', selection=crm._links_get, size=128),
'ref2': fields.reference('Reference 2', selection=crm._links_get, size=128),
'canal_id': fields.many2one('res.partner.canal', 'Channel', help="The channels represent the different communication modes available with the customer." \
" With each commercial opportunity, you can indicate the canall which is this opportunity source."),
'som': fields.many2one('res.partner.som', 'State of Mind', help="The minds states allow to define a value scale which represents" \
"the partner mentality in relation to our services.The scale has" \
"to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."),
"to be created with a factor for each level from 0 (Very dissatisfied) to 10 (Extremely satisfied)."),
}
_defaults = {
'nb_register': lambda *a: 1,
'tobe_invoiced' : lambda *a: True,
'name': lambda *a: 'Registration',
'state': lambda *b: 'draft'
'nb_register': lambda *a: 1,
'tobe_invoiced': lambda *a: True,
'name': lambda *a: 'Registration',
}
def onchange_badge_name(self, cr, uid, ids, badge_name):
@ -294,7 +276,7 @@ class event_registration(osv.osv):
if not badge_name:
return data
data['name'] = 'Registration: ' + badge_name
return {'value':data}
return {'value': data}
def onchange_contact_id(self, cr, uid, ids, contact, partner):
data ={}
@ -304,109 +286,76 @@ class event_registration(osv.osv):
data['badge_name'] = contact_id.name
data['badge_title'] = contact_id.title
if partner:
partner_addresses = self.pool.get('res.partner.address').search(cr, uid, [('partner_id','=',partner)])
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('contact_id','=',contact),('address_id','in',partner_addresses)])
partner_addresses = self.pool.get('res.partner.address').search(cr, uid, [('partner_id', '=', partner)])
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('contact_id', '=', contact), ('address_id', 'in', partner_addresses)])
if job_ids:
data['email_from'] = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0]).email
d = self.onchange_badge_name(cr, uid, ids,data['badge_name'])
d = self.onchange_badge_name(cr, uid, ids, data['badge_name'])
data.update(d['value'])
return {'value':data}
return {'value': data}
def onchange_event(self, cr, uid, ids, event_id, partner_invoice_id):
context={}
if not event_id:
return {'value':{'unit_price' : False ,'invoice_label' : False }}
data_event = self.pool.get('event.event').browse(cr,uid,event_id)
return {'value': {'unit_price': False , 'invoice_label': False }}
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
if data_event.product_id:
if not partner_invoice_id:
unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id],context=context)[data_event.product_id.id]
return {'value':{'unit_price' : unit_price , 'invoice_label' : data_event.product_id.name}}
data_partner = self.pool.get('res.partner').browse(cr,uid,partner_invoice_id)
context.update({'partner_id':data_partner})
unit_price = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist':data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value':{'unit_price' :unit_price , 'invoice_label' : data_event.product_id.name}}
return {'value':{'unit_price' : False,'invoice_label' : False}}
unit_price=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
return {'value': {'unit_price': unit_price , 'invoice_label': data_event.product_id.name}}
data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id)
context.update({'partner_id': data_partner})
unit_price = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value': {'unit_price': unit_price , 'invoice_label': data_event.product_id.name}}
return {'value': {'unit_price': False, 'invoice_label': False}}
def onchange_partner_id(self, cr, uid, ids, part, event_id, email=False):
data={}
data['badge_partner'] = data['contact_id'] = data['partner_invoice_id'] = data['email_from'] = data['badge_title'] = data['badge_name'] = False
if not part:
return {'value':data}
return {'value': data}
data['partner_invoice_id']=part
# this calls onchange_partner_invoice_id
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id,part)
d = self.onchange_partner_invoice_id(cr, uid, ids, event_id, part)
# this updates the dictionary
data.update(d['value'])
addr = self.pool.get('res.partner').address_get(cr, uid, [part])
if addr:
if addr.has_key('default'):
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('address_id','=',addr['default'])])
job_ids = self.pool.get('res.partner.job').search(cr, uid, [('address_id', '=', addr['default'])])
if job_ids:
data['contact_id'] = self.pool.get('res.partner.job').browse(cr, uid, job_ids[0]).contact_id.id
d = self.onchange_contact_id(cr, uid, ids, data['contact_id'],part)
d = self.onchange_contact_id(cr, uid, ids, data['contact_id'], part)
data.update(d['value'])
partner_data = self.pool.get('res.partner').browse(cr, uid, part)
data['badge_partner'] = partner_data.name
return {'value':data}
return {'value': data}
def onchange_partner_invoice_id(self, cr, uid, ids, event_id, partner_invoice_id):
data={}
context={}
data['unit_price']=False
if not event_id:
return {'value':data}
data_event = self.pool.get('event.event').browse(cr,uid,event_id)
return {'value': data}
data_event = self.pool.get('event.event').browse(cr, uid, event_id)
if data_event.product_id:
if not partner_invoice_id:
data['unit_price']=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id],context=context)[data_event.product_id.id]
return {'value':data}
data_partner = self.pool.get('res.partner').browse(cr,uid,partner_invoice_id)
context.update({'partner_id':data_partner})
data['unit_price'] = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist':data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value':data}
return {'value':data}
data['unit_price']=self.pool.get('product.product').price_get(cr, uid, [data_event.product_id.id], context=context)[data_event.product_id.id]
return {'value': data}
data_partner = self.pool.get('res.partner').browse(cr, uid, partner_invoice_id)
context.update({'partner_id': data_partner})
data['unit_price'] = self.pool.get('product.product')._product_price(cr, uid, [data_event.product_id.id], False, False, {'pricelist': data_partner.property_product_pricelist.id})[data_event.product_id.id]
return {'value': data}
return {'value': data}
def onchange_categ_id(self, cr, uid, ids, categ, context={}):
if not categ:
return {'value':{}}
return {'value': {}}
cat = self.pool.get('crm.case.categ').browse(cr, uid, categ, context).probability
return {'value':{'probability':cat}}
def _map_ids(self,method,cr, uid, ids, *args, **argv):
case_data = self.browse(cr,uid,ids)
new_ids=[]
for case in case_data:
if case.case_id:
new_ids.append(case.case_id.id)
return getattr(self.pool.get('crm.case'),method)(cr, uid, new_ids, *args, **argv)
def case_close(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_close',cr,uid,ids,*args,**argv)
def case_escalate(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_escalate',cr,uid,ids,*args,**argv)
def case_open(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_open',cr,uid,ids,*args,**argv)
def case_cancel(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_cancel',cr,uid,ids,*args,**argv)
def case_pending(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_pending',cr,uid,ids,*args,**argv)
def case_reset(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_reset',cr,uid,ids,*args,**argv)
def case_log(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_log',cr,uid,ids,*args,**argv)
def case_log_reply(self,cr, uid, ids, *args, **argv):
return self._map_ids('case_log_reply',cr,uid,ids,*args,**argv)
def add_reply(self,cr, uid, ids, *args, **argv):
return self._map_ids('add_reply',cr,uid,ids,*args,**argv)
def remind_partner(self,cr, uid, ids, *args, **argv):
return self._map_ids('remind_partner',cr,uid,ids,*args,**argv)
def remind_user(self,cr, uid, ids, *args, **argv):
return self._map_ids('remind_user',cr,uid,ids,*args,**argv)
return {'value': {'probability': cat}}
event_registration()
@ -417,12 +366,12 @@ class report_event_registration(osv.osv):
_description = "Events on registrations"
_auto = False
_columns = {
'name': fields.char('Event',size=20),
'date_begin': fields.datetime('Beginning date', required=True),
'date_end': fields.datetime('Ending date', required=True),
'draft_state': fields.integer('Draft Registration',size=20),
'confirm_state': fields.integer('Confirm Registration',size=20),
'register_max': fields.integer('Maximum Registrations'),
'name': fields.char('Event', size=20),
'date_begin': fields.datetime('Beginning date', required=True),
'date_end': fields.datetime('Ending date', required=True),
'draft_state': fields.integer('Draft Registration', size=20),
'confirm_state': fields.integer('Confirm Registration', size=20),
'register_max': fields.integer('Maximum Registrations'),
}
def init(self, cr):
cr.execute("""
@ -432,8 +381,8 @@ class report_event_registration(osv.osv):
c.name as name,
e.date_begin as date_begin,
e.date_end as date_end,
(SELECT sum(nb_register) FROM event_registration x , crm_case c WHERE x.case_id=c.id and c.section_id=e.section_id and state in ('draft')) as draft_state,
(SELECT sum(nb_register) FROM event_registration x , crm_case c WHERE x.case_id=c.id and c.section_id=e.section_id and state in ('open')) as confirm_state,
(SELECT sum(c.nb_register) FROM event_registration c WHERE c.section_id=e.section_id and state in ('draft')) as draft_state,
(SELECT sum(c.nb_register) FROM event_registration c WHERE c.section_id=e.section_id and state in ('open')) as confirm_state,
e.register_max as register_max
from
event_event e,crm_case_section c
@ -448,19 +397,21 @@ class report_event_type_registration(osv.osv):
_description = "Event type on registration"
_auto = False
_columns = {
'name': fields.char('Event Type',size=20),
'nbevent':fields.integer('Number Of Events'),
'draft_state': fields.integer('Draft Registrations',size=20),
'confirm_state': fields.integer('Confirm Registrations',size=20),
'name': fields.char('Event Type', size=20),
'nbevent': fields.integer('Number Of Events'),
'draft_state': fields.integer('Draft Registrations', size=20),
'confirm_state': fields.integer('Confirm Registrations', size=20),
}
def init(self, cr):
cr.execute("""
create or replace view report_event_type_registration as (
select
count(t.id) as id,
t.name as name,
(select sum(nb_register) from event_registration r , crm_case c , event_event e where c.section_id=e.section_id and r.case_id=c.id and c.state='draft' and e.type=t.id ) as draft_state ,
(select sum(nb_register) from event_registration r , crm_case c , event_event e where c.section_id=e.section_id and r.case_id=c.id and c.state='open' and e.type=t.id ) as confirm_state,
(select sum(c.nb_register) from event_registration c, event_event e where c.section_id=e.section_id and c.state='draft' and e.type=t.id ) as draft_state ,
(select sum(c.nb_register) from event_registration c, event_event e where c.section_id=e.section_id and c.state='open' and e.type=t.id ) as confirm_state,
count(t.id) as nbevent
from
event_event e

View File

@ -33,8 +33,8 @@
<field name="res_model">event.type</field>
<field name="view_type">form</field>
</record>
<menuitem name="Configuration" id="menu_event_config" parent="menu_marketing_event_main" sequence="30"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="menu_event_config"/>
<menuitem name="Configuration" id="menu_event_config" parent="menu_marketing_event_main" sequence="30" groups="base.group_extended"/>
<menuitem name="Types of Events" id="menu_event_type" action="action_event_type" parent="menu_event_config" groups="base.group_extended,crm.group_crm_manager"/>
<!-- The base section for all events -->
@ -221,23 +221,26 @@
<field name="ref2" colspan="4"/>
</page>
<page string="History">
<field name="history_line" colspan="4" nolabel="1" mode="tree,form">
<form string="Communication history">
<field name="date"/>
<field name="som"/>
<newline/>
<field name="canal_id"/>
<field name="email"/>
<newline/>
<field name="description" colspan="4"/>
</form>
<tree string="Communication history">
<field name="date"/>
<field name="description"/>
<field name="som"/>
<field name="user_id"/>
<field name="canal_id"/>
</tree>
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<field name="log_ids" nolabel="1" colspan="4" mode="tree,form" readonly="1">
<tree string="Actions">

View File

@ -2,11 +2,11 @@
<openerp>
<data>
<record id="menu_event_config" model="ir.ui.menu">
<field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager')])]"/>
<field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager'), ref('base.group_extended')])]"/>
</record>
<record id="menu_report_event" model="ir.ui.menu">
<field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager')])]"/>
<field name="groups_id" eval="[(6,0,[ref('crm.group_crm_manager'), ref('base.group_extended')])]"/>
</record>
</data>
</openerp>

View File

@ -27,21 +27,23 @@ class event_confirm_registration(osv.osv_memory):
"""
_name = "event.confirm.registration"
_description = "Event Registraion"
_columns = {
'msg': fields.text('Message', readonly=True),
'msg': fields.text('Message', readonly=True),
}
_defaults={
'msg':lambda *a:'The event limit is reached. What do you want to do?'
'msg':lambda *a:'The event limit is reached. What do you want to do?'
}
def confirm(self, cr, uid, ids, context):
registration_obj = self.pool.get('event.registration')
reg_id = context.get('reg_id', False) or context.get('active_id', False)
if reg_id:
registration_obj.write(cr, uid, [reg_id], {'state':'open',})
registration_obj.write(cr, uid, [reg_id], {'state':'open', })
registration_obj._history(cr, uid, [reg_id], 'Open', history=True)
registration_obj.mail_user(cr,uid,[reg_id])
registration_obj.mail_user(cr, uid, [reg_id])
return {}
event_confirm_registration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -36,10 +36,8 @@ class event_registration_list(osv.osv_memory):
'type': 'ir.actions.act_window'
}
cr.execute('SELECT section_id FROM event_event WHERE id = %s', (context['active_id'],))
res = cr.fetchone()
return {
'domain': [('section_id', '=', res[0])],
'domain': [('section_id', '=', context['active_id'])],
'name': 'Event Registrations',
'view_type': 'form',
'view_mode': 'tree,form',

View File

@ -45,9 +45,13 @@ class hr_expense_report(osv.osv):
'department_id':fields.many2one('hr.department','Department',readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
'price_total':fields.float('Total Price', readonly=True),
'analytic_account': fields.many2one('account.analytic.account','Analytic account',readonly=True),
'price_average':fields.float('Average Price', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'no_of_products':fields.integer('# of Products', readonly=True),
'no_of_account':fields.integer('# of Accounts', readonly=True),
'state': fields.selection([
('draft', 'Draft'),
('confirm', 'Waiting confirmation'),
@ -67,6 +71,7 @@ class hr_expense_report(osv.osv):
date_trunc('day',s.create_date) as date,
s.employee_id,
s.journal_id,
s.currency_id,
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm,
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid,
s.invoice_id,
@ -75,27 +80,33 @@ class hr_expense_report(osv.osv):
to_char(date_trunc('day',s.create_date), 'MM') as month,
to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD') as day,
l.product_id as product_id,
l.analytic_account as analytic_account,
sum(l.unit_quantity * u.factor) as product_qty,
s.user_id as user_id,
s.company_id as company_id,
sum(l.unit_quantity*l.unit_amount) as price_total,
(sum(l.unit_quantity*l.unit_amount)/sum(l.unit_quantity * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
(select unit_quantity from hr_expense_line where id=l.id and product_id is not null) as no_of_products,
(select count(analytic_account) from hr_expense_line where id=l.id and analytic_account is not null) as no_of_account,
s.state
from
hr_expense_line l
left join
hr_expense_expense s on (s.id=l.expense_id)
left join product_uom u on (u.id=l.uom_id)
from hr_expense_line l
left join hr_expense_expense s on (s.id=l.expense_id)
left join product_uom u on (u.id=l.uom_id)
group by
date_trunc('day',s.create_date),
to_char(date_trunc('day',s.create_date), 'YYYY'),
to_char(date_trunc('day',s.create_date), 'MM'),
to_char(date_trunc('day',s.create_date), 'YYYY-MM-DD'),
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY'),
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY'),
l.product_id,
l.analytic_account,
s.invoice_id,
s.currency_id,
s.department_id,
l.uom_id,
l.id,
s.user_id,
s.state,
s.journal_id,

View File

@ -14,12 +14,16 @@
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="invoice_id" invisible="1"/>
<field name="analytic_account" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_qty" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="no_of_products" sum="# of Products"/>
<field name="no_of_account" sum="# of Accounts"/>
<field name="price_average" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="state" invisible="1"/>
@ -47,7 +51,7 @@
<field name="arch" type="xml">
<search string="Expenses">
<group>
<filter icon="terp-hr" string="This Year"
<filter icon="terp-hr" string="Last 365 Days"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Expenses during last 7 year"/>
<filter icon="terp-hr" string="This Month"
@ -79,6 +83,8 @@
help="Expenses Non Assigned User"
domain="[('user_id','=',False)]"/>
</field>
<field name="product_id"/>
<field name="employee_id" widget="selection"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
@ -95,13 +101,11 @@
domain="[('state','=','cancelled')]"
help = "Cancelled Expenses"/>
<separator orientation="vertical"/>
<field name="employee_id" widget="selection"/>
<field name="product_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<newline/>
<field name="journal_id" widget="selection"/>
<field name="currency_id" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<separator orientation="vertical"/>
<newline/>
<field name="date_confirm"/>
<field name="date_valid"/>
</group>
@ -111,13 +115,16 @@
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Analytic account" icon="terp-hr" context="{'group_by':'analytic_account'}"/>
<filter string="Currency" icon="terp-hr" context="{'group_by':'currency_id'}"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<filter string="Force Journal" icon="terp-hr" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search>

View File

@ -25,8 +25,9 @@ class available_holidays_report(osv.osv):
_name = "available.holidays.report"
_auto = False
_columns = {
'date': fields.datetime('Date', readonly=True),
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=15, 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),
@ -35,6 +36,7 @@ class available_holidays_report(osv.osv):
'max_leave': fields.float('Allocated Leaves', readonly=True),
'taken_leaves': fields.float('Taken Leaves', readonly=True),
'remaining_leave': fields.float('Remaining Leaves',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
}
def init(self, cr):
@ -46,8 +48,10 @@ class available_holidays_report(osv.osv):
date_trunc('day',h.create_date) as date,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
h.employee_id as employee_id,
h.user_id as user_id,
h.department_id,
h.state as state,
h.holiday_status_id as holiday_status_id,
sum(number_of_days) as remaining_leave,
@ -68,7 +72,8 @@ class available_holidays_report(osv.osv):
and s.active <> 'f'
group by h.holiday_status_id, h.employee_id,
date_trunc('day',h.create_date),to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),h.user_id,h.state
to_char(s.create_date, 'MM'),to_char(s.create_date, 'YYYY-MM-DD'),h.user_id,
h.state,h.department_id
)""")
available_holidays_report()

View File

@ -10,40 +10,32 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Available Holidays">
<field name="employee_id"/>
<field name="holiday_status_id"/>
<field name="max_leave"/>
<field name="taken_leaves"/>
<field name="employee_id" invisible="1"/>
<field name="holiday_status_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="max_leave" sum="Allocated Leaves"/>
<field name="taken_leaves" sum="Taken Leaves"/>
<field name="user_id" invisible="1"/>
<field name="remaining_leave"/>
<field name="remaining_leave" sum="Remaining Leaves"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="date" invisible="1"/>
</tree>
</field>
</record>
<record id="view_hr_available_holidays_report_form" model="ir.ui.view">
<field name="name">available.holidays.report.form</field>
<field name="model">available.holidays.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<tree string="Available Holidays">
<field name="employee_id" select="1"/>
<field name="holiday_status_id" select="1"/>
<field name="remaining_leave"/>
</tree>
</field>
</record>
<record id="view_hr_available_holidays_report_graph" model="ir.ui.view">
<field name="name">available.holidays.report.graph</field>
<field name="model">available.holidays.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="horizontal" string="Available Holidays" type="bar">
<field name="holiday_status_id"/>
<field name="employee_id"/>
<field name="max_leave" operator="+"/>
<field name="taken_leaves" operator="+"/>
<field name="remaining_leave" operator="+"/>
<field group="True" name="employee_id"/>
<field group="True" name="holiday_status_id"/>
</graph>
</field>
</record>
@ -55,27 +47,47 @@
<field name="arch" type="xml">
<search string="Leaves">
<group>
<filter icon="terp-hr"
string="This Year"
domain="[('year','=',time.strftime('%%Y'))]"
help="Leaves of the year"/>
<filter icon="terp-hr"
string="This Month"
domain="[('month','=',time.strftime('%%m'))]"
help="Leaves of this month"/>
<filter icon="terp-hr" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
<filter icon="terp-hr" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this month"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Leaves during last 7 days"/>
<separator orientation="vertical"/>
<<<<<<< TREE
<field name="employee_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-hr"
string="My Leaves"
domain="[('user_id','=',uid)]"/>
</field>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<field name="holiday_status_id" widget="selection"/>
<field name="department_id" widget="selection"/>
=======
<field name="employee_id"/>
<field name="user_id" widget="selection"/>
>>>>>>> MERGE-SOURCE
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Type" icon="terp-hr" context="{'group_by':'holiday_status_id'}"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-sale" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-sale" context="{'group_by':'year'}"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search>
</field>
@ -88,7 +100,7 @@
<field name="res_model">available.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_id" ref="view_hr_available_holidays_report_search"/>
</record>

View File

@ -28,16 +28,19 @@ class hr_holidays_report(osv.osv):
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.datetime('Date', readonly=True),
'date': fields.date('Date', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'day': fields.char('Day', size=15, 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),
'date_from' : fields.datetime('Start Date', readonly=True),
'date_to' : fields.datetime('End Date', readonly=True),
'number_of_days_temp': fields.float('Number of Days', readonly=True),
'date_from' : fields.date('Start Date', readonly=True),
'date_to' : fields.date('End Date', readonly=True),
'number_of_days_temp': fields.float('#Days', readonly=True),
'employee_id' : fields.many2one('hr.employee', "Employee's Name",readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'holiday_status_id' : fields.many2one("hr.holidays.status", "Leave Type",readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'state': fields.selection([('draft', 'Draft'),
('confirm', 'Waiting Validation'),
('refuse', 'Refused'),
@ -52,14 +55,17 @@ class hr_holidays_report(osv.osv):
create or replace view hr_holidays_report as (
select
min(s.id) as id,
date_trunc('seconds',s.create_date) as date,
date_trunc('day',s.create_date) as date,
date_trunc('day',s.date_from) as date_from,
date_trunc('day',s.date_to) as date_to,
s.number_of_days_temp,
sum(s.number_of_days_temp) as number_of_days_temp,
s.employee_id,
s.user_id as user_id,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
s.holiday_status_id,
s.department_id,
s.state
from
hr_holidays s
@ -67,7 +73,8 @@ class hr_holidays_report(osv.osv):
s.employee_id is not null
group by
s.create_date,s.state,s.date_from,s.date_to,
s.number_of_days_temp,s.employee_id,s.user_id
s.employee_id,s.user_id,s.holiday_status_id,
s.department_id
)
""")
hr_holidays_report()

View File

@ -7,14 +7,18 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Leaves Statistics">
<field name="date"/>
<field name="employee_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="number_of_days_temp"/>
<field name="date" invisible="1"/>
<field name="employee_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="number_of_days_temp" sum="#Days"/>
<field name="holiday_status_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="state"/>
<field name="state" invisible="1"/>
</tree>
</field>
</record>
@ -27,6 +31,7 @@
<graph string="Leaves Statistics" type="bar">
<field name="employee_id"/>
<field name="number_of_days_temp" operator="+"/>
<field name="state" group = "True"/>
</graph>
</field>
</record>
@ -37,40 +42,71 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Leaves">
<filter icon="terp-hr"
string="This Year"
domain="[('year','=',time.strftime('%%Y'))]"
help="Leaves of the year"/>
<filter icon="terp-hr"
string="This Month"
domain="[('month','=',time.strftime('%%m'))]"
help="Leaves of this month"/>
<separator orientation="vertical"/>
<filter icon="terp-hr"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-hr"
string="Validate"
domain="[('state','=','validate')]"/>
<filter icon="terp-hr"
string="Start Leaves"
domain="[('date_from','=',time.strftime('%%Y/%%m/%%d'))]"/>
<filter icon="terp-hr"
string="End Leaves"
domain="[('date_to','=',time.strftime('%%Y/%%m/%%d'))]"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="user_id" widget="selection"/>
<field name="date"/>
<group>
<filter icon="terp-hr" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this year"/>
<filter icon="terp-hr" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Leaves in this month"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Leaves during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-hr"
domain="[('state','=','draft')]"
help = "Draft Leaves"/>
<filter string="Waiting Validation"
icon="terp-hr"
domain="[('state', '=' ,'confirm')]"
help = "In progress Leaves"/>
<filter string="Validated"
icon="terp-hr"
domain="[('state','=','validate')]"
help = "Pending Leaves"/>
<separator orientation="vertical"/>
<field name="employee_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-hr"
string="My Leaves"
domain="[('user_id','=',uid)]"/>
</field>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr"
string="Refused"
name="done"
domain="[('state','=','refuse')]"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<separator orientation="vertical"/>
<field name="holiday_status_id" widget="selection"/>
<newline/>
<filter icon="terp-hr"
string="Cancelled"
domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="date_to"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Employee" name="employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Employee" name="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Type" icon="terp-hr" context="{'group_by':'holiday_status_id'}"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-sale" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-sale" context="{'group_by':'year'}"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search>
</field>
@ -81,7 +117,7 @@
<field name="res_model">hr.holidays.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_employee': 1, "search_default_user_id":uid}</field>
<field name="context">{'search_default_month':1,'search_default_Employee':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_hr_holidays_report_search"/>
</record>

View File

@ -57,11 +57,13 @@ class hr_applicant(osv.osv, crm.crm_case):
_name = "hr.applicant"
_description = "Applicant"
_order = "id desc"
_inherit ='mailgate.thread'
_inherits = {'mailgate.thread': 'thread_id'}
_columns = {
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),
@ -103,6 +105,16 @@ class hr_applicant(osv.osv, crm.crm_case):
'survey' : fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'),
'response' : fields.integer("Response"),
}
_defaults = {
'active': lambda *a: 1,
'user_id': crm.crm_case._get_default_user,
'email_from': crm.crm_case. _get_default_email,
'state': lambda *a: 'draft',
'section_id': crm.crm_case. _get_section,
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],
}
def onchange_job(self,cr, uid, ids, job, context={}):
result = {}

View File

@ -105,6 +105,8 @@ class hr_recruitment_report(osv.osv):
'priority': fields.selection(hr_recruitment.AVAILABLE_PRIORITIES, 'Appreciation'),
'salary_prop' : fields.float("Salary Proposed"),
'salary_exp' : fields.float("Salary Expected"),
'partner_id': fields.many2one('res.partner', 'Partner',readonly=True),
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact Name',readonly=True),
'available' : fields.float("Availability")
}
@ -121,7 +123,9 @@ class hr_recruitment_report(osv.osv):
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
s.state,
s.partner_id,
s.company_id,
s.partner_address_id,
s.user_id,
s.job_id,
s.type_id,
@ -140,6 +144,8 @@ class hr_recruitment_report(osv.osv):
date_trunc('day',s.create_date),
date_trunc('day',s.date_closed),
s.state,
s.partner_id,
s.partner_address_id,
s.company_id,
s.user_id,
s.stage_id,

View File

@ -10,9 +10,11 @@
<field name="date" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="job_id" invisible="1"/>
<field name="stage_id" invisible="1" widget="selection"/>
<field name="stage_id" invisible="1" />
<field name="department_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="partner_address_id" invisible="1"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="state" invisible="1"/>
<field name="year" invisible="1"/>
@ -96,29 +98,36 @@
string="Hired"
name="done"
domain="[('state','=','done')]"/>
<filter icon="terp-hr"
string="Refused"
domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="date"/>
<separator orientation="vertical"/>
<field name="priority"/>
<field name="stage_id" widget="selection"/>
<field name="job_id" widget="selection"/>
<newline/>
<field name="type_id" widget="selection"/>
<field name="date"/>
<filter icon="terp-hr"
string="Refused"
domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="date_closed"/>
<separator orientation="vertical"/>
<field name="type_id" widget="selection"/>
<field name="partner_id"/>
<field name="partner_address_id"/>
</group>
<newline/>
<group expand="1" string="Group By ..." colspan="10" col="12">
<filter string="User" name='User' icon="terp-hr" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" name="Stage" icon="terp-hr" domain="[]" context="{'group_by':'stage_id'}" />
<filter string="Partner" icon="terp-hr" domain="[]" context="{'group_by':'partner_id'}" />
<filter string="Stage" icon="terp-hr" domain="[]" context="{'group_by':'stage_id'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-hr" domain="[]" context="{'group_by':'state'}"/>
<filter string="Jobs" icon="terp-sale" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Department" icon="terp-hr" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Degree" icon="terp-hr" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Partner Contact Name" icon="terp-hr" domain="[]" context="{'group_by':'partner_address_id'}" />
<filter string="Jobs" name="job" icon="terp-sale" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Department" name="department" icon="terp-hr" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Degree" name="degree" icon="terp-hr" domain="[]" context="{'group_by':'type_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-hr" domain="[]" context="{'group_by':'state'}"/>
<filter string="Day" name = "day" icon="terp-hr" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" domain="[]" context="{'group_by':'year'}"/>
@ -132,7 +141,11 @@
<field name="res_model">hr.recruitment.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<<<<<<< TREE
<field name="context">{'search_default_month':1,'search_default_degree':1,'search_default_job':1,'group_by_no_leaf':1,'group_by':[]}</field>
=======
<field name="context">{'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}</field>
>>>>>>> MERGE-SOURCE
<field name="search_view_id" ref="view_hr_recruitment_report_search"/>
</record>
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="10"/>

View File

@ -99,7 +99,7 @@
<field name="context">{'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_timesheet_line_search"/>
</record>
<menuitem action="action_timesheet_line_stat_all" id="menu_report_timesheet_line_all" parent="hr.menu_hr_reporting"/>
<!--menuitem action="action_timesheet_line_stat_all" id="menu_report_timesheet_line_all" parent="hr.menu_hr_reporting"/-->
<!-- Statistics report on timesheet by user -->

View File

@ -33,7 +33,11 @@ class timesheet_report(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'name': fields.char('Description', size=64,readonly=True),
'product_id' : fields.many2one('product.product', 'Product'),
'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True),
'user_id': fields.many2one('res.users', 'User',readonly=True),
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing',readonly=True),
'account_id': fields.many2one('account.analytic.account', 'Analytic Account',readonly=True),
'nbr': fields.integer('#Nbr',readonly=True),
'company_id': fields.many2one('res.company', 'Company',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
@ -45,9 +49,8 @@ class timesheet_report(osv.osv):
('draft','Draft'),
('confirm','Confirmed'),
('done','Done')], 'State', readonly=True),
'total_att': fields.float('Total Timesheet',readonly=True),
'total_ts': fields.float('Total Attendance',readonly=True),
'total_diff': fields.float('Difference', readonly=True),
'quantity': fields.float('#Quantity',readonly=True),
'cost': fields.float('#Cost',readonly=True),
}
def init(self, cr):
@ -64,10 +67,12 @@ class timesheet_report(osv.osv):
to_char(htss.date_current,'MM') as month,
to_char(htss.date_current, 'YYYY-MM-DD') as day,
count(*) as nbr,
sum(day.total_attendance) as total_att,
sum(day.total_timesheet) as total_ts,
sum(day.total_difference) as total_diff,
sum(aal.unit_amount) as quantity,
sum(aal.amount) as cost,
aal.account_id,
aal.product_id,
aal.to_invoice,
aal.general_account_id,
htss.user_id,
htss.company_id,
htss.department_id,
@ -75,7 +80,6 @@ class timesheet_report(osv.osv):
from account_analytic_line as aal
left join hr_analytic_timesheet as hat ON (hat.line_id=aal.id)
left join hr_timesheet_sheet_sheet as htss ON (hat.line_id=htss.id)
left join hr_timesheet_sheet_sheet_day AS day ON (htss.id = day.sheet_id)
group by
to_char(htss.date_current,'YYYY'),
to_char(htss.date_current,'MM'),
@ -84,6 +88,9 @@ class timesheet_report(osv.osv):
htss.date_from,
htss.date_to,
htss.date_current,
aal.to_invoice,
aal.product_id,
aal.general_account_id,
htss.name,
htss.company_id,
htss.state,

View File

@ -7,10 +7,9 @@
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Timesheet" type="bar">
<field name="name" />
<field name="total_att" operator = "+"/>
<field name="total_ts" operator = "+"/>
<field name="user_id" group = "True"/>
<field name="user_id" />
<field name="quantity" operator = "+"/>
<field name="state" group = "True"/>
</graph>
</field>
</record>
@ -25,12 +24,15 @@
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="total_att" sum="Total Timesheet"/>
<field name="total_diff" sum="Total Attendance"/>
<field name="total_ts" sum="Difference"/>
<field name="quantity" sum="#Quantity"/>
<field name="cost" sum="#Cost"/>
<field name="state" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="to_invoice" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="account_id" invisible="1"/>
<field name="general_account_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
@ -43,7 +45,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Timesheet">
<group col="10" colspan="4">
<group col="10" colspan="12">
<filter icon="terp-hr" string="This Year"
domain="[('date_current','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_current','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Timesheet in this year"/>
@ -63,10 +65,8 @@
<filter icon="terp-hr"
string="Confirmed"
domain="[('state','=','confirm')]"/>
<filter icon="terp-hr"
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-hr"
string="Non Assigned timesheets to users"
@ -76,26 +76,40 @@
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr"
string="New"
domain="[('state','=','new')]"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr"
string="New"
domain="[('state','=','new')]"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<separator orientation="vertical"/>
<field name="account_id"/>
<field name="department_id" widget="selection"/>
<newline/>
<filter icon="terp-hr"
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="date_to"/>
<separator orientation="vertical"/>
<field name="general_account_id"/>
<field name="to_invoice" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Type of Invoicing" icon="terp-hr" context="{'group_by':'to_invoice'}"/>
<filter string="Analytic Account" icon="terp-hr" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-hr" context="{'group_by':'general_account_id'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date_current'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search>

View File

@ -47,8 +47,10 @@
'lunch_report.xml',
#'process/lunch_process.xml'
],
"demo_xml": ['lunch_demo.xml'],
"test": ['test/test_lunch.yml'],
"demo_xml": ['lunch_demo.xml',
],
"test": ['test/test_lunch.yml'
],
"installable": True,
}

View File

@ -56,46 +56,13 @@
</tree>
</field>
</record>
<record id="view_lunch_order_filter" model="ir.ui.view">
<field name="name">lunch-order Search</field>
<field name="model">lunch.order</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search order">
<group>
<filter icon="terp-project"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-project"
name="confirmed"
string="Confirmed"
domain="[('state','=','confirmed')]"/>
<separator orientation="vertical"/>
<field name="product" widget="selection"/>
<field name="user_id" select="1" widget="selection" default="1">
</field>
<field name="date"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="Product" icon="terp-purchase" domain="[]" context="{'group_by':'product'}"/>
<filter string="State" icon="terp-purchase" domain="[]" context="{'group_by':'state'}"/>
<filter string="Order date" icon="terp-purchase" domain="[]" context="{'group_by':'date'}"/>
<filter string="User" name="user" icon="terp-partner" domain="[]" context="{'group_by':'user_id'}"/>
</group>
<newline/>
</search>
</field>
</record>
<!-- Lunch order Action -->
<record model="ir.actions.act_window" id="action_lunch_order_form">
<field name="name">Lunch Orders</field>
<field name="res_model">lunch.order</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_lunch_order_filter"/>
</record>
<menuitem name="Lunch Order" parent="menu_lunch"
@ -149,10 +116,10 @@
<field name="arch" type="xml">
<form string="CashMove">
<field name="name" select="1"/>
<field name="create_date" select="1"/>
<field name="user_cashmove" select="1"/>
<field name="box" select="1"/>
<field name="amount"/>
<field name="box" select="1"/>
<field name="create_date" select="1"/>
<field name="active" select="1"/>
</form>
</field>
@ -174,37 +141,12 @@
</tree>
</field>
</record>
<record id="view_lunch_cashmove_filter" model="ir.ui.view">
<field name="name">CashMove Search</field>
<field name="model">lunch.cashmove</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search order">
<group>
<field name="name"/>
<field name="user_cashmove" widget="selection" default="1"/>
<field name="amount"/>
<field name="box" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="CashBox" icon="terp-purchase" domain="[]" context="{'group_by':'box'}"/>
<filter string="Order date" icon="terp-purchase" domain="[]" context="{'group_by':'create_date'}"/>
<filter string="User" name="user" icon="terp-partner" domain="[]" context="{'group_by':'user_cashmove'}"/>
</group>
<newline/>
</search>
</field>
</record>
<!-- Cash Move Action -->
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
<field name="name">CashMove</field>
<field name="res_model">lunch.cashmove</field>
<field name="search_view_id" ref="view_lunch_cashmove_filter"/>
</record>
<menuitem name="Cash Moves" parent="menu_lunch"
@ -298,6 +240,7 @@
id="menu_lunch_category_form"
action="action_lunch_category_form" sequence="1" />
<!-- Lunch Amount Tree view -->
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
@ -312,53 +255,29 @@
</tree>
</field>
</record>
<record id="view_order_product_graph" model="ir.ui.view">
<field name="name">Lunch.amount.report.graph</field>
<field name="model">report.lunch.amount</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="vertical" string="Case Position by User" type="bar">
<field name="user_id"/>
<field name="amount"/>
</graph>
</field>
<!-- Lunch Amount Form view -->
<record model="ir.ui.view" id="view_report_lunch_amount_form">
<field name="name">Lunch amount</field>
<field name="model">report.lunch.amount</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Box Amount by User">
<field name="user_id" select="1"/>
<field name="box" select="1"/>
<field name="amount" select="1"/>
</form>
</field>
</record>
<!-- Lunch Amount search view -->
<record id="view_report_lunch_amount_filter" model="ir.ui.view">
<field name="name">Lunch amount Search</field>
<field name="model">report.lunch.amount</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search lunch amount">
<group>
<field name="user_id" widget="selection" default="1">
</field>
<field name="box" widget="selection"/>
<field name="amount"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="CashBox" name="cashbox" icon="terp-purchase" domain="[]" context="{'group_by':'box'}"/>
<filter string="User" name="user" icon="terp-partner" domain="[]" context="{'group_by':'user_id'}"/>
</group>
<newline/>
</search>
</field>
</record>
<!-- Lunch Amount Action -->
<record model="ir.actions.act_window" id="action_report_lunch_amount_tree">
<field name="name">Lunch amount</field>
<field name="res_model">report.lunch.amount</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_report_lunch_amount_filter"/>
<field name="context">{'search_default_user':1, 'group_by_no_leaf':1,'group_by':[]}</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Cash Position by User"

View File

@ -14,8 +14,7 @@
<label string="Are you sure you want to reset this cashbox ?"/>
</group>
<separator string="" colspan="4" />
<group colspan="6" >
<label string=" " colspan="2"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="No"/>
<button icon="gtk-ok" name="set_to_zero" string="Set to Zero" type="object"/>
</group>
@ -23,7 +22,14 @@
</field>
</record>
<!-- Action for lunch cashbox set to zero. -->
<record id="action_lunch_cashbox_clean" model="ir.actions.act_window">
<field name="name">Set CashBox to Zero</field>
<field name="res_model">lunch.cashbox.clean</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_lunch_cashbox_clean"/>
<field name="target">new</field>
</record>
<act_window id="action_lunch_cashbox_clean_values"
key2="client_action_multi" name="Set CashBox to Zero"

View File

@ -14,8 +14,7 @@
<label string="Are you sure you want to cancel this order ?"/>
</group>
<separator string="" colspan="4" />
<group colspan="6">
<label string=" " colspan="2"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="No"/>
<button icon="gtk-ok" name="cancel" string="Yes" type="object"/>
</group>
@ -23,7 +22,14 @@
</field>
</record>
<!-- Action for Cancel Order -->
<record id="action_lunch_order_cancel" model="ir.actions.act_window">
<field name="name">Cancel Order</field>
<field name="res_model">lunch.order.cancel</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_lunch_order_cancel"/>
<field name="target">new</field>
</record>
<act_window id="action_lunch_order_cancel_values"
key2="client_action_multi" name="Cancel Order"

View File

@ -16,8 +16,7 @@
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="6">
<label colspan="2" string=" "/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="confirm" string="Confirm Order" type="object"/>
</group>
@ -25,7 +24,14 @@
</field>
</record>
<!-- Action for Confirm order -->
<record id="action_lunch_order_confirm" model="ir.actions.act_window">
<field name="name">Confirm Order</field>
<field name="res_model">lunch.order.confirm</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_lunch_order_confirm"/>
<field name="target">new</field>
</record>
<act_window id="action_lunch_order_confirm_values"
key2="client_action_multi" name="Confirm Order"

View File

@ -32,7 +32,7 @@
* Easy Integration with any Module""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base','fetchmail'],
'depends': ['base'],
'init_xml': [],
'update_xml': [
"mail_gateway_view.xml",

View File

@ -22,60 +22,38 @@
from osv import osv, fields
import time
class one2many_domain(fields.one2many):
def set(self, cr, obj, id, field, values, user=None, context=None):
if not values:
return
return super(one2many_domain, self).set(cr, obj, id, field, values,
user=user, context=context)
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if not context:
context = {}
res = {}
msg_obj = obj.pool.get('mailgate.message')
for thread in obj.browse(cr, user, ids, context=context):
final = msg_obj.search(cr, user, self._domain + [('thread_id', '=', thread.id)], context=context)
res[thread.id] = final
return res
class mailgate_thread(osv.osv):
'''
Mailgateway Thread
'''
_name = 'mailgate.thread'
_description = 'Mailgateway Thread'
def _get_log_ids(self, cr, uid, ids, field_names, arg, context=None):
"""Gets id for case log from history of particular case
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of Case IDs
@param context: A standard dictionary for contextual values
@return:Dictionary of History Ids
"""
if not context:
context = {}
result = {}
domain = []
history_obj = False
model_obj = self.pool.get('ir.model')
history_obj = self.pool.get('mailgate.message')
if 'message_ids' in field_names:
name = 'message_ids'
domain += [('email_to', '!=', False)]
if 'log_ids' in field_names:
name = 'log_ids'
domain += [('email_to', '=', False)]
model_ids = model_obj.search(cr, uid, [('model', '=', self._name)])
domain += [('model_id', '=', model_ids[0])]
for case in self.browse(cr, uid, ids, context):
domain1 = domain + [('res_id', '=', case.id)]
history_ids = history_obj.search(cr, uid, domain1, context=context)
if history_ids:
result[case.id] = {name: history_ids}
else:
result[case.id] = {name: []}
return result
_rec_name = 'thread'
_columns = {
'name':fields.char('Name', size=64),
'active': fields.boolean('Active'),
'message_ids': fields.function(_get_log_ids, method=True, type='one2many', \
multi="message_ids", relation="mailgate.message", string="Messages"),
'log_ids': fields.function(_get_log_ids, method=True, type='one2many', \
multi="log_ids", relation="mailgate.message", string="Logs"),
}
'thread': fields.char('Thread', size=32, required=False),
'message_ids': one2many_domain('mailgate.message', 'thread_id', 'Messages', domain=[('history', '=', True)], required=False),
'log_ids': one2many_domain('mailgate.message', 'thread_id', 'Logs', domain=[('history', '=', False)], required=False),
}
def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
"""
@param self: The object pointer
@ -89,7 +67,6 @@ class mailgate_thread(osv.osv):
@param context: A standard dictionary for contextual values"""
if not context:
context = {}
# The mailgate sends the ids of the cases and not the object list
if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'):
cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context)
@ -102,21 +79,19 @@ class mailgate_thread(osv.osv):
data = {
'name': keyword,
'user_id': uid,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'model_id' : model_ids and model_ids[0] or False,
'res_id': case.id,
'section_id': case.section_id.id,
'message_id':message_id
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'thread_id': case.thread_id.id,
'message_id': message_id
}
if history:
data['history'] = True
data['description'] = details or case.description
data['email_to'] = email or \
(case.section_id and case.section_id.reply_to) or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
data['email_from'] = email_from or \
(case.section_id and case.section_id.reply_to) or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
res = obj.create(cr, uid, data, context)
@ -138,10 +113,10 @@ class mailgate_message(osv.osv):
_columns = {
'name':fields.char('Message', size=64),
'model_id': fields.many2one('ir.model', 'Model'),
'thread_id':fields.many2one('mailgate.thread', 'Thread'),
'date': fields.datetime('Date'),
'model_id': fields.many2one('ir.model', "Model"),
'res_id': fields.integer('Resource ID'),
'history': fields.boolean('Is History?', required=False),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'message': fields.text('Description'),
'email_from': fields.char('Email From', size=84),

View File

@ -9,9 +9,8 @@
<form string="maligate message">
<field name="name" />
<field name="date" />
<field name="model_id" />
<field name="res_id" />
<field name="user_id" />
<field name="history" />
<field name="message_id" />
<notebook colspan="4">
<page>
@ -51,20 +50,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Mailgateway Thread">
<field name="name" select="1"/>
<separator string="Messages" colspan="4"/>
<field name="message_ids" nolabel="1" colspan="4">
<tree string="Mailgateway Message">
<field name="thread" select="1"/>
<separator string="Logs" colspan="4"/>
<field name="log_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<tree string="Mailgateway Logs">
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Maligate Message">
<form string="Maligate Logs">
<field name="name" />
<field name="date" />
<field name="model_id" />
<field name="res_id" />
<field name="user_id" />
<field name="message_id" />
<field name="history" />
<notebook colspan="4">
<page string="Email Details">
<group col="4" colspan="4">
@ -82,6 +80,35 @@
</notebook>
</form>
</field>
<separator string="Histories" colspan="4"/>
<field name="message_ids" nolabel="1" colspan="4" domain="[('history', '=', True)]">
<tree string="Mailgateway Histories">
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Maligate Histories">
<field name="name" />
<field name="date" />
<field name="user_id" />
<field name="message_id" />
<field name="history" />
<notebook colspan="4">
<page string="Email Details">
<group col="4" colspan="4">
<separator string="Email Details" colspan="4"/>
<field name="email_from" />
<field name="email_to" />
<field name="email_cc" />
<field name="email_bcc" />
</group>
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
<field name="attachment_ids" nolabel="1" colspan="4" />
</page>
</notebook>
</form>
</field>
</form>
</field>
</record>
@ -92,7 +119,7 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Mailgateway Thread">
<field name="name" select="1" />
<field name="thread" select="1" />
<field name="message_ids" />
</tree>
</field>
@ -120,12 +147,12 @@
</record>
<menuitem id="base.menu_crm_configuration" name="Cases"
<!-- <menuitem id="base.menu_crm_configuration" name="Cases"
parent="base.menu_base_config" sequence="0"/>
<menuitem id="menu_mailgate_thread" name="Mailgateway Threads" action="action_view_mailgate_thread"
parent="base.menu_crm_configuration" sequence="20"/>
-->
</data>
</openerp>

View File

@ -36,6 +36,8 @@
'init_xml': [],
'update_xml': [
'marketing_campaign_view.xml',
'marketing_campaign_data.xml',
'marketing_campaign_workflow.xml',
'report/campaign_analysis_view.xml',
],
'demo_xml': [],

View File

@ -53,7 +53,40 @@ class marketing_campaign(osv.osv): #{{{
'fixed_cost': fields.float('Fixed Cost'),
}
_defaults = {
'state': lambda *a: 'draft',
}
def state_running_set(self, cr, uid, ids, *args):
campaign = self.browse(cr, uid, ids[0])
if not campaign.activity_ids :
raise osv.except_osv("Error", "There is no associate activitity for the campaign")
act_ids = [ act_id.id for act_id in campaign.activity_ids]
act_ids = self.pool.get('marketing.campaign.activity').search(cr, uid,
[('id', 'in', act_ids), ('start', '=', True)])
if not act_ids :
raise osv.except_osv("Error", "There is no associate activitity for the campaign")
segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid,
[('campaign_id', '=', campaign.id),
('state', '=', 'draft')])
if not segment_ids :
raise osv.except_osv("Error", "There is no associate semgnet for the campaign")
self.write(cr, uid, ids, {'state': 'running'})
return True
def state_done_set(self, cr, uid, ids, *args):
segment_ids = self.pool.get('marketing.campaign.segment').search(cr, uid,
[('campaign_id', 'in', ids),
('state', '=', 'running')])
if segment_ids :
raise osv.except_osv("Error", "Camapign cannot be done before all segments are done")
self.write(cr, uid, ids, {'state': 'done'})
return True
def state_cancel_set(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'cancelled'})
return True
marketing_campaign()#}}}
class marketing_campaign_segment(osv.osv): #{{{
@ -69,8 +102,8 @@ class marketing_campaign_segment(osv.osv): #{{{
string='Object'),
'ir_filter_id': fields.many2one('ir.filters', 'Filter'),
'sync_last_date': fields.datetime('Date'),
'sync_mode': fields.selection([('create', 'Create'),
('write', 'Write')],
'sync_mode': fields.selection([('create_date', 'Create'),
('write_date', 'Write')],
'Mode'),
'state': fields.selection([('draft', 'Draft'),
('running', 'Running'),
@ -80,6 +113,69 @@ class marketing_campaign_segment(osv.osv): #{{{
'date_run': fields.datetime('Running'),
'date_done': fields.datetime('Done'),
}
_defaults = {
'state': lambda *a: 'draft',
'sync_mode': lambda *a: 'create_date',
}
def state_running_set(self, cr, uid, ids, *args):
segment = self.browse(cr, uid, ids[0])
if not segment.date_run:
raise osv.except_osv("Error", "Segment cant be start before giving running date")
if segment.campaign_id.state != 'running' :
raise osv.except_osv("Error", "You have to start campaign first")
self.write(cr, uid, ids, {'state': 'running'})
return True
def state_done_set(self, cr, uid, ids, *args):
date_done = self.browse(cr, uid, ids[0]).date_done
if (date_done > time.strftime('%Y-%m-%d')):
raise osv.except_osv("Error", "Segment cannot be closed before end date")
wi_ids = self.pool.get("marketing.campaign.workitem").search(cr, uid,
[('state', 'in', ['inprogress', 'todo']),
('segment_id', '=', ids[0])])
if wi_ids :
raise osv.except_osv("Error", "Segment cannot be done before all workitems are processed")
self.write(cr, uid, ids, {'state': 'done'})
return True
def state_cancel_set(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {'state': 'cancelled'})
return True
def process_segment(self, cr, uid, context={}):
segment_ids = self.search(cr, uid, [('state', '=', 'running')])
action_date = time.strftime('%Y-%m-%d %H:%M:%S')
last_action_date = (datetime.now() + _intervalTypes['days'](-1) \
).strftime('%Y-%m-%d %H:%M:%S')
for segment in self.browse(cr, uid, segment_ids):
act_ids = self.pool.get('marketing.campaign.activity').search(cr,
uid, [('start', '=', True),
('campaign_id', '=', segment.campaign_id.id)])
if (segment.sync_last_date and \
segment.sync_last_date <= action_date )\
or not segment.sync_last_date :
model_obj = self.pool.get(segment.object_id.model)
object_ids = model_obj.search(cr, uid, [
(segment.sync_mode, '<=', action_date),
(segment.sync_mode, '>=', last_action_date)])
for o_ids in model_obj.read(cr, uid, object_ids) :
partner_id = 'partner_id' in o_ids and o_ids['partner_id'] \
or False
for act_id in act_ids:
wi_vals = {'segment_id': segment.id,
'activity_id': act_id,
'date': action_date,
'partner_id': 1,
'state': 'todo',
}
print self.pool.get('marketing.campaign.workitem').create(cr,
uid, wi_vals)
self.write(cr, uid, segment.id, {'sync_last_date':action_date})
return True
marketing_campaign_segment()#}}}
@ -116,6 +212,7 @@ class marketing_campaign_activity(osv.osv): #{{{
'variable_cost': fields.float('Variable Cost'),
'revenue': fields.float('Revenue')
}
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
@ -176,6 +273,9 @@ class marketing_campaign_workitem(osv.osv): #{{{
('exception', 'Exception'), ('done', 'Done'),
('cancelled', 'Cancelled')], 'State')
}
_defaults = {
'state': lambda *a: 'draft',
}
def process_chain(self, cr, uid, workitem_id, context={}):
workitem = self.browse(cr, uid, workitem_id)
@ -184,7 +284,7 @@ class marketing_campaign_workitem(osv.osv): #{{{
process_to_id = mct_obj.search(cr,uid, [('id', 'in', to_ids),
('activity_from_id','=', 'activity_id')])
for mct_id in mct_obj.browse(cr, uid, process_to_id):
launch_date = datetime.datetime.now() + _intervalTypes[ \
launch_date = datetime.now() + _intervalTypes[ \
mct_id.interval_type](mct_id.interval_nbr)
workitem_vals = {'segment_id': workitem.segment_id.id,
'activity_id': mct_id.activity_to_id.id,
@ -201,10 +301,10 @@ class marketing_campaign_workitem(osv.osv): #{{{
return True
def process_all(self, cr, uid, context={}):
workitem_ids = self.search(cr, uid, [('type', '=', 'todo'),
workitem_ids = self.search(cr, uid, [('state', '=', 'todo'),
('date','<=', time.strftime('%Y-%m-%d %H:%M:%S'))])
if workitem_ids:
self.parocess(cr, uid, workitem_ids, context)
self.process(cr, uid, workitem_ids, context)
marketing_campaign_workitem() #}}}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -6,13 +6,25 @@
<record model="ir.cron" id="ir_cron_marketing_campaign_every_hour">
<field name="name">Check Workitem</field>
<field name="interval_number">60</field>
<field name="interval_type">minutes</field>
<field name="interval_number">1</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model" eval="'marketing.campaign.workitem'"/>
<field name="function" eval="'process_all'"/>
<field name="args" eval="'()'"/>
</record>
<record model="ir.cron" id="ir_cron_marketing_campaign_every_day">
<field name="name">Check Segment</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field><!-- it s every day -->
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model" eval="'marketing.campaign.segment'"/>
<field name="function" eval="'process_segment'"/>
<field name="args" eval="'()'"/>
</record>
</data>
</openerp>

View File

@ -65,7 +65,12 @@
</tree>
</field>
<separator string="Status" colspan="4" />
<field name="state" nolabel = "1" colspan="4" readonly="True"/>
<group col="10" colspan="4">
<field name="state" readonly="1" select="2" nolabel="1"/>
<button name="state_running_set" string="Run" states="draft" />
<button name="state_done_set" string="Done" states="running" />
<button name="state_cancel_set" string="Cancelled" states="running"/>
</group>
</form>
</field>
</record>
@ -142,10 +147,15 @@
<field name="date_done"/>
<separator string="Synchronization" colspan="4" />
<field name="sync_last_date"/>
<field name="sync_mode"/>
<field name="sync_mode" required="True"/>
</group>
<separator string="Status" colspan="4" />
<field name="state" nolabel = "1" colspan="4" readonly="1"/>
<group col="10" colspan="4">
<field name="state" readonly="1" select="2" nolabel="1"/>
<button name="state_running_set" string="Run" states="draft" />
<button name="state_done_set" string="Done" states="running" />
<button name="state_cancel_set" string="Cancelled" states="running" />
</group>
</form>
</field>
</record>

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ==================Marketing Campaigns================== -->
<record id="wkf_marketing_campaign" model="workflow">
<field name="name">marketing.campaign.basic</field>
<field name="osv">marketing.campaign</field>
<field name="on_create">True</field>
</record>
<!-- Activity -->
<record id="act_marketing_campaign_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_marketing_campaign_running" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">running</field>
<field name="kind">function</field>
<field name="action">state_running_set()</field>
</record>
<record id="act_marketing_campaign_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">done</field>
<field name="kind">function</field>
<field name="action">state_done_set()</field>
</record>
<record id="act_marketing_campaign_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign"/>
<field name="name">cancel</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
<field name="action">state_cancel_set()</field>
</record>
<!-- Transition -->
<record id="trans_marketing_campaign_draft_running" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_draft"/>
<field name="act_to" ref="act_marketing_campaign_running"/>
<field name="signal">state_running_set</field>
</record>
<record id="trans_campaign_running_done" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_running"/>
<field name="act_to" ref="act_marketing_campaign_done"/>
<field name="signal">state_done_set</field>
</record>
<record id="trans_campaign_running_cancel" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_running"/>
<field name="act_to" ref="act_marketing_campaign_cancel"/>
<field name="signal">state_cancel_set</field>
</record>
<!-- ==================Marketing Campaign Segment================== -->
<record id="wkf_marketing_campaign_segment" model="workflow">
<field name="name">marketing.campaign.segment.basic</field>
<field name="osv">marketing.campaign.segment</field>
<field name="on_create">True</field>
</record>
<!-- Activity -->
<record id="act_marketing_campaign_segment_draft" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="flow_start">True</field>
<field name="name">draft</field>
</record>
<record id="act_marketing_campaign_segment_running" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">running</field>
<field name="kind">function</field>
<field name="action">state_running_set()</field>
</record>
<record id="act_marketing_campaign_segment_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">done</field>
<field name="kind">function</field>
<field name="action">state_done_set()</field>
</record>
<record id="act_marketing_campaign_segment_cancel" model="workflow.activity">
<field name="wkf_id" ref="wkf_marketing_campaign_segment"/>
<field name="name">cancel</field>
<field name="flow_stop">True</field>
<field name="kind">function</field>
<field name="action">state_cancel_set()</field>
</record>
<!-- Transition -->
<record id="trans_marketing_campaign_segment_draft_running" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_draft"/>
<field name="act_to" ref="act_marketing_campaign_segment_running"/>
<field name="signal">state_running_set</field>
</record>
<record id="trans_campaign_segment_running_done" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_running"/>
<field name="act_to" ref="act_marketing_campaign_segment_done"/>
<field name="signal">state_done_set</field>
</record>
<record id="trans_campaign_segment_running_cancel" model="workflow.transition">
<field name="act_from" ref="act_marketing_campaign_segment_running"/>
<field name="act_to" ref="act_marketing_campaign_segment_cancel"/>
<field name="signal">state_cancel_set</field>
</record>
</data>
</openerp>

View File

@ -36,7 +36,7 @@ class campaign_analysis(osv.osv): #{{{
result = {}
for ca_obj in self.browse(cr, uid, ids, context):
wi_ids = self.pool.get('marketing.campaign.workitem').search(cr, uid,
[('segment_id.campaign_id', '=', ca_obj.campaign_id.id)])
[('segment_id.campaign_id', '=', ca_obj.campaign_id.id)])
total_cost = ca_obj.activity_id.variable_cost + \
(ca_obj.campaign_id.fixed_cost / len(wi_ids))
result[ca_obj.id] = total_cost
@ -58,14 +58,12 @@ class campaign_analysis(osv.osv): #{{{
readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'country_id': fields.related('partner_id','address', 'country_id',
type='many2one', relation='res.country',
string='Country'),
# 'case_id': fields.many2one('crm.lead', 'Opportunity', readonly=True),
# 'count' : fields.integer('Count', readonly=True),
'total_cost': fields.function(_total_cost, string='Cost', method=True,
type="float"),
type='many2one', relation='res.country',string='Country'),
'total_cost' : fields.function(_total_cost, string='Cost', method=True,
type="float" ),
'revenue': fields.float('Revenue',readonly=True),
# 'case_id': fields.many2one('crm.lead', 'Opportunity', readonly=True),
# 'count' : fields.integer('Count', readonly=True),
}
def init(self, cr):
@ -87,7 +85,7 @@ class campaign_analysis(osv.osv): #{{{
marketing_campaign_workitem wi
left join res_partner p on (p.id=wi.partner_id)
left join marketing_campaign_segment s on (s.id=wi.segment_id)
left join marketing_campaign_activity act on (act.id= wi.activity_id),
left join marketing_campaign_activity act on (act.id= wi.activity_id)
group by
to_char(wi.date, 'YYYY'),to_char(wi.date, 'MM'),
s.campaign_id,wi.activity_id,wi.segment_id,wi.partner_id,revenue,

View File

@ -6,19 +6,19 @@
<field name="model">campaign.analysis</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Marketing Reports">
<field name="month"/>
<field name="year"/>
<field name="date"/>
<field name="campaign_id"/>
<field name="activity_id"/>
<field name="segment_id"/>
<field name="partner_id"/>
<field name="country_id" />
<!--field name="case_id"/-->
<!--field name="count"/-->
<field name="total_cost"/>
<field name="revenue"/>
<tree string="Marketing Reports">
<field name="year" invisible="1"/>
<field name="month" invisible="1"/>
<field name="date" invisible="1"/>
<field name="campaign_id" invisible="1"/>
<field name="activity_id" invisible="1"/>
<field name="segment_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="country_id" invisible="1"/>
<!--field name="case_id"/-->
<!--field name="count"/-->
<field name="total_cost" string="Cost"/><!-- sum="Cost"/-->
<field name="revenue"/>
</tree>
</field>
</record>
@ -46,8 +46,16 @@
<field name="segment_id"/>
<field name="partner_id"/>
<field name="country_id"/>
<!--field name="case_id"/-->
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Campaign" name="Campaign" icon="terp-sale" context="{'group_by':'campaign_id'}" />
<filter string="Segment" name ="Segment" icon="terp-sale" context="{'group_by':'segment_id'}" />
<filter string="Partner" icon="terp-sale" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-sale" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-sale" context="{'group_by':'year'}"/>
</group>
</search>
</field>
</record>
@ -57,7 +65,7 @@
<field name="res_model">campaign.analysis</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="context">{'group_by': [], 'search_default_group_campaign': 1, 'search_default_group_segment': 1}</field>
<field name="context">{'group_by': [], 'search_default_Campaign': 1, 'search_default_Segment': 1}</field>
<field name="search_view_id" ref="view_campaign_analysis_search"/>
</record>

View File

@ -27,12 +27,16 @@ class mrp_production_order(osv.osv):
_description = "Production Order Report"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'year': fields.char('Year',size=64,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=64,readonly=True),
'origin': fields.char('Source Document', size=64),
'nbr': fields.integer('# of Orders', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True, domain=[('type','<>','service')]),
'products_to_consume': fields.integer('Products to Consume', readonly=True),
'consumed_products': fields.integer('Consumed Products', readonly=True),
'date': fields.date('Date', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'product_qty': fields.float('Product Qty', readonly=True),
'state': fields.selection([('draft','Draft'),
('picking_except', 'Picking Exception'),
@ -43,14 +47,15 @@ class mrp_production_order(osv.osv):
('done','Done')],
'State', readonly=True),
'date_planned':fields.date('Scheduled Date'),
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', required=True),
'location_src_id': fields.many2one('stock.location', 'Raw Materials Location', readonly=True),
'date_start': fields.datetime('Start Date',readonly=True),
'date_finnished': fields.datetime('End Date',readonly=True),
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=True),
'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', readonly=True),
'company_id': fields.many2one('res.company','Company',readonly=True),
'bom_id': fields.many2one('mrp.bom', 'Bill of Material', domain=[('bom_id','=',False)],readonly=True),
'routing_id': fields.many2one('mrp.routing', string='Routing', on_delete='set null',readonly=True),
'bom_id': fields.many2one('mrp.bom', 'Bill of Material',readonly=True),
'routing_id': fields.many2one('mrp.routing', string='Routing',readonly=True),
'picking_id': fields.many2one('stock.picking', 'Picking list', readonly=True),
'product_uom': fields.many2one('product.uom', 'Product UOM', readonly=True),
'priority': fields.selection([('0','Not urgent'),
('1','Normal'),
('2','Urgent'),
@ -65,12 +70,27 @@ class mrp_production_order(osv.osv):
create or replace view mrp_production_order as (
select
min(l.id) as id,
to_char(s.create_date, 'YYYY') as name,
to_date(to_char(s.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
l.product_id as product_id,
l.product_uom,
sum(l.product_qty * u.factor) as product_qty,
s.company_id as company_id,
count(*) as nbr,
(select sum(sm.product_qty) from stock_move as sm
left join mrp_production_move_ids as mv on (sm.id=mv.move_id)
left join mrp_production_product_line as ll on (ll.production_id=mv.production_id)
where sm.product_id=ll.product_id and ll.id=l.id
and sm.state not in ('done','cancel')
group by sm.product_id) as products_to_consume,
(select sum(sm.product_qty)/2 from stock_move as sm
left join mrp_production_move_ids as mv on (sm.id=mv.move_id)
left join mrp_production_product_line as ll on (ll.production_id=mv.production_id)
where sm.product_id=ll.product_id and ll.id=l.id
and sm.state in ('done','cancel')
group by sm.product_id) as consumed_products,
s.location_src_id,
s.location_dest_id,
s.bom_id,
@ -82,16 +102,18 @@ class mrp_production_order(osv.osv):
s.origin,
s.priority,
s.state
from
mrp_production_product_line l
left join
mrp_production s on (s.id=l.production_id)
left join product_uom u on (u.id=l.product_uom)
from mrp_production_product_line l
left join mrp_production s on (s.id=l.production_id)
left join product_uom u on (u.id=l.product_uom)
group by
to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),
to_char(s.create_date, 'YYYY-MM-DD'),
to_date(to_char(s.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY'),
l.product_id,
l.product_uom,
s.id,
l.id,
s.bom_id,
s.routing_id,
s.picking_id,

View File

@ -48,8 +48,8 @@
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter string="This Year" name="this_year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" name="this_month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]"/>
<filter string="This Year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]" default="1" />
<filter string="This Month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
<separator orientation="vertical"/>
@ -101,7 +101,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
<field name="context">{'search_default_Product': 1,'search_default_this_year':1,'search_default_this_month':1}</field>
<field name="context">{'search_default_Product': 1}</field>
</record>

View File

@ -3,7 +3,7 @@
<data>
<!-- Wizard view for the load data -->
<record id="bi_load_db_form" model="ir.ui.view">
<field name="name">bi.load.db.form</field>
<field name="model">bi.load.db.wizard</field>
@ -22,7 +22,7 @@
</form>
</field>
</record>
<record id="act_bi_load_db_wizard" model="ir.actions.act_window">
<field name="name">Load database Structure</field>
<field name="res_model">bi.load.db.wizard</field>
@ -33,10 +33,10 @@
<field name="auto_refresh" eval="1"/>
<field name="target">new</field>
</record>
<!-- Wizard For Olap Warehouse -->
<record id="view_warehouse_bi" model="ir.ui.view">
<field name="name">Olap Warehouse</field>
<field name="model">olap.warehouse.wizard</field>
@ -51,7 +51,7 @@
</form>
</field>
</record>
<record id="action_olap_warehouse" model="ir.actions.act_window">
<field name="name">Olap Warehouse</field>
<field name="type">ir.actions.act_window</field>
@ -60,7 +60,7 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Olap Warehouse"
action="action_olap_warehouse"
@ -68,9 +68,9 @@
sequence="51"
parent="base.next_id_50"
/>
<!-- Wizard View for the parameters wizard -->
<record id="view_config_bi" model="ir.ui.view">
<field name="name">Parameters Configuration</field>
<field name="model">olap.parameters.config.wizard</field>
@ -90,7 +90,7 @@
</form>
</field>
</record>
<record id="action_config_bi_parameters" model="ir.actions.act_window">
<field name="name">Parameters Configuration</field>
<field name="type">ir.actions.act_window</field>
@ -99,7 +99,7 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem
name="Server Parameters"
action="action_config_bi_parameters"
@ -107,16 +107,16 @@
sequence="50"
parent="base.next_id_50"
/>
<record model="ir.actions.todo" id="config_auto_directory">
<field name="name">Server Parameters Configuration</field>
<field name="note">This wizard will configure the URL of the web client</field>
<field name="action_id" ref="action_config_bi_parameters"/>
</record>
<!-- Wizard view for the Auto Configuring the data -->
<record id="bi_auto_configure_form" model="ir.ui.view">
<field name="name">bi.auto.configure.form</field>
<field name="model">bi.auto.configure.wizard</field>
@ -131,7 +131,7 @@
</form>
</field>
</record>
<record id="act_bi_auto_configure" model="ir.actions.act_window">
<field name="name">Auto Configuration</field>
<field name="res_model">bi.auto.configure.wizard</field>
@ -142,13 +142,13 @@
<field name="auto_refresh" eval="1"/>
<field name="target">new</field>
</record>
# ------------------------------------------------------------------
# Olap Schema
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_schema_tree">
<field name="name">olap.schema.tree</field>
<field name="model">olap.schema</field>
@ -160,7 +160,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_schema_form">
<field name="name">olap.schema.form</field>
<field name="model">olap.schema</field>
@ -195,19 +195,19 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_schema_form">
<field name="name">Olap Schemas</field>
<field name="res_model">olap.schema</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Schema"
action="action_olap_schema_form"
id="menu_action_olap_schema_form"
parent="menu_bi_conf_cubes"/>
# ------------------------------------------------------------------
# Olap Cubes Table
# ------------------------------------------------------------------
@ -245,23 +245,23 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_cube_table_form">
<field name="name">Olap Cube Tables</field>
<field name="res_model">olap.cube.table</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Cubes Table"
parent = "menu_bi_conf_cubes"
action="action_olap_cube_table_form"
id="menu_action_olap_cube_table_form"/>
# ------------------------------------------------------------------
# Olap Cubes
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_cube_tree">
<field name="name">olap.cube.tree</field>
<field name="model">olap.cube</field>
@ -273,7 +273,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_cube_form">
<field name="name">olap.cube.form</field>
<field name="model">olap.cube</field>
@ -287,24 +287,24 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_cube_form">
<field name="name">Olap Cubes</field>
<field name="res_model">olap.cube</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Cubes"
parent ="menu_bi_conf_cubes"
action="action_olap_cube_form"
id="menu_action_olap_cube_form"/>
# ------------------------------------------------------------------
# Olap Dimensions
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_dimension_tree">
<field name="name">olap.dimension.tree</field>
<field name="model">olap.dimension</field>
@ -316,7 +316,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_dimension_form">
<field name="name">olap.dimension.form</field>
<field name="model">olap.dimension</field>
@ -328,23 +328,23 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_dimension_form">
<field name="name">Olap Dimensions</field>
<field name="res_model">olap.dimension</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Dimension"
parent = "menu_bi_conf_cubes"
action="action_olap_dimension_form"
id="menu_action_olap_dimension_form"/>
# ------------------------------------------------------------------
# Olap Hierarchies
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_hierarchy_tree">
<field name="name">olap.hierarchy.tree</field>
<field name="model">olap.hierarchy</field>
@ -356,7 +356,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_hierarchy_form">
<field name="name">olap.hierarchy.form</field>
<field name="model">olap.hierarchy</field>
@ -365,29 +365,33 @@
<form string="Olap hierarchy">
<field name="name" select="1" colspan="2"/>
<field name="sequence" colspan="2"/>
<field name="dimension_id" select="1" attrs="{'readonly':[('dimension_id','!=','')]}" colspan="2"/>
<field name="table_id" select="2" colspan="2" context="{'d_id':dimension_id}"/>
<field name="dimension_id" select="1" attrs="{'readonly':[('dimension_id','!=','')]}" colspan="4"/>
<!-- <field name="field_name" select="2"/>-->
<field name="table_id" select="2" colspan="4" context="{'d_id':dimension_id}"/>
<!-- <separator string="Levels" colspan="4"/>
<field name="level_ids" colspan="4" nolabel="1"/>-->
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_hierarchy_form">
<field name="name">Olap Hierarchies</field>
<field name="res_model">olap.hierarchy</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Hierarchy"
parent = "menu_bi_conf_cubes"
action="action_olap_hierarchy_form"
id="menu_action_olap_hierarchy_form"/>
# ------------------------------------------------------------------
# Olap Levels
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_level_tree">
<field name="name">olap.level.tree</field>
<field name="model">olap.level</field>
@ -404,7 +408,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_level_form">
<field name="name">olap.level.form</field>
<field name="model">olap.level</field>
@ -423,24 +427,24 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_level_form">
<field name="name">Olap Level</field>
<field name="res_model">olap.level</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Level"
parent = "menu_bi_conf_cubes"
action="action_olap_level_form"
id="menu_action_olap_level_form"/>
# ------------------------------------------------------------------
# Olap Measure
# ------------------------------------------------------------------
<record model="ir.ui.view" id="view_olap_measure_tree">
<field name="name">olap.measure.tree</field>
<field name="model">olap.measure</field>
@ -452,7 +456,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_measure_form">
<field name="name">olap.measure.form</field>
<field name="model">olap.measure</field>
@ -467,7 +471,7 @@
<group colspan="4" attrs="{'invisible':[('measure_type','!=','fact_column')]}">
<newline/>
<field name="value_column" select="1" attrs="{'required':[('measure_type','=','fact_column')]}" on_change="onchange_measure_name(value_column)" context="{'filter_cols_cube':cube_id}"/>
<field name="agregator" select="2"/>
<field name="agregator" select="2" />
<field name="formatstring" select="2"/>
</group>
<group colspan="4" attrs="{'invisible':[('measure_type','!=','sql_expr')]}">
@ -480,19 +484,19 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_measure_form">
<field name="name">Olap Measures</field>
<field name="res_model">olap.measure</field>
<field name="view_type">form</field>
</record>
<menuitem
name="Olap Measures"
parent = "menu_bi_conf_cubes"
action="action_olap_measure_form"
id="menu_action_olap_measure_form"/>
# ------------------------------------------------------------------
# Olap Saved Query
# ------------------------------------------------------------------
@ -511,7 +515,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_saved_query_form_mdx">
<field name="name">olap.saved.query.mdx</field>
<field name="model">olap.saved.query</field>
@ -527,7 +531,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_saved_query_form">
<field name="name">olap.saved.query.form</field>
<field name="model">olap.saved.query</field>
@ -549,22 +553,22 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_saved_query_form">
<field name="name">Olap Saved Query</field>
<field name="res_model">olap.saved.query</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,mdx</field>
</record>
<menuitem
name="Olap Saved Query"
parent = "menu_bi_conf_tools"
action="action_olap_saved_query_form"
id="menu_action_olap_saved_query_form"/>
<!-- All Logs -->
<record model="ir.ui.view" id="view_olap_query_logs_tree">
<field name="name">olap.query.logs</field>
<field name="model">olap.query.logs</field>
@ -578,7 +582,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_query_logs_form">
<field name="name">olap.query.logs.form</field>
<field name="model">olap.query.logs</field>
@ -595,21 +599,21 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_query_logs_form">
<field name="name">All Logs</field>
<field name="res_model">olap.query.logs</field>
<field name="view_type">form</field>
</record>
<menuitem
name="All Logs"
action="action_olap_query_logs_form"
id="menu_action_olap_query_logs_form"
parent="menu_bi_conf_tools"/>
<!-- All Logs / My logs -->
<record model="ir.ui.view" id="view_olap_query_logs_my_tree">
<field name="name">olap.query.logs</field>
<field name="model">olap.query.logs</field>
@ -622,7 +626,7 @@
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_olap_query_logs_my_tree">
<field name="name">olap.query.logs</field>
<field name="model">olap.query.logs</field>
@ -635,9 +639,9 @@
</tree>
</field>
</record>
<!-- Query Logs -->
<record model="ir.ui.view" id="view_olap_query_logs_my_form">
<field name="name">olap.query.logs.form</field>
<field name="model">olap.query.logs</field>
@ -653,7 +657,7 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_olap_query_logs_my_form">
<field name="name">My Logs</field>
<field name="res_model">olap.query.logs</field>
@ -661,12 +665,12 @@
<field name="view_mode">tree,form,mdx</field>
<field name="domain">[('user_id','=',uid)]</field>
</record>
<menuitem
name="My Logs"
action="action_olap_query_logs_my_form"
id="menu_action_olap_query_logs_my_form"
parent="menu_action_olap_query_logs_form"/>
</data>
</openerp>

View File

@ -11,23 +11,20 @@
name: OpenERP
type: postgres
-
I will check the connection for successful login.
-
!python {model: olap.fact.database}: |
import tools
if tools.config['db_name'] == 'tiny' and tools.config['db_password'] == '123456' and tools.config['db_host'] == 'localhost':
self.test_connection(cr, uid, ids ,{'active_ids':[ref('olap_fact_database_openerp0')]})
I will check the connection for successful login. >>>>>>(Problem)
# !python {model: olap.fact.database}: |
# self.test_connection(cr, uid,[ref('olap_fact_database_openerp0')], context)
-
In order to test schema,I create a new schema record.
-
!record {model: olap.schema, id: olap_schema_Partners0}:
database_id: olap_fact_database_openerp0
name: Partners
-
-
I press "Connect to Database" and I see that the Schema State is "Database Connected" now
-
-
!workflow {model: olap.schema, action: dbconnect, ref: olap_schema_Partners0}
-
-
Now I will load the structure of the database. by structure we mean tables, columns and the relations. This will help in defining cube easily.
-
!record {model: bi.load.db.wizard, id: bi_load_db_wizard_0}:
@ -48,7 +45,7 @@
!workflow {model: olap.schema, action: dbconfigure, ref: olap_schema_Partners0}
-
Performing a workflow action dbready on module olap.schema
-
-
!workflow {model: olap.schema, action: dbready, ref: olap_schema_Partners0}
-
In order to create Cube I first define the fact table.Fact table are the key tables in which measures are stored and we can branch to other tables for other parameters.
@ -96,7 +93,7 @@
table_id: olap_cube_table_partnercubetable0
-
After adding the hierarchy I create level.I select Product's default_code as Columns Name that is loaded in Fact columns.
-
-
!record {model: olap.level, id: olap_level_productscode0}:
column_id_name: name
column_name: olap.columns_res_user_name
@ -110,4 +107,5 @@
-
!python {model: olap.load.column}: |
ids = self.search(cr, uid, [])
self.get_table_data(cr, uid, ids, {'active_ids': [ref('olap_cube_table_partnercubetable0')]})
self.get_table_data(cr, uid, ids, {'active_ids': [ref('olap_cube_table_partnercubetable0')]})

View File

@ -9,13 +9,9 @@
<field name="model">olap.load.column</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Columns">
<label string="Do u Want to Open Columns ?" colspan="6"/>
<separator string="" colspan="6"/>
<group col="6" colspan="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="get_table_data" string="Open" type="object" icon="gtk-ok"/>
</group>
<form string="">
<separator string=" " colspan="4"/>
<button name="get_table_data" string="Open" type="object"/>
</form>
</field>
</record>

View File

@ -11,10 +11,11 @@
<field name="arch" type="xml">
<form string=" To Load Data">
<field name='user_name'/>
<separator string="" colspan="6" />
<group col="4" colspan="4">
<button special="cancel" string="Cancel" icon="gtk-cancel" />
<button name="clear_logs" string="Clear Logs" type="object" icon="gtk-clear"/>
<separator string="" colspan="4" />
<label string="" colspan="2" />
<group colspan="4">
<button special="cancel" string="Cancel" />
<button name="clear_logs" string="Clear Logs" type="object"/>
</group>
</form>
</field>

View File

@ -42,7 +42,7 @@
<field name="view_id" ref="product_pricelist_version_tree_view"/>
</record>
<menuitem
action="product_pricelist_action" id="menu_product_pricelist_action"
action="product_pricelist_action" id="menu_product_pricelist_action"
parent="product.menu_product_pricelist_main" sequence="2"/>
<record id="product_pricelist_item_tree_view" model="ir.ui.view">

View File

@ -1,12 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data>
<wizard
id="report_wizard_price"
string="Price List"
model="product.product"
name="product.price_list"
keyword="client_print_multi"
groups="base.group_extended"/>
</data>
</openerp>

View File

@ -30,17 +30,16 @@ class report_project_task_user(osv.osv):
'name': fields.char('Task Summary', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'year': fields.char('Year',size=64,required=False, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'user_id':fields.many2one('res.users', 'Assigned To', readonly=True),
'date_start': fields.datetime('Starting Date',readonly=True),
'no_of_days': fields.integer('#Days', size=128, readonly=True),
'description': fields.text('Description',readonly=True),
'date_end': fields.datetime('Ending Date',readonly=True),
'date_end': fields.date('Ending Date',readonly=True),
'date_deadline': fields.date('Deadline',readonly=True),
'project_id':fields.many2one('project.project', 'Project', readonly=True),
'hours_planned': fields.float('Planned Hours', readonly=True),
'hours_effective': fields.float('Effective Hours', readonly=True),
'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
# 'closing_days': fields.char('Avg Closing Delay', size=64, readonly=True),
'closing_days': fields.float('Avg Closing Delay', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Days to close the task"),
@ -102,7 +101,6 @@ class report_project_task_user(osv.osv):
t.state,
date_trunc('day',t.date_end),
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY'),
date_trunc('day',t.date_start),
t.company_id,
t.partner_id,
t.type,

View File

@ -79,13 +79,17 @@
help = "Pending tasks"/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection">
<filter icon="terp-project"
string="My Task"
help = "My tasks"
domain="[('user_id','=',uid)]" />
<filter icon="terp-project"
string="Non Assigned Tasks to users"
help="Non Assigned Tasks to users"
domain="[('user_id','=',False)]"/>
</field>
<field name="project_id" widget="selection">
<filter icon="terp-project"
<field name="project_id">
<filter icon="terp-project"
string="My Task"
help="My Tasks"
domain="[('project_id','=',context.get('project_id', False)]"/>
@ -139,7 +143,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_task_project_user_search"/>
<field name="context">{'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<menuitem action="action_project_task_user_tree" id="menu_project_task_user_tree" parent="base.menu_project_report"/>

View File

@ -31,8 +31,8 @@
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': [
'crm',
'project',
'hr_timesheet_sheet',
],
'init_xml': [
'project_issue_data.xml'

Some files were not shown because too many files have changed in this diff Show More