[FIX][IMP] all modules improvement.

bzr revid: amp@tinyerp.com-20110429084948-x0pny8n2ersc4h8m
This commit is contained in:
AVP(Axelor) 2011-04-29 14:19:48 +05:30 committed by AMP (OpenERP)
parent d553615695
commit cc3d7333c8
55 changed files with 96 additions and 201 deletions

View File

@ -926,9 +926,8 @@ class account_period(osv.osv):
def action_draft(self, cr, uid, ids, *args):
mode = 'draft'
for id in ids:
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
cr.execute('update account_period set state=%s where id=%s', (mode, id))
cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids),))
cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids),))
return True
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
@ -2659,8 +2658,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(wizard_multi_charts_accounts, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
configured_cmp = []
unconfigured_cmp = []
cmp_select = []
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
#display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
@ -2668,12 +2665,12 @@ class wizard_multi_charts_accounts(osv.osv_memory):
configured_cmp = [r[0] for r in cr.fetchall()]
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
for field in res['fields']:
if field == 'company_id':
res['fields'][field]['domain'] = unconfigured_cmp
res['fields'][field]['selection'] = [('', '')]
if unconfigured_cmp:
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
res['fields'][field]['selection'] = cmp_select
if field == 'company_id':
res['fields'][field]['domain'] = unconfigured_cmp
res['fields'][field]['selection'] = [('', '')]
if unconfigured_cmp:
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
res['fields'][field]['selection'] = cmp_select
return res
def execute(self, cr, uid, ids, context=None):
@ -2681,7 +2678,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
obj_acc = self.pool.get('account.account')
obj_acc_tax = self.pool.get('account.tax')
obj_journal = self.pool.get('account.journal')
obj_sequence = self.pool.get('ir.sequence')
obj_acc_template = self.pool.get('account.account.template')
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
obj_fiscal_position = self.pool.get('account.fiscal.position')
@ -2689,9 +2685,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
analytic_journal_obj = self.pool.get('account.analytic.journal')
obj_tax_code = self.pool.get('account.tax.code')
obj_tax_code_template = self.pool.get('account.tax.code.template')
obj_acc_journal_view = self.pool.get('account.journal.view')
ir_values = self.pool.get('ir.values')
obj_product = self.pool.get('product.product')
# Creating Account
obj_acc_root = obj_multi.chart_template_id.account_root_id
tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
@ -2946,8 +2940,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
acc_cash_id = obj_acc.create(cr,uid,vals)
#create the bank journal
analytical_bank_ids = analytic_journal_obj.search(cr,uid,[('type','=','situation')])
analytical_journal_bank = analytical_bank_ids and analytical_bank_ids[0] or False
vals_journal = {
'name': vals['name'],
'code': _('BNK') + str(current_num),

View File

@ -90,8 +90,6 @@ class account_installer(osv.osv_memory):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
res = super(account_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
configured_cmp = []
unconfigured_cmp = []
cmp_select = []
company_ids = self.pool.get('res.company').search(cr, uid, [], context=context)
#display in the widget selection of companies, only the companies that haven't been configured yet (but don't care about the demo chart of accounts)
@ -99,12 +97,12 @@ class account_installer(osv.osv_memory):
configured_cmp = [r[0] for r in cr.fetchall()]
unconfigured_cmp = list(set(company_ids)-set(configured_cmp))
for field in res['fields']:
if field == 'company_id':
res['fields'][field]['domain'] = unconfigured_cmp
res['fields'][field]['selection'] = [('', '')]
if unconfigured_cmp:
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
res['fields'][field]['selection'] = cmp_select
if field == 'company_id':
res['fields'][field]['domain'] = unconfigured_cmp
res['fields'][field]['selection'] = [('', '')]
if unconfigured_cmp:
cmp_select = [(line.id, line.name) for line in self.pool.get('res.company').browse(cr, uid, unconfigured_cmp)]
res['fields'][field]['selection'] = cmp_select
return res
def on_change_tax(self, cr, uid, id, tax):
@ -126,11 +124,8 @@ class account_installer(osv.osv_memory):
obj_acc_temp = self.pool.get('account.account.template')
obj_tax_code_temp = self.pool.get('account.tax.code.template')
obj_tax_temp = self.pool.get('account.tax.template')
obj_product = self.pool.get('product.product')
ir_values = self.pool.get('ir.values')
obj_acc_chart_temp = self.pool.get('account.chart.template')
record = self.browse(cr, uid, ids, context=context)[0]
company_id = record.company_id
for res in self.read(cr, uid, ids, context=context):
if record.charts == 'configurable':
fp = tools.file_open(opj('account', 'configurable_account_chart.xml'))

View File

@ -38,7 +38,6 @@ class account_analytic_balance(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]

View File

@ -38,7 +38,6 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]

View File

@ -37,7 +37,6 @@ class account_analytic_cost_ledger(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]

View File

@ -37,7 +37,6 @@ class account_analytic_inverted_balance(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]

View File

@ -37,7 +37,6 @@ class account_analytic_journal_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids)[0]

View File

@ -22,36 +22,36 @@ from osv import fields, osv
from tools.translate import _
class project_account_analytic_line(osv.osv_memory):
_name = "project.account.analytic.line"
_description = "Analytic Entries by line"
_columns = {
_name = "project.account.analytic.line"
_description = "Analytic Entries by line"
_columns = {
'from_date': fields.date('From'),
'to_date': fields.date('To'),
}
def action_open_window(self, cr, uid, ids, context=None):
mod_obj =self.pool.get('ir.model.data')
domain = []
data = self.read(cr, uid, ids, [])[0]
from_date = data['from_date']
to_date = data['to_date']
if from_date and to_date:
domain = [('date','>=',from_date), ('date','<=',to_date)]
elif from_date:
domain = [('date','>=',from_date)]
elif to_date:
domain = [('date','<=',to_date)]
result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
id = result and result[1] or False
return {
'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
'type': 'ir.actions.act_window',
'domain': domain,
'search_view_id': id['res_id'],
}
def action_open_window(self, cr, uid, ids, context=None):
mod_obj =self.pool.get('ir.model.data')
domain = []
data = self.read(cr, uid, ids, [])[0]
from_date = data['from_date']
to_date = data['to_date']
if from_date and to_date:
domain = [('date','>=',from_date), ('date','<=',to_date)]
elif from_date:
domain = [('date','>=',from_date)]
elif to_date:
domain = [('date','<=',to_date)]
result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
id = result and result[1] or False
return {
'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
'type': 'ir.actions.act_window',
'domain': domain,
'search_view_id': id['res_id'],
}
project_account_analytic_line()

View File

@ -98,7 +98,6 @@ class account_balance_landscape(report_sxw.rml_parse):
ref_bal='nothing'
total_for_perc=[]
self.done_total=1
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
self.done_total=0
@ -116,9 +115,7 @@ class account_balance_landscape(report_sxw.rml_parse):
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
if self.done_total==1:
self.done_total==1
else:
if not self.done_total==1:
return [self.result_total]
accounts=[]
if not ids:
@ -127,7 +124,6 @@ class account_balance_landscape(report_sxw.rml_parse):
return []
ctx = self.context.copy()
result_total_parent=[]
for id in form['fiscalyear']:
tmp=[]
@ -142,7 +138,7 @@ class account_balance_landscape(report_sxw.rml_parse):
accounts.append(tmp)
merged_accounts=zip(*accounts)
# used to check for the frst record so all sum_credit and sum_debit r set to 0.00
# used to check for the frst record so all sum_credit and sum_debit r set to 0.00
if level==1:
doneAccount={}
for entry in merged_accounts:
@ -345,7 +341,6 @@ class account_balance_landscape(report_sxw.rml_parse):
def get_lines(self, year_dict, form):
final_result = []
line_l =[]
res = {}
line_l = self.lines(form)
self.cal_total(year_dict)
@ -357,21 +352,21 @@ class account_balance_landscape(report_sxw.rml_parse):
res['level'] = l['level']
for k,v in l.items():
if k.startswith('debit'+str(year_dict['last_str'])):
res['debit'] = v
res['debit'] = v
if k.startswith('credit'+str(year_dict['last_str'])):
res['credit'] = v
res['credit'] = v
if k.startswith('balance'+str(year_dict['last_str'])) and not k.startswith('balance_perc'+str(year_dict['last_str'])):
res['balance'] =v
res['balance'] =v
if k.startswith('balance_perc'+str(year_dict['last_str'])) and not k.startswith('balance'+str(year_dict['last_str'])):
res['balance_perc'] = v
res['balance_perc'] = v
if form['compare_pattern'] == 'bal_perc':
if k.startswith('bal_perc'+str(year_dict['last_str'])):
res['pattern'] = v
res['pattern'] = v
elif form['compare_pattern'] == 'bal_cash':
if k.startswith('bal_cash'+str(year_dict['last_str'])):
res['pattern'] = v
res['pattern'] = v
else:
res['pattern'] = ''
res['pattern'] = ''
final_result.append(res)
return final_result

View File

@ -242,7 +242,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
temp_res = 0.0
self.cr.execute(
"SELECT sum(debit) " \
"FROM account_move_line AS l " \
@ -261,7 +260,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
temp_res = 0.0
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line AS l " \
@ -281,7 +279,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
if not self.ids:
return 0.0
temp_res = 0.0
self.cr.execute(
"SELECT sum(debit-credit) " \
"FROM account_move_line AS l " \
@ -295,7 +292,6 @@ class partner_balance(report_sxw.rml_parse, common_report_header):
return temp_res
def _get_partners(self):
cr, uid = self.cr, self.uid
if self.result_selection == 'customer':
return _('Receivable Accounts')

View File

@ -118,7 +118,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
else:
amount = str(amount)
if (amount == '0'):
return ' '
return ' '
orig = amount
new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
if orig == new:
@ -402,14 +402,14 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
return currency_total
def _display_initial_balance(self, data):
if self.initial_balance:
return True
return False
if self.initial_balance:
return True
return False
def _display_currency(self, data):
if self.amount_currency:
return True
return False
if self.amount_currency:
return True
return False
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
'addons/account/report/account_partner_ledger.rml',parser=third_party_ledger,

View File

@ -101,14 +101,14 @@ class report_aged_receivable(osv.osv):
def _calc_bal(self, cr, uid, ids, name, args, context=None):
res = {}
for period in self.read(cr, uid, ids, ['name'], context=context):
date1,date2 = period['name'].split(' to ')
cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
date1,date2 = period['name'].split(' to ')
cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
AND (COALESCE(line.date,date) BETWEEN %s AND %s) \
AND (reconcile_id IS NULL) AND ac.active",(str(date2),str(date1),))
amount = cr.fetchone()
amount = amount[0] or 0.00
res[period['id']] = amount
amount = cr.fetchone()
amount = amount[0] or 0.00
res[period['id']] = amount
return res

View File

@ -38,10 +38,10 @@ class account_subscription_generate(osv.osv_memory):
act_obj = self.pool.get('ir.actions.act_window')
moves_created=[]
for data in self.read(cr, uid, ids, context=context):
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
line_ids = map(lambda x: x[0], cr.fetchall())
moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
moves_created.extend(moves)
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
line_ids = map(lambda x: x[0], cr.fetchall())
moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
moves_created.extend(moves)
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
id = result and result[1] or False
result = act_obj.read(cr, uid, [id], context=context)[0]

View File

@ -51,7 +51,6 @@ class account_tax_chart(osv.osv_memory):
"""
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
period_obj = self.pool.get('account.period')
if context is None:
context = {}
data = self.browse(cr, uid, ids, context=context)[0]

View File

@ -36,7 +36,6 @@ class account_budget_analytic(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]

View File

@ -36,7 +36,6 @@ class account_budget_crossvered_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]

View File

@ -38,7 +38,6 @@ class account_budget_crossvered_summary_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]

View File

@ -37,7 +37,6 @@ class account_budget_report(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}
data = self.read(cr, uid, ids, context=context)[0]

View File

@ -38,7 +38,6 @@ class account_invoice_1(report_sxw.rml_parse):
result = []
sub_total = {}
info = []
invoice_list = []
res = {}
list_in_seq = {}
ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])

View File

@ -46,7 +46,6 @@ class account_invoice_with_message(report_sxw.rml_parse):
result = []
sub_total = {}
info = []
invoice_list = []
res = {}
list_in_seq = {}
ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])

View File

@ -30,7 +30,6 @@ class account_invoice_special_msg(osv.osv_memory):
}
def check_report(self, cr, uid, ids, context=None):
datas = {}
if context is None:
context = {}

View File

@ -20,7 +20,6 @@
##############################################################################
from osv import fields,osv
from osv import orm
class analytic_journal_rate_grid(osv.osv):
@ -103,7 +102,6 @@ class account_invoice(osv.osv):
def _get_analytic_lines(self, cr, uid, id):
iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id)
inv = self.browse(cr, uid, [id])[0]
for il in iml:
if il['account_analytic_id'] and il.get('analytic_lines', False):

View File

@ -20,7 +20,6 @@
##############################################################################
from osv import fields,osv
from osv import orm
from tools.translate import _
class analytic_user_funct_grid(osv.osv):

View File

@ -293,13 +293,13 @@ class auction_lots(osv.osv):
result = lot.buyer_price - lot.seller_price - lot.costs
elif name == "gross_margin":
if ((lot.obj_price==0) and (lot.state=='draft')):
amount = lot.lot_est1
else:
amount = lot.obj_price
if amount > 0:
result = (lot.gross_revenue * 100) / amount
result = round(result,2)
if ((lot.obj_price==0) and (lot.state=='draft')):
amount = lot.lot_est1
else:
amount = lot.obj_price
if amount > 0:
result = (lot.gross_revenue * 100) / amount
result = round(result,2)
elif name == "net_margin":
if ((lot.obj_price==0) and (lot.state=='draft')):

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,10 +20,8 @@
##############################################################################
import pooler
import time
from report import report_sxw
from osv import osv
class buyer_form_report(report_sxw.rml_parse):
count=0
@ -51,7 +49,6 @@ class buyer_form_report(report_sxw.rml_parse):
def buyer_info(self):
objects = [object for object in self.localcontext.get('objects')]
ret_dict = {}
ret_list = []
for object in objects:
partner = ret_dict.get(object.ach_uid.id,False)
if not partner:

View File

@ -19,11 +19,8 @@
#
##############################################################################
import pooler
import time
from report import report_sxw
from osv import osv
from tools.translate import _
class buyer_list(report_sxw.rml_parse):
auc_lot_ids=[]
@ -66,7 +63,6 @@ class buyer_list(report_sxw.rml_parse):
return auct_dat
def lines_lots_auct_lot(self,obj):
auc_lot_ids = []
auc_date_ids = self.pool.get('auction.dates').search(self.cr, self.uid, ([('name','like',obj['name'])]))

View File

@ -19,22 +19,12 @@
#
##############################################################################
import datetime
import time
from report.interface import report_rml
from report.interface import toxml
import pooler
from osv import osv,orm
from time import strptime
from xml.dom import minidom
import sys
import os
import re
import netsvc
import base64
import wizard
import photo_shadow
from tools import config
import addons
def _to_unicode(s):
@ -75,11 +65,6 @@ class auction_catalog(report_rml):
catalog=doc.createElement('catalog')
doc.documentElement.appendChild(catalog)
infodb='info'
commdb='comm'
tab_avoid = []
tab_no_photo=[]
auction_lot_pool = pooler.get_pool(cr.dbname).get('auction.lots')
auction_dates_pool = pooler.get_pool(cr.dbname).get('auction.dates')
for auction in auction_dates_pool.browse(cr, uid, ids, context=context):
@ -89,7 +74,7 @@ class auction_catalog(report_rml):
categ.appendChild(doc.createTextNode(_to_decode(auction.name)))
catalog.appendChild(categ)
#Auctuion Date element
#Auctuion Date element
categ = doc.createElement("AuctionDate1")
categ.appendChild(doc.createTextNode(_to_decode(auction.auction1)))
catalog.appendChild(categ)
@ -133,7 +118,6 @@ class auction_catalog(report_rml):
infos.appendChild(lnum)
if cat.image:
import random
import tempfile
limg = doc.createElement('photo_small')

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,7 +20,6 @@
##############################################################################
import pooler
from osv.osv import osv, orm
from report.interface import report_rml
#FIXME: use the one from tools and delete the one from report
from report.int_to_text import int_to_text

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -19,7 +19,6 @@
#
##############################################################################
import pooler
import time
from report import report_sxw

View File

@ -20,15 +20,12 @@
##############################################################################
import pooler
import time
from report import report_sxw
from osv import osv
class seller_form_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(seller_form_report, self).__init__(cr, uid, name, context=context)
lot=self.pool.get('auction.lots').browse(cr, uid, uid)
self.localcontext.update({
'time': time,
@ -52,7 +49,6 @@ class seller_form_report(report_sxw.rml_parse):
def seller_info(self):
objects = [object for object in self.localcontext.get('objects')]
ret_dict = {}
ret_list = []
for object in objects:
partner = ret_dict.get(object.bord_vnd_id.partner_id.id,False)

View File

@ -19,13 +19,9 @@
#
##############################################################################
import os, time, datetime
import time
import netsvc
import netsvc, tools
import report.print_xml
import report.render
import report.common
from report.interface import report_rml
def toxml(val):
@ -47,7 +43,6 @@ class report_custom(report_rml):
unpaid_ids = []
buyer = {}
seller = {}
debit = 0
for l in lots:
if l['lot_est2']:

View File

@ -140,7 +140,7 @@ class auction_lots_send_aie(osv.osv_memory):
return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
def _photos_send(cr, uid, uname, passwd, did, ids):
def _photos_send(self,cr, uid, uname, passwd, did, ids):
service = netsvc.LocalService("object_proxy")
for (ref,id) in ids:
datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image'])
@ -179,7 +179,7 @@ class auction_lots_send_aie(osv.osv_memory):
}
def _send(self, cr, uid, ids, context=None):
import pickle, thread, sql_db
import pickle, thread
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
cr.close()

View File

@ -982,10 +982,9 @@ class calendar_event(osv.osv):
"""
if context is None:
context = {}
for event_id in ids:
cr.execute("select id from %s where recurrent_uid=%%s" % (self._table), (event_id,))
r_ids = map(lambda x: x[0], cr.fetchall())
self.unlink(cr, uid, r_ids, context=context)
cr.execute('select id from %s where recurrent_uid in %s', (self._table, tuple(ids),))
r_ids = map(lambda x: x[0], cr.fetchall())
self.unlink(cr, uid, r_ids, context=context)
return True
def _set_rrulestring(self, cr, uid, id, name, value, arg, context=None):
@ -1208,7 +1207,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
value = {}
if edit_all and rrule_type:
for id in ids:
base_calendar_id2real_id(id)
base_calendar_id2real_id(id)
return value
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):

View File

@ -19,17 +19,12 @@
#
##############################################################################
import time
import re
import os
import base64
import tools
from tools.translate import _
from osv import fields
from osv import osv
from osv import orm
from osv.orm import except_orm
import crm

View File

@ -51,7 +51,7 @@ class crm_lead2partner(osv.osv_memory):
rec_ids = context and context.get('active_ids', [])
for lead in lead_obj.browse(cr, uid, rec_ids, context=context):
if lead.partner_id:
raise osv.except_osv(_('Warning !'),
raise osv.except_osv(_('Warning !'),
_('A partner is already defined on this lead.'))
def default_get(self, cr, uid, fields, context=None):
@ -68,7 +68,6 @@ class crm_lead2partner(osv.osv_memory):
lead_obj = self.pool.get('crm.lead')
partner_obj = self.pool.get('res.partner')
contact_obj = self.pool.get('res.partner.address')
partner_id = False
data = list(context and context.get('active_ids', []) or [])
@ -206,9 +205,6 @@ class crm_lead2partner(osv.osv_memory):
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
mod_obj = self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'base', 'view_res_partner_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
return {'type': 'ir.actions.act_window_close'}
crm_lead2partner()

View File

@ -51,7 +51,6 @@ class crm_merge_opportunity(osv.osv_memory):
def get_attachments(self, cr, uid, id, context=None):
attach_obj = self.pool.get('ir.attachment')
result = []
attach_ids = attach_obj.search(cr, uid, [('res_model' , '=', 'crm.lead'), ('res_id', '=', id)])
return attach_ids

View File

@ -67,8 +67,12 @@ class crm_partner2opportunity(osv.osv_memory):
data = context and context.get('active_ids', []) or []
make_opportunity = self.pool.get('crm.partner2opportunity')
data_obj = self.pool.get('ir.model.data')
part_obj = self.pool.get('res.partner')
categ_obj = self.pool.get('crm.case.categ')
case_obj = self.pool.get('crm.lead')
for make_opportunity_obj in make_opportunity.browse(cr, uid, ids, context=context):
data_obj = self.pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
res = data_obj.read(cr, uid, result, ['res_id'])
@ -79,14 +83,9 @@ class crm_partner2opportunity(osv.osv_memory):
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
part_obj = self.pool.get('res.partner')
address = part_obj.address_get(cr, uid, data)
categ_obj = self.pool.get('crm.case.categ')
categ_ids = categ_obj.search(cr, uid, [('object_id.model','=','crm.lead')])
case_obj = self.pool.get('crm.lead')
opp_id = case_obj.create(cr, uid, {
'name' : make_opportunity_obj.name,
'planned_revenue' : make_opportunity_obj.planned_revenue,

View File

@ -22,7 +22,6 @@
import wizard
import pooler
import time
def _open_history_event(self, cr, uid, data, context=None):
pool = pooler.get_pool(cr.dbname)

View File

@ -243,7 +243,6 @@ class mrp_bom(osv.osv):
def _check_product(self, cr, uid, ids, context=None):
all_prod = []
bom_obj = self.pool.get('mrp.bom')
boms = self.browse(cr, uid, ids, context=context)
def check_bom(boms):
res = True
@ -672,10 +671,10 @@ class mrp_production(osv.osv):
res = True
for production in self.browse(cr, uid, ids):
if production.move_lines:
res = False
res = False
if production.move_created_ids:
res = False
res = False
return res
def action_produce(self, cr, uid, production_id, production_qty, production_mode, context=None):
@ -748,7 +747,7 @@ class mrp_production(osv.osv):
produced_qty = produced_products.get(produce_product.product_id.id, 0)
rest_qty = production.product_qty - produced_qty
if rest_qty <= production_qty:
production_qty = rest_qty
production_qty = rest_qty
if rest_qty > 0 :
stock_mov_obj.action_consume(cr, uid, [produce_product.id], production_qty, context=context)

View File

@ -24,9 +24,7 @@ from dateutil.relativedelta import relativedelta
from osv import fields
from osv import osv
from tools.translate import _
import ir
import netsvc
import time
class procurement_order(osv.osv):
_inherit = 'procurement.order'
@ -81,7 +79,6 @@ class procurement_order(osv.osv):
procurement_obj = self.pool.get('procurement.order')
for procurement in procurement_obj.browse(cr, uid, ids, context=context):
res_id = procurement.move_id.id
loc_id = procurement.location_id.id
newdate = datetime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - relativedelta(days=procurement.product_id.product_tmpl_id.produce_delay or 0.0)
newdate = newdate - relativedelta(days=company.manufacturing_lead)
produce_id = production_obj.create(cr, uid, {

View File

@ -82,7 +82,6 @@ class project(osv.osv):
def _progress_rate(self, cr, uid, ids, names, arg, context=None):
res = {}.fromkeys(ids, 0.0)
progress = {}
if not ids:
return res
cr.execute('''SELECT
@ -161,9 +160,9 @@ class project(osv.osv):
# TODO: Why not using a SQL contraints ?
def _check_dates(self, cr, uid, ids, context=None):
for leave in self.read(cr, uid, ids, ['date_start', 'date'], context=context):
if leave['date_start'] and leave['date']:
if leave['date_start'] > leave['date']:
return False
if leave['date_start'] and leave['date']:
if leave['date_start'] > leave['date']:
return False
return True
_constraints = [
@ -241,7 +240,6 @@ class project(osv.osv):
def duplicate_template(self, cr, uid, ids, context=None):
if context is None:
context = {}
task_pool = self.pool.get('project.task')
data_obj = self.pool.get('ir.model.data')
result = []
for proj in self.browse(cr, uid, ids, context=context):
@ -401,8 +399,8 @@ class task(osv.osv):
if not default.get('name', False):
default['name'] = self.browse(cr, uid, id, context=context).name or ''
if not context.get('copy',False):
new_name = _("%s (copy)")%default.get('name','')
default.update({'name':new_name})
new_name = _("%s (copy)")%default.get('name','')
default.update({'name':new_name})
return super(task, self).copy_data(cr, uid, id, default, context)
@ -572,7 +570,7 @@ class task(osv.osv):
project = task.project_id
res = self.do_close(cr, uid, [project_id], context=context)
if project.warn_manager or project.warn_customer:
return {
return {
'name': _('Send Email after close task'),
'view_type': 'form',
'view_mode': 'form',