diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 36b65d20dca..7350596c4e3 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -530,9 +530,8 @@ class account_move_line(osv.osv):
date = datetime.now().strftime('%Y-%m-%d')
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
- if part.property_payment_term and part.property_payment_term.line_ids:
- payterm = part.property_payment_term.line_ids[0]
- res = self.pool.get('account.payment.term').compute(cr, uid, payterm.id, 100, date)
+ if part.property_payment_term:
+ res = self.pool.get('account.payment.term').compute(cr, uid, part.property_payment_term.id, 100, date)
if res:
val['date_maturity'] = res[0][0]
if not account_id:
@@ -540,10 +539,10 @@ class account_move_line(osv.osv):
id2 = part.property_account_receivable.id
if journal:
jt = self.pool.get('account.journal').browse(cr, uid, journal).type
- if jt=='sale':
+ if jt == 'sale':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id2)
- elif jt=='purchase':
+ elif jt == 'purchase':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id1)
if val.get('account_id', False):
d = self.onchange_account_id(cr, uid, ids, val['account_id'])
diff --git a/addons/crm/report/crm_lead_report.py b/addons/crm/report/crm_lead_report.py
index 2c0fa8c8fc6..39806c50803 100644
--- a/addons/crm/report/crm_lead_report.py
+++ b/addons/crm/report/crm_lead_report.py
@@ -35,7 +35,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 +89,10 @@ 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),
+ 'email': fields.integer('# of Emails', size=128, readonly=True),
+ 'expected_closing_days': fields.integer('# of Expected Closing Days', size=128, readonly=True),
+ 'delay_open': fields.float('Delay to open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
'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,11 +101,10 @@ 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),
+ '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"),
}
def init(self, cr):
@@ -132,13 +134,28 @@ class crm_lead_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
+ (select count(id) from mailgate_message where thread_id=c.id) as email,
date_trunc('day',c.create_date) as create_date,
- avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
+ sum(cast(to_char(date_trunc('day',c.date_open) - date_trunc('day',c.date_deadline),'DD') as int)) as expected_closing_days,
+ avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
+ avg(extract('epoch' from (c.date_open-c.create_date)))/(3600*24) as delay_open
from
crm_lead c
- 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')
+ group by
+ to_char(c.create_date, 'YYYY'),
+ to_char(c.create_date, 'MM'),
+ c.state,
+ c.user_id,
+ c.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')
+
)""")
crm_lead_report()
diff --git a/addons/crm/report/crm_lead_report_view.xml b/addons/crm/report/crm_lead_report_view.xml
index da480d21dc0..770d9292b6f 100644
--- a/addons/crm/report/crm_lead_report_view.xml
+++ b/addons/crm/report/crm_lead_report_view.xml
@@ -144,7 +144,7 @@
crm.lead.report
tree
-
+
@@ -153,7 +153,10 @@
-
+
+
+
+
@@ -188,8 +191,8 @@
-
- Opportunities
+
+ Opportunities Analysis
crm.lead.report
form
{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}
@@ -216,7 +219,7 @@
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_lead" />
-
diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py
index ce468422b7f..2eaf0adb4a6 100644
--- a/addons/stock_invoice_directly/wizard/stock_invoice.py
+++ b/addons/stock_invoice_directly/wizard/stock_invoice.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL ().
#
@@ -15,62 +15,32 @@
# 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 .
+# along with this program. If not, see .
#
##############################################################################
-import wizard
-import pooler
-import netsvc
+from osv import fields, osv
+from tools.translate import _
-class invoice_directly(wizard.interface):
- def _test_action(obj, cr, uid, data, context):
- pool = pooler.get_pool(cr.dbname)
- pick = pool.get('stock.picking').browse(cr, uid, data['id'], context=context)
- if not pick.invoice_state == '2binvoiced':
- return 'end_final'
- return 'invoice'
+class invoice_directly(osv.osv_memory):
+ _inherit = 'stock.partial.picking'
- def _open_action(obj, cr, uid, data, context):
- res = {
- 'name': 'stock.invoice_onshipping',
- 'type': 'ir.actions.wizard',
- 'wiz_name': 'stock.invoice_onshipping'
- }
- if data['form'].get('new_picking', False):
- res['context'] = "{'new_picking':%d}" % (data['form']['new_picking'],)
- return res
+ def do_partial(self, cr, uid, ids, context):
+ result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
+ pick_obj = self.pool.get('stock.picking')
+ picking_ids = context.get('active_ids', False)
+ pick = pick_obj.browse(cr, uid, picking_ids, context)[0]
+ if pick.invoice_state=='2binvoiced':
+ return {
+ 'name': 'Create Invoice',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'stock.invoice.onshipping',
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ }
+ return {}
- end_final = {
- 'actions':[],
- 'result': {
- 'type': 'state',
- 'state': 'end',
- }
- }
-
- choice = {
- 'actions':[],
- 'result': {
- 'type': 'choice',
- 'next_state': _test_action,
- }
- }
-
- call_invoice = {
- 'actions':[],
- 'result': {
- 'type': 'action',
- 'action': _open_action,
- 'state': 'end'
- }
- }
- def __init__(self, *args):
- service = netsvc.LocalService("wizard.stock.partial_picking")
- service._service.states['split']['result']['state'] = 'test_choice'
- service._service.states['invoice'] = self.call_invoice
- service._service.states['test_choice'] = self.choice
- service._service.states['end_final'] = self.end_final
-invoice_directly('stock.picking.invoice.directly')
+invoice_directly()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi.moved b/addons/thunderbird/plugin/tiny_plugin-2.0.xpi.moved
deleted file mode 100644
index ef42a9a0c14..00000000000
Binary files a/addons/thunderbird/plugin/tiny_plugin-2.0.xpi.moved and /dev/null differ