[FIX] unmutable default in the remaining modules
[REF] coding style consistency lp bug: https://launchpad.net/bugs/525808 fixed bzr revid: ls@numerigraphe.fr-20120305184003-er00xtj9vtcw7gna
This commit is contained in:
parent
520e2c680f
commit
2d2a44dcf2
|
@ -1,43 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
#class sale_order_line(osv.osv):
|
||||
# _name = 'sale.order.line'
|
||||
# _description = 'Sale Order line'
|
||||
# _inherit = 'sale.order.line'
|
||||
#
|
||||
# def invoice_line_create(self, cr, uid, ids, context={}):
|
||||
# line_ids = super('sale_order_line',self).invoice_line_create(cr, uid, ids, context)
|
||||
# invoice_line_obj = self.pool.get('account.invoice.line')
|
||||
# for line in invoice_line_obj.browse(cr, uid, line_ids):
|
||||
# if line.product_id:
|
||||
# a = line.product_id.product_tmpl_id.property_stock_account_output and line.product_id.product_tmpl_id.property_stock_account_output.id
|
||||
# if not a:
|
||||
# a = line.product_id.categ_id.property_stock_account_output_categ and line.product_id.categ_id.property_stock_account_output_categ.id
|
||||
# if a:
|
||||
# a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
|
||||
# invoice_line_obj.write(cr, uid, line.id, {'account_id':a})
|
||||
#
|
||||
#sale_order_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -75,7 +75,7 @@ class account_asset_asset(osv.osv):
|
|||
_name = 'account.asset.asset'
|
||||
_description = 'Asset'
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
periods = self.pool.get('account.period').find(cr, uid)
|
||||
if periods:
|
||||
return periods[0]
|
||||
|
@ -176,7 +176,9 @@ class account_asset_asset(osv.osv):
|
|||
year = depreciation_date.year
|
||||
return True
|
||||
|
||||
def validate(self, cr, uid, ids, context={}):
|
||||
def validate(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
return self.write(cr, uid, ids, {
|
||||
'state':'open'
|
||||
}, context)
|
||||
|
@ -304,7 +306,7 @@ class account_asset_asset(osv.osv):
|
|||
default.update({'depreciation_line_ids': [], 'state': 'draft'})
|
||||
return super(account_asset_asset, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def _compute_entries(self, cr, uid, ids, period_id, context={}):
|
||||
def _compute_entries(self, cr, uid, ids, period_id, context=None):
|
||||
result = []
|
||||
period_obj = self.pool.get('account.period')
|
||||
depreciation_obj = self.pool.get('account.asset.depreciation.line')
|
||||
|
|
|
@ -35,7 +35,9 @@ class analytic_account_budget_report(report_sxw.rml_parse):
|
|||
})
|
||||
self.context = context
|
||||
|
||||
def funct(self, object, form, ids={}, done=None, level=1):
|
||||
def funct(self, object, form, ids=None, done=None, level=1):
|
||||
if ids is None:
|
||||
ids = {}
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
if not done:
|
||||
|
|
|
@ -34,7 +34,9 @@ class budget_report(report_sxw.rml_parse):
|
|||
})
|
||||
self.context = context
|
||||
|
||||
def funct(self, object, form, ids={}, done=None, level=1):
|
||||
def funct(self, object, form, ids=None, done=None, level=1):
|
||||
if ids is None:
|
||||
ids = {}
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
if not done:
|
||||
|
|
|
@ -37,7 +37,9 @@ class budget_report(report_sxw.rml_parse):
|
|||
})
|
||||
self.context = context
|
||||
|
||||
def funct(self, object, form, ids={}, done=None, level=1):
|
||||
def funct(self, object, form, ids=None, done=None, level=1):
|
||||
if ids is None:
|
||||
ids = {}
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
if not done:
|
||||
|
|
|
@ -217,7 +217,9 @@ class coda_bank_statement(osv.osv):
|
|||
_name = 'coda.bank.statement'
|
||||
_description = 'CODA Bank Statement'
|
||||
|
||||
def _default_journal_id(self, cr, uid, context={}):
|
||||
def _default_journal_id(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('journal_id', False):
|
||||
return context['journal_id']
|
||||
return False
|
||||
|
@ -233,7 +235,7 @@ class coda_bank_statement(osv.osv):
|
|||
res[r] = round(res[r], 2)
|
||||
return res
|
||||
|
||||
def _get_period(self, cr, uid, context={}):
|
||||
def _get_period(self, cr, uid, context=None):
|
||||
periods = self.pool.get('account.period').find(cr, uid)
|
||||
if periods:
|
||||
return periods[0]
|
||||
|
|
|
@ -26,7 +26,7 @@ from tools.translate import _
|
|||
class account_move_line(osv.osv):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
def amount_to_pay(self, cr, uid, ids, name, arg={}, context=None):
|
||||
def amount_to_pay(self, cr, uid, ids, name, arg=None, context=None):
|
||||
""" Return the amount still to pay regarding all the payemnt orders
|
||||
(excepting cancelled orders)"""
|
||||
if not ids:
|
||||
|
|
|
@ -139,7 +139,9 @@ class payment_order(osv.osv):
|
|||
wf_service.trg_validate(uid, 'payment.order', ids[0], 'done', cr)
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default.update({
|
||||
'state': 'draft',
|
||||
'line_ids': [],
|
||||
|
|
|
@ -1251,7 +1251,9 @@ class account_voucher(osv.osv):
|
|||
move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id)
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default.update({
|
||||
'state': 'draft',
|
||||
'number': False,
|
||||
|
|
|
@ -219,7 +219,7 @@ class account_analytic_account(osv.osv):
|
|||
default['line_ids'] = []
|
||||
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def on_change_partner_id(self, cr, uid, id, partner_id, context={}):
|
||||
def on_change_partner_id(self, cr, uid, id, partner_id, context=None):
|
||||
if not partner_id:
|
||||
return {'value': {'contact_id': False}}
|
||||
addr = self.pool.get('res.partner').address_get(cr, uid, [partner_id], ['invoice'])
|
||||
|
|
|
@ -533,7 +533,7 @@ class auction_lots(osv.osv):
|
|||
return self._sum_taxes_by_type_and_id(costs)
|
||||
|
||||
# sum remise limite net and ristourne
|
||||
def compute_seller_costs_summed(self, cr, uid, ids): #ach_pay_id
|
||||
def compute_seller_costs_summed(self, cr, uid, ids):
|
||||
|
||||
"""This Fuction sum Net remittance limit and refund"""
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ class audittrail_objects_proxy(object_proxy):
|
|||
res = value
|
||||
return res
|
||||
|
||||
def create_log_line(self, cr, uid, log_id, model, lines=[]):
|
||||
def create_log_line(self, cr, uid, log_id, model, lines=None):
|
||||
"""
|
||||
Creates lines for changed fields with its old and new values
|
||||
|
||||
|
@ -210,6 +210,8 @@ class audittrail_objects_proxy(object_proxy):
|
|||
@param model: Object which values are being changed
|
||||
@param lines: List of values for line is to be created
|
||||
"""
|
||||
if lines is None:
|
||||
lines = []
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj_pool = pool.get(model.model)
|
||||
model_pool = pool.get('ir.model')
|
||||
|
@ -348,7 +350,7 @@ class audittrail_objects_proxy(object_proxy):
|
|||
data[(model.id, resource_id)] = {'text':values_text, 'value': values}
|
||||
return data
|
||||
|
||||
def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=[]):
|
||||
def prepare_audittrail_log_line(self, cr, uid, pool, model, resource_id, method, old_values, new_values, field_list=None):
|
||||
"""
|
||||
This function compares the old data (i.e before the method was executed) and the new data
|
||||
(after the method was executed) and returns a structure with all the needed information to
|
||||
|
@ -378,6 +380,8 @@ class audittrail_objects_proxy(object_proxy):
|
|||
record (res.partner, for example), we may have to log a change done in a x2many field (on
|
||||
res.partner.address, for example)
|
||||
"""
|
||||
if field_list is None:
|
||||
field_list = []
|
||||
key = (model.id, resource_id)
|
||||
lines = {
|
||||
key: []
|
||||
|
@ -416,7 +420,7 @@ class audittrail_objects_proxy(object_proxy):
|
|||
lines[key].append(data)
|
||||
return lines
|
||||
|
||||
def process_data(self, cr, uid, pool, res_ids, model, method, old_values={}, new_values={}, field_list=[]):
|
||||
def process_data(self, cr, uid, pool, res_ids, model, method, old_values=None, new_values=None, field_list=None):
|
||||
"""
|
||||
This function processes and iterates recursively to log the difference between the old
|
||||
data (i.e before the method was executed) and the new data and creates audittrail log
|
||||
|
|
|
@ -175,7 +175,7 @@ class res_partner_address(osv.osv):
|
|||
ids = self.pool.get('res.partner.location').search(cr, uid, [('partner_id','=',context['default_partner_id'])], context=context)
|
||||
return ids and ids[0] or False
|
||||
|
||||
def onchange_location_id(self,cr, uid, ids, location_id=False, context={}):
|
||||
def onchange_location_id(self, cr, uid, ids, location_id=False, context=None):
|
||||
if not location_id:
|
||||
return {}
|
||||
location = self.pool.get('res.partner.location').browse(cr, uid, location_id, context=context)
|
||||
|
@ -209,7 +209,7 @@ class res_partner_address(osv.osv):
|
|||
'name' : fields.related('contact_id', 'name', type='char', size=64, string="Contact Name", store=True),
|
||||
'title' : fields.related('contact_id', 'title', type='many2one', relation='res.partner.title', string="Title", store=True),
|
||||
}
|
||||
def create(self, cr, uid, data, context={}):
|
||||
def create(self, cr, uid, data, context=None):
|
||||
if not data.get('location_id', False):
|
||||
loc_id = self.pool.get('res.partner.location').create(cr, uid, {
|
||||
'street': data.get('street',''),
|
||||
|
@ -241,7 +241,7 @@ class res_partner_address(osv.osv):
|
|||
'location_id': _default_location_id
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields=[], context=None):
|
||||
def default_get(self, cr, uid, fields=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if 'default_type' in context:
|
||||
|
|
|
@ -45,7 +45,9 @@ from service import security
|
|||
|
||||
magic_md5 = '$1$'
|
||||
|
||||
def gen_salt( length=8, symbols=ascii_letters + digits ):
|
||||
def gen_salt( length=8, symbols=None):
|
||||
if symbols is None:
|
||||
symbols = ascii_letters + digits
|
||||
seed()
|
||||
return ''.join( sample( symbols, length ) )
|
||||
|
||||
|
|
|
@ -115,7 +115,9 @@ class abstract_quality_check(object):
|
|||
self.log.debug('get_objects() obj_list: %s', ','.join(obj_list))
|
||||
return obj_list
|
||||
|
||||
def get_model_ids(self, cr, uid, models=[]):
|
||||
def get_model_ids(self, cr, uid, models=None):
|
||||
if models is None:
|
||||
models = []
|
||||
# This function returns all ids of the given objects..
|
||||
if not models:
|
||||
return []
|
||||
|
@ -133,7 +135,12 @@ class abstract_quality_check(object):
|
|||
result_ids[obj] = ids
|
||||
return result_ids
|
||||
|
||||
def format_table(self, header=[], data_list={}): #This function can work forwidget="text_wiki"
|
||||
def format_table(self, header=None, data_list=None):
|
||||
#This function can work forwidget="text_wiki"
|
||||
if header is None:
|
||||
header = []
|
||||
if data_list is None:
|
||||
data_list = {}
|
||||
detail = ""
|
||||
detail += (header[0]) % tuple(header[1])
|
||||
frow = '\n|-'
|
||||
|
@ -144,7 +151,12 @@ class abstract_quality_check(object):
|
|||
detail = detail + '\n|}'
|
||||
return detail
|
||||
|
||||
def format_html_table(self, header=[], data_list=[]): #This function can work for widget="html_tag"
|
||||
def format_html_table(self, header=None, data_list=None):
|
||||
#This function can work for widget="html_tag"
|
||||
if header is None:
|
||||
header = []
|
||||
if data_list is None:
|
||||
data_list = []
|
||||
# function create html table....
|
||||
detail = ""
|
||||
detail += (header[0]) % tuple(header[1])
|
||||
|
|
|
@ -58,9 +58,11 @@ class DomApiGeneral:
|
|||
temp = string.replace("""%""","")
|
||||
return float(temp)/100
|
||||
|
||||
def findChildrenByName(self,parent,name,attr_dict={}):
|
||||
def findChildrenByName(self, parent, name, attr_dict=None):
|
||||
"""Helper functions. Does not work recursively.
|
||||
Optional: also test for certain attribute/value pairs."""
|
||||
if attr_dict is None:
|
||||
attr_dict = {}
|
||||
children = []
|
||||
for c in parent.childNodes:
|
||||
if c.nodeType == c.ELEMENT_NODE and c.nodeName == name:
|
||||
|
|
|
@ -215,7 +215,7 @@ class ConvertBracesToField( unohelper.Base, XJobExecutor ):
|
|||
sObject = self.getRes(sock,res[myval]['relation'], sVar[sVar.find("/")+1:])
|
||||
return sObject
|
||||
|
||||
def getBraces(self,aReportSyntex=[]):
|
||||
def getBraces(self, aReportSyntex=None):
|
||||
desktop=getDesktop()
|
||||
doc = desktop.getCurrentComponent()
|
||||
aSearchString=[]
|
||||
|
|
|
@ -59,7 +59,13 @@ if __name__<>"package":
|
|||
database="test"
|
||||
uid = 1
|
||||
|
||||
def genTree(object,aList,insField,host,level=3, ending=[], ending_excl=[], recur=[], root='', actualroot=""):
|
||||
def genTree(object, aList, insField, host, level=3, ending=None, ending_excl=None, recur=None, root='', actualroot=""):
|
||||
if ending is None:
|
||||
ending = []
|
||||
if ending_excl is None:
|
||||
ending_excl = []
|
||||
if recur is None:
|
||||
recur = []
|
||||
try:
|
||||
global url
|
||||
sock=RPCSession(url)
|
||||
|
|
|
@ -10,7 +10,11 @@ import time
|
|||
|
||||
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
|
||||
|
||||
def get(object, level=3, ending=[], ending_excl=[], recur=[], root=''):
|
||||
def get(object, level=3, ending=None, ending_excl=None, recur=None, root=''):
|
||||
if ending is None:
|
||||
ending = []
|
||||
if ending_excl is None:
|
||||
ending_excl = []
|
||||
res = sock.execute('terp', 3, 'admin', 'account.invoice', 'fields_get')
|
||||
key = res.keys()
|
||||
key.sort()
|
||||
|
|
|
@ -65,10 +65,12 @@ class base_synchro_obj(osv.osv):
|
|||
# Return a list of changes: [ (date, id) ]
|
||||
#
|
||||
|
||||
def get_ids(self, cr, uid, object, dt, domain=[], context=None):
|
||||
return self._get_ids(cr, uid, object, dt, domain, context=context)
|
||||
def get_ids(self, cr, uid, object, dt, domain=None, context=None):
|
||||
return self._get_ids(cr, uid, object, dt, domain=domain, context=context)
|
||||
|
||||
def _get_ids(self, cr, uid, object, dt, domain=[], context=None):
|
||||
def _get_ids(self, cr, uid, object, dt, domain=None, context=None):
|
||||
if domain is None:
|
||||
domain = []
|
||||
result = []
|
||||
if dt:
|
||||
domain2 = domain+[('write_date','>=',dt)]
|
||||
|
|
|
@ -331,7 +331,9 @@ class crm_case(crm_base):
|
|||
And object that inherit (orm inheritance) from a class the overwrite copy
|
||||
"""
|
||||
|
||||
def stage_find(self, cr, uid, section_id, domain=[], order='sequence'):
|
||||
def stage_find(self, cr, uid, section_id, domain=None, order='sequence'):
|
||||
if domain is None:
|
||||
domain = []
|
||||
domain = list(domain)
|
||||
if section_id:
|
||||
domain.append(('section_ids', '=', section_id))
|
||||
|
|
|
@ -239,7 +239,7 @@ class crm_lead(crm_case, osv.osv):
|
|||
def on_change_optout(self, cr, uid, ids, optout):
|
||||
return {'value':{'optout':optout,'optin':False}}
|
||||
|
||||
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):
|
||||
def onchange_stage_id(self, cr, uid, ids, stage_id, context=None):
|
||||
if not stage_id:
|
||||
return {'value':{}}
|
||||
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
|
||||
|
|
|
@ -157,7 +157,7 @@ class crm_claim(crm.crm_case, osv.osv):
|
|||
self.write(cr, uid, [res_id], vals, context=context)
|
||||
return res_id
|
||||
|
||||
def message_update(self, cr, uid, ids, msg, vals={}, default_act='pending', context=None):
|
||||
def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
ids = [ids]
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class crm_helpdesk(crm.crm_case, osv.osv):
|
|||
self.write(cr, uid, [res_id], vals, context)
|
||||
return res_id
|
||||
|
||||
def message_update(self, cr, uid, ids, msg, vals={}, default_act='pending', context=None):
|
||||
def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
ids = [ids]
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ def _get_parents(cr, uid, ids):
|
|||
return ids_to_check
|
||||
|
||||
|
||||
def test_prof(cr, uid, seg_id, pid, answers_ids = []):
|
||||
def test_prof(cr, uid, seg_id, pid, answers_ids=None):
|
||||
|
||||
""" return True if the partner pid fetch the segmentation rule seg_id
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
|
|
@ -146,7 +146,7 @@ class document_file(osv.osv):
|
|||
_sql_constraints = [
|
||||
# filename_uniq is not possible in pure SQL
|
||||
]
|
||||
def _check_duplication(self, cr, uid, vals, ids=[], op='create'):
|
||||
def _check_duplication(self, cr, uid, vals, ids=None, op='create'):
|
||||
name = vals.get('name', False)
|
||||
parent_id = vals.get('parent_id', False)
|
||||
res_model = vals.get('res_model', False)
|
||||
|
|
|
@ -237,7 +237,7 @@ class document_directory(osv.osv):
|
|||
default.update({'name': name+ " (copy)"})
|
||||
return super(document_directory,self).copy(cr, uid, id, default, context=context)
|
||||
|
||||
def _check_duplication(self, cr, uid, vals, ids=[], op='create'):
|
||||
def _check_duplication(self, cr, uid, vals, ids=None, op='create'):
|
||||
name=vals.get('name',False)
|
||||
parent_id=vals.get('parent_id',False)
|
||||
ressource_parent_type_id=vals.get('ressource_parent_type_id',False)
|
||||
|
|
|
@ -435,7 +435,9 @@ class node_database(node_class):
|
|||
|
||||
"""
|
||||
our_type = 'database'
|
||||
def __init__(self, path=[], parent=False, context=None):
|
||||
def __init__(self, path=None, parent=False, context=None):
|
||||
if path is None:
|
||||
path = []
|
||||
super(node_database,self).__init__(path, parent, context)
|
||||
self.unixperms = 040750
|
||||
self.uidperms = 5
|
||||
|
|
|
@ -682,7 +682,7 @@ class DAVClient(object):
|
|||
assert d2 == d, "Data does not match"
|
||||
return ctype, rrange, d
|
||||
|
||||
def gd_put(self, path, body=None, srcpath=None, mime=None, noclobber=False, ):
|
||||
def gd_put(self, path, body=None, srcpath=None, mime=None, noclobber=False):
|
||||
""" HTTP PUT
|
||||
@param noclobber will prevent overwritting a resource (If-None-Match)
|
||||
@param mime will set the content-type
|
||||
|
|
|
@ -338,7 +338,7 @@ class _html2text(sgmllib.SGMLParser):
|
|||
def pbr(self):
|
||||
if self.p_p == 0: self.p_p = 1
|
||||
|
||||
def p(self): self.p_p = 2
|
||||
def p(self):
|
||||
|
||||
def o(self, data, puredata=0, force=0):
|
||||
if self.abbr_data is not None: self.abbr_data += data
|
||||
|
@ -411,7 +411,8 @@ class _html2text(sgmllib.SGMLParser):
|
|||
if r'\/script>' in data: self.quiet -= 1
|
||||
self.o(data, 1)
|
||||
|
||||
def unknown_decl(self, data): pass
|
||||
def unknown_decl(self, data):
|
||||
pass
|
||||
|
||||
def wrapwrite(text): sys.stdout.write(text.encode('utf8'))
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class account_analytic_account(osv.osv):
|
|||
_defaults = {
|
||||
'pricelist_id': lambda self, cr, uid, ctx: ctx.get('pricelist_id', False),
|
||||
}
|
||||
def on_change_partner_id(self, cr, uid, id, partner_id, context={}):
|
||||
def on_change_partner_id(self, cr, uid, id, partner_id, context=None):
|
||||
res = super(account_analytic_account, self).on_change_partner_id(cr, uid, id, partner_id, context)
|
||||
if (not res.get('value', False)) or not partner_id:
|
||||
return res
|
||||
|
|
|
@ -38,7 +38,7 @@ class account_analytic_line(osv.osv):
|
|||
# 'price': boolean
|
||||
# 'product': many2one id
|
||||
# }
|
||||
def invoice_cost_create(self, cr, uid, ids, data={}, context=None):
|
||||
def invoice_cost_create(self, cr, uid, ids, data=None, context=None):
|
||||
analytic_account_obj = self.pool.get('account.analytic.account')
|
||||
res_partner_obj = self.pool.get('res.partner')
|
||||
account_payment_term_obj = self.pool.get('account.payment.term')
|
||||
|
|
|
@ -234,7 +234,7 @@ class idea_idea(osv.osv):
|
|||
res_id = super(idea_idea, self).create(cr, user, vals, context=context)
|
||||
return res_id
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
"""
|
||||
Create the new record in idea_idea model from existing one
|
||||
@param cr: A database cursor
|
||||
|
|
|
@ -179,7 +179,7 @@ class account_invoice(osv.osv):
|
|||
'\nPlease create manually a unique BBA Structured Communication.'))
|
||||
return super(account_invoice, self).create(cr, uid, vals, context=context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context={}):
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if isinstance(ids, (int, long)):
|
||||
ids = [ids]
|
||||
for inv in self.browse(cr, uid, ids, context):
|
||||
|
|
|
@ -134,7 +134,7 @@ class mail_thread(osv.osv):
|
|||
self.message_append_dict(cr, uid, [res_id], msg_dict, context=context)
|
||||
return res_id
|
||||
|
||||
def message_update(self, cr, uid, ids, msg_dict, vals={}, default_act=None, context=None):
|
||||
def message_update(self, cr, uid, ids, msg_dict, vals=None, default_act=None, context=None):
|
||||
"""Called by ``message_process`` when a new message is received
|
||||
for an existing thread. The default behavior is to create a
|
||||
new mail.message in the given thread (by calling
|
||||
|
|
|
@ -271,13 +271,15 @@ class mrp_bom(osv.osv):
|
|||
return {'value': {'name': prod.name, 'product_uom': prod.uom_id.id}}
|
||||
return {}
|
||||
|
||||
def _bom_find(self, cr, uid, product_id, product_uom, properties=[]):
|
||||
def _bom_find(self, cr, uid, product_id, product_uom, properties=None):
|
||||
""" Finds BoM for particular product and product uom.
|
||||
@param product_id: Selected product.
|
||||
@param product_uom: Unit of measure of a product.
|
||||
@param properties: List of related properties.
|
||||
@return: False or BoM id.
|
||||
"""
|
||||
if properties is None:
|
||||
properties = []
|
||||
cr.execute('select id from mrp_bom where product_id=%s and bom_id is null order by sequence', (product_id,))
|
||||
ids = map(lambda x: x[0], cr.fetchall())
|
||||
max_prop = 0
|
||||
|
@ -292,7 +294,7 @@ class mrp_bom(osv.osv):
|
|||
max_prop = prop
|
||||
return result
|
||||
|
||||
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0, routing_id=False):
|
||||
def _bom_explode(self, cr, uid, bom, factor, properties=None, addthis=False, level=0, routing_id=False):
|
||||
""" Finds Products and Work Centers for related BoM for manufacturing order.
|
||||
@param bom: BoM of particular product.
|
||||
@param factor: Factor of product UoM.
|
||||
|
@ -577,7 +579,7 @@ class mrp_production(osv.osv):
|
|||
self.write(cr, uid, ids, {'state': 'picking_except'})
|
||||
return True
|
||||
|
||||
def action_compute(self, cr, uid, ids, properties=[], context=None):
|
||||
def action_compute(self, cr, uid, ids, properties=None, context=None):
|
||||
""" Computes bills of material of a product.
|
||||
@param properties: List containing dictionaries of properties.
|
||||
@return: No. of products.
|
||||
|
|
|
@ -33,7 +33,7 @@ class procurement_order(osv.osv):
|
|||
'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||
}
|
||||
|
||||
def check_produce_product(self, cr, uid, procurement, context=[]):
|
||||
def check_produce_product(self, cr, uid, procurement, context=None):
|
||||
""" Finds the bill of material for the product from procurement order.
|
||||
@return: True or False
|
||||
"""
|
||||
|
|
|
@ -372,7 +372,7 @@ class mrp_production(osv.osv):
|
|||
pass
|
||||
return result
|
||||
|
||||
def action_compute(self, cr, uid, ids, properties=[], context=None):
|
||||
def action_compute(self, cr, uid, ids, properties=None, context=None):
|
||||
""" Computes bills of material of a product and planned date of work order.
|
||||
@param properties: List containing dictionaries of properties.
|
||||
@return: No. of products.
|
||||
|
|
|
@ -265,7 +265,7 @@ class project(osv.osv):
|
|||
task_obj.duplicate_task(cr, uid, map_task_id, context=context)
|
||||
return True
|
||||
|
||||
def copy(self, cr, uid, id, default={}, context=None):
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
|
@ -581,7 +581,9 @@ class task(osv.osv):
|
|||
#FIXME why there is already the copy and the old one
|
||||
self.write(cr, uid, new, {'parent_ids':[(6,0,set(parent_ids))], 'child_ids':[(6,0, set(child_ids))]})
|
||||
|
||||
def copy_data(self, cr, uid, id, default={}, context=None):
|
||||
def copy_data(self, cr, uid, id, default=None, context=None):
|
||||
if default is None:
|
||||
default = {}
|
||||
default = default or {}
|
||||
default.update({'work_ids':[], 'date_start': False, 'date_end': False, 'date_deadline': False})
|
||||
if not default.get('remaining_hours', False):
|
||||
|
@ -810,7 +812,7 @@ class task(osv.osv):
|
|||
}
|
||||
return res
|
||||
|
||||
def do_close(self, cr, uid, ids, context={}):
|
||||
def do_close(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Close Task
|
||||
"""
|
||||
|
@ -868,7 +870,7 @@ class task(osv.osv):
|
|||
self.write(cr, uid, [task.id], {'state': 'open'}, context=context)
|
||||
return True
|
||||
|
||||
def do_cancel(self, cr, uid, ids, context={}):
|
||||
def do_cancel(self, cr, uid, ids, context=None):
|
||||
request = self.pool.get('res.request')
|
||||
tasks = self.browse(cr, uid, ids, context=context)
|
||||
self._check_child_task(cr, uid, ids, context=context)
|
||||
|
@ -889,7 +891,7 @@ class task(osv.osv):
|
|||
self.write(cr, uid, [task.id], {'state': 'cancelled', 'remaining_hours':0.0}, context=context)
|
||||
return True
|
||||
|
||||
def do_open(self, cr, uid, ids, context={}):
|
||||
def do_open(self, cr, uid, ids, context=None):
|
||||
if not isinstance(ids,list): ids = [ids]
|
||||
tasks= self.browse(cr, uid, ids, context=context)
|
||||
for t in tasks:
|
||||
|
@ -901,7 +903,7 @@ class task(osv.osv):
|
|||
self.log(cr, uid, t.id, message)
|
||||
return True
|
||||
|
||||
def do_draft(self, cr, uid, ids, context={}):
|
||||
def do_draft(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'draft'}, context=context)
|
||||
return True
|
||||
|
||||
|
@ -915,10 +917,12 @@ class task(osv.osv):
|
|||
return new_attachment_ids
|
||||
|
||||
|
||||
def do_delegate(self, cr, uid, ids, delegate_data={}, context=None):
|
||||
def do_delegate(self, cr, uid, ids, delegate_data=None, context=None):
|
||||
"""
|
||||
Delegate Task to another users.
|
||||
"""
|
||||
if delegate_data is None:
|
||||
delegate_data = {}
|
||||
assert delegate_data['user_id'], _("Delegated User should be specified")
|
||||
delegated_tasks = {}
|
||||
for task in self.browse(cr, uid, ids, context=context):
|
||||
|
@ -950,7 +954,7 @@ class task(osv.osv):
|
|||
delegated_tasks[task.id] = delegated_task_id
|
||||
return delegated_tasks
|
||||
|
||||
def do_pending(self, cr, uid, ids, context={}):
|
||||
def do_pending(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'pending'}, context=context)
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
message = _("The task '%s' is pending.") % name
|
||||
|
|
|
@ -47,7 +47,9 @@ class project_tasks(osv.osv):
|
|||
self.write(cr, uid, [res_id], data, context)
|
||||
return res_id
|
||||
|
||||
def message_update(self, cr, uid, ids, msg, data={}, default_act='pending'):
|
||||
def message_update(self, cr, uid, ids, msg, data=None, default_act='pending'):
|
||||
if data is None:
|
||||
data = {}
|
||||
data.update({
|
||||
'description': msg['body_text'],
|
||||
})
|
||||
|
|
|
@ -35,7 +35,7 @@ from webkit_report import WebKitParser
|
|||
from report.report_sxw import rml_parse
|
||||
|
||||
def register_report(name, model, tmpl_path, parser=rml_parse):
|
||||
"Register the report into the services"
|
||||
"""Register the report into the services"""
|
||||
name = 'report.%s' % name
|
||||
if netsvc.Service._services.get(name, False):
|
||||
service = netsvc.Service._services[name]
|
||||
|
|
|
@ -567,7 +567,8 @@ class _ValueWrapper(object):
|
|||
return result
|
||||
#@-node:_cmp
|
||||
#@+node:__getattr__
|
||||
def __getattr__(self, name): return getattr(self._value, name)
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._value, name)
|
||||
#@-node:__getattr__
|
||||
#@+node:__getitem__
|
||||
def __getitem__(self, slice):
|
||||
|
|
|
@ -53,7 +53,7 @@ class sale_order_line(osv.osv):
|
|||
seq += 1
|
||||
return invoice_line_ids
|
||||
|
||||
def onchange_sale_order_line_view(self, cr, uid, id, type, context={}, *args):
|
||||
def onchange_sale_order_line_view(self, cr, uid, id, type, context=None, *args):
|
||||
temp = {}
|
||||
temp['value'] = {}
|
||||
if (not type):
|
||||
|
|
|
@ -406,7 +406,7 @@ class stock_planning(osv.osv):
|
|||
res[val.id] = 'Future'
|
||||
return res
|
||||
|
||||
def _get_op(self, cr, uid, ids, field_names, arg, context=None): # op = OrderPoint
|
||||
def _get_op(self, cr, uid, ids, field_names, arg, context=None):
|
||||
res = {}
|
||||
for val in self.browse(cr, uid, ids, context=context):
|
||||
res[val.id]={}
|
||||
|
|
|
@ -2446,8 +2446,10 @@ def _stripDoctype(data):
|
|||
data = doctype_pattern.sub('', data)
|
||||
return version, data
|
||||
|
||||
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=[]):
|
||||
def parse(url_file_stream_or_string, etag=None, modified=None, agent=None, referrer=None, handlers=None):
|
||||
'''Parse a feed from a URL, file, stream, or string'''
|
||||
if handlers is None:
|
||||
handlers = []
|
||||
result = FeedParserDict()
|
||||
result['feed'] = FeedParserDict()
|
||||
result['entries'] = []
|
||||
|
|
|
@ -489,7 +489,7 @@ class BaseParser(object):
|
|||
return text.encode("utf-8")
|
||||
return text
|
||||
|
||||
def strip(self, text, stripcomments=False, dontstrip=[]):
|
||||
def strip(self, text, stripcomments=False, dontstrip=None):
|
||||
render = True
|
||||
|
||||
commentState = {}
|
||||
|
@ -2087,7 +2087,9 @@ mTagHooks = {}
|
|||
# <quote cite="person">quote</quote>
|
||||
from cgi import escape
|
||||
|
||||
def hook_quote(env, body, attributes={}):
|
||||
def hook_quote(env, body, attributes=None):
|
||||
if attributes is None:
|
||||
attributes = {}
|
||||
text = [u'<div class="blockquote">']
|
||||
if 'cite' in attributes:
|
||||
text.append(u"<strong class=\"cite\">%s wrote:</strong>\n" % escape(attributes['cite']))
|
||||
|
|
Loading…
Reference in New Issue