diff --git a/addons/account/project/project.py b/addons/account/project/project.py
index 60a1704bb2d..b4cc3468e5f 100644
--- a/addons/account/project/project.py
+++ b/addons/account/project/project.py
@@ -43,32 +43,17 @@ class account_analytic_account(osv.osv):
_description = 'Analytic Accounts'
def _credit_calc(self, cr, uid, ids, name, arg, context={}):
- if 'date_start' in context and context['date_start']:
- date_start = context['date_start']
- else:
- date_start = time.strftime('%Y-01-01')
- if 'date_stop' in context and context['date_stop']:
- date_stop = context['date_stop']
- else:
- date_stop = time.strftime('%Y-%m-%d')
acc_set = ",".join(map(str, ids))
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE l.amount<0 and a.id IN (%s) AND (l.date BETWEEN '%s' and '%s') GROUP BY a.id" % (acc_set,date_start,date_stop))
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE l.amount<0 and a.id IN (%s) GROUP BY a.id" % acc_set)
r= dict(cr.fetchall())
for i in ids:
r.setdefault(i,0.0)
return r
def _debit_calc(self, cr, uid, ids, name, arg, context={}):
- if 'date_start' in context and context['date_start']:
- date_start = context['date_start']
- else:
- date_start = time.strftime('%Y-01-01')
- if 'date_stop' in context and context['date_stop']:
- date_stop = context['date_stop']
- else:
- date_stop = time.strftime('%Y-%m-%d')
+
acc_set = ",".join(map(str, ids))
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE l.amount>0 and a.id IN (%s) AND (l.date BETWEEN '%s' and '%s') GROUP BY a.id" % (acc_set,date_start,date_stop))
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE l.amount>0 and a.id IN (%s) GROUP BY a.id" % acc_set)
r= dict(cr.fetchall())
for i in ids:
r.setdefault(i,0.0)
@@ -77,18 +62,9 @@ class account_analytic_account(osv.osv):
def _balance_calc(self, cr, uid, ids, name, arg, context={}):
- if 'date_start' in context and context['date_start']:
- date_start = context['date_start']
- else:
- date_start = time.strftime('%Y-01-01')
- if 'date_stop' in context and context['date_stop']:
- date_stop = context['date_stop']
- else:
- date_stop = time.strftime('%Y-%m-%d')
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
acc_set = ",".join(map(str, ids2))
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE a.id IN (%s) AND (l.date BETWEEN '%s' and '%s') GROUP BY a.id" % (acc_set,date_start,date_stop))
-# cr.execute("select a.id, COALESCE(SUM(l.amount),0) from account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) where (l.date BETWEEN '2008-10-01' AND '2008-10-03') GROUP BY a.id")
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id) WHERE a.id IN (%s) GROUP BY a.id" % acc_set)
res = {}
for account_id, sum in cr.fetchall():
res[account_id] = sum
@@ -115,21 +91,13 @@ class account_analytic_account(osv.osv):
return dict([(i, res[i]) for i in ids ])
def _quantity_calc(self, cr, uid, ids, name, arg, context={}):
-# XXX must convert into one uom
- if 'date_start' in context and context['date_start']:
- date_start = context['date_start']
- else:
- date_start = time.strftime('%Y-01-01')
- if 'date_stop' in context and context['date_stop']:
- date_stop = context['date_stop']
- else:
- date_stop = time.strftime('%Y-%m-%d')
+ #XXX must convert into one uom
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)])
acc_set = ",".join(map(str, ids2))
- cr.execute("SELECT a.id, COALESCE(SUM(l.unit_amount), 0) \
+ cr.execute('SELECT a.id, COALESCE(SUM(l.unit_amount), 0) \
FROM account_analytic_account a \
LEFT JOIN account_analytic_line l ON (a.id = l.account_id) \
- WHERE a.id IN (%s) AND (l.date BETWEEN '%s' and '%s') GROUP BY a.id" % (acc_set,date_start,date_stop))
+ WHERE a.id IN ('+acc_set+') GROUP BY a.id')
res = {}
for account_id, sum in cr.fetchall():
res[account_id] = sum
@@ -139,8 +107,6 @@ class account_analytic_account(osv.osv):
if child <> id:
res.setdefault(id, 0.0)
res[id] += res.get(child, 0.0)
- if not id in res:
- res.setdefault(id, 0.0)
return dict([(i, res[i]) for i in ids])
def name_get(self, cr, uid, ids, context={}):
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
index 11975d9a6b8..74ce6a354e9 100644
--- a/addons/account/project/project_view.xml
+++ b/addons/account/project/project_view.xml
@@ -88,25 +88,12 @@
form,graph
-
-
-
-
-
-
-
New Analytic Account
account.analytic.account
diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py
index 66cce97becb..477e5262a00 100644
--- a/addons/account/project/wizard/__init__.py
+++ b/addons/account/project/wizard/__init__.py
@@ -35,7 +35,6 @@ import wizard_account_analytic_cost_ledger_report
import wizard_account_analytic_cost_ledger_for_journal_report
import wizard_account_analytic_analytic_check
import wizard_account_analytic_line
-import wizard_account_analytic_line1
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/wizard_account_analytic_line1.py b/addons/account/project/wizard/wizard_account_analytic_line1.py
deleted file mode 100644
index c8e0d3952e6..00000000000
--- a/addons/account/project/wizard/wizard_account_analytic_line1.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# -*- encoding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import wizard
-import pooler
-import time
-
-def _action_open_window(self, cr, uid, data, context):
- domain=[]
- cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('account.analytic.account.tree', 'tree'))
- view_res = cr.fetchone()
- return {
- 'name': 'Analytic Entries',
- 'view_type': 'tree',
- "view_mode": 'tree,form',
- 'res_model': 'account.analytic.account',
- 'type': 'ir.actions.act_window',
- 'view_id' : view_res,
- 'domain' :[('parent_id','=',False)],
- 'context':{'date_start':data['form']['from_date'],'date_stop':data['form']['to_date']},
- }
-
-
-class account_analytic_line1(wizard.interface):
- form1 = '''
- '''
- form1_fields = {
- 'from_date': {
- 'string': 'From',
- 'type': 'date',
- },
- 'to_date': {
- 'string': 'To',
- 'type': 'date',
- },
- }
-
- states = {
- 'init': {
- 'actions': [],
- 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Entries','gtk-ok')]}
- },
- 'open': {
- 'actions': [],
- 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'}
- }
- }
-account_analytic_line1('account.analytic.line1')
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index be2c3f74ca1..d9da837198f 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -35,13 +35,13 @@ class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'sale_warn' : fields.boolean('Sale Order'),
- 'sale_warn_msg' : fields.char('Message for Sale Order', size=64),
+ 'sale_warn_msg' : fields.text('Message for Sale Order'),
'purchase_warn' : fields.boolean('Purchase Order'),
- 'purchase_warn_msg' : fields.char('Message for Purchase Order', size=64),
+ 'purchase_warn_msg' : fields.text('Message for Purchase Order'),
'picking_warn' : fields.boolean('Stock Picking'),
- 'picking_warn_msg' : fields.char('Message for Stock Picking', size=64),
+ 'picking_warn_msg' : fields.text('Message for Stock Picking'),
'invoice_warn' : fields.boolean('Invoice'),
- 'invoice_warn_msg' : fields.char('Message for Invoice', size=64),
+ 'invoice_warn_msg' : fields.text('Message for Invoice'),
}
res_partner()
@@ -56,8 +56,10 @@ class sale_order(osv.osv):
message=False
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.sale_warn:
- title= "Message",
- message=partner.sale_warn_msg
+ warning={
+ 'title': "Message",
+ 'message': partner.sale_warn_msg
+ }
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
if result.get('warning',False):
@@ -132,9 +134,9 @@ class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
'sale_line_warn' : fields.boolean('Sale Order Line'),
- 'sale_line_warn_msg' : fields.char('Message for Sale Order Line', size=64),
+ 'sale_line_warn_msg' : fields.text('Message for Sale Order Line'),
'purchase_line_warn' : fields.boolean('Purchase Order Line'),
- 'purchase_line_warn_msg' : fields.char('Message for Purchase Order Line', size=64),
+ 'purchase_line_warn_msg' : fields.text('Message for Purchase Order Line'),
}
product_product()