summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authoruco (OpenERP) <uco@tinyerp.com>2010-11-23 12:35:05 +0530
committeruco (OpenERP) <uco@tinyerp.com>2010-11-23 12:35:05 +0530
commit6dd290e8245f4ea91ce87b0f3b5f29bafeaf12e9 (patch)
tree81db1734d8400a9278e5669da35bbe90076397c0 /addons
parent8035df3e1152a8f9d9703037d9d1bee718d94331 (diff)
[REF]: Replace the condition 'if not context' with 'if context is None'.
bzr revid: uco@tinyerp.com-20101123070505-9i2lrqhgxzaii3zn
Diffstat (limited to 'addons')
-rw-r--r--addons/account/account.py62
-rw-r--r--addons/account_analytic_analysis/account_analytic_analysis.py4
-rw-r--r--addons/account_analytic_plans/account_analytic_plans.py4
-rw-r--r--addons/account_anglo_saxon/stock.py2
-rw-r--r--addons/account_budget/account_budget.py8
-rw-r--r--addons/account_coda/account_coda.py2
-rw-r--r--addons/account_coda/wizard/account_coda_import.py4
-rw-r--r--addons/account_invoice_layout/account_invoice_layout.py6
-rw-r--r--addons/account_payment/account_invoice.py2
-rw-r--r--addons/account_payment/account_move_line.py4
-rw-r--r--addons/account_payment/account_payment.py8
-rw-r--r--addons/account_sequence/account_sequence.py2
-rw-r--r--addons/account_voucher/account_voucher.py48
-rw-r--r--addons/account_voucher/invoice.py2
-rw-r--r--addons/account_voucher/wizard/account_statement_from_invoice.py4
-rw-r--r--addons/analytic/analytic.py6
-rw-r--r--addons/auction/auction.py38
-rw-r--r--addons/auction/report/report_auction.py2
-rw-r--r--addons/auction/wizard/auction_aie_send.py6
-rw-r--r--addons/auction/wizard/auction_aie_send_result.py6
-rw-r--r--addons/auction/wizard/auction_catalog_flagey_report.py5
-rw-r--r--addons/auction/wizard/auction_lots_able.py2
-rw-r--r--addons/auction/wizard/auction_lots_auction_move.py2
-rw-r--r--addons/auction/wizard/auction_lots_buyer_map.py8
-rw-r--r--addons/auction/wizard/auction_lots_cancel.py2
-rw-r--r--addons/auction/wizard/auction_lots_enable.py2
-rw-r--r--addons/auction/wizard/auction_lots_invoice.py4
-rw-r--r--addons/auction/wizard/auction_lots_make_invoice.py4
-rw-r--r--addons/auction/wizard/auction_lots_make_invoice_buyer.py2
-rw-r--r--addons/auction/wizard/auction_lots_numerotate.py4
-rw-r--r--addons/auction/wizard/auction_lots_sms_send.py2
-rw-r--r--addons/auction/wizard/auction_pay_buy.py4
-rw-r--r--addons/auction/wizard/auction_pay_sel.py2
-rw-r--r--addons/auction/wizard/auction_payer_sel.py4
-rw-r--r--addons/auction/wizard/auction_taken.py2
-rw-r--r--addons/auction/wizard/auction_transfer_unsold_object.py2
-rw-r--r--addons/audittrail/audittrail.py2
-rw-r--r--addons/audittrail/wizard/audittrail_view_log.py2
-rw-r--r--addons/base_action_rule/base_action_rule.py6
-rw-r--r--addons/base_calendar/base_calendar.py6
-rw-r--r--addons/base_calendar/wizard/base_calendar_invite_attendee.py2
-rw-r--r--addons/base_calendar/wizard/base_calendar_set_exrule.py4
-rw-r--r--addons/base_calendar/wizard/calendar_event_edit_all.py2
-rw-r--r--addons/base_contact/base_contact.py5
-rw-r--r--addons/base_contact/base_contact_installer.py1
-rw-r--r--addons/base_iban/base_iban.py6
-rwxr-xr-xaddons/base_module_doc_rst/base_module_doc_rst.py3
-rw-r--r--addons/base_module_doc_rst/wizard/generate_relation_graph.py1
-rw-r--r--addons/base_report_creator/base_report_creator.py6
-rw-r--r--addons/base_report_creator/wizard/report_menu_create.py2
-rw-r--r--addons/base_report_designer/base_report_designer.py2
-rw-r--r--addons/base_report_designer/installer.py1
-rw-r--r--addons/base_report_designer/wizard/base_report_designer_modify.py7
-rw-r--r--addons/base_synchro/wizard/base_synchro.py12
-rw-r--r--addons/board/board.py8
-rw-r--r--addons/board/wizard/board_menu_create.py2
-rw-r--r--addons/caldav/calendar.py18
-rw-r--r--addons/caldav/calendar_collection.py8
-rw-r--r--addons/crm/crm.py20
-rw-r--r--addons/crm/crm_action_rule.py10
-rw-r--r--addons/crm/crm_installer.py2
-rw-r--r--addons/crm/crm_lead.py8
-rw-r--r--addons/crm/crm_meeting.py5
-rw-r--r--addons/crm/crm_opportunity.py5
-rw-r--r--addons/crm/crm_phonecall.py2
-rw-r--r--addons/crm/wizard/crm_add_note.py2
-rw-r--r--addons/crm/wizard/crm_lead_to_opportunity.py10
-rw-r--r--addons/crm/wizard/crm_lead_to_partner.py6
-rw-r--r--addons/crm/wizard/crm_phonecall_to_meeting.py2
-rw-r--r--addons/crm/wizard/crm_phonecall_to_partner.py8
-rw-r--r--addons/crm/wizard/crm_send_email.py6
-rw-r--r--addons/crm/wizard/wizard_history_event.py2
-rw-r--r--addons/crm_caldav/crm_caldav.py7
-rw-r--r--addons/crm_partner_assign/partner_geo_assign.py4
-rw-r--r--addons/crm_partner_assign/wizard/crm_forward_to_partner.py4
-rw-r--r--addons/crm_profiling/crm_profiling.py6
-rw-r--r--addons/delivery/delivery.py8
-rw-r--r--addons/delivery/stock.py7
-rw-r--r--addons/delivery/wizard/delivery_sale_order.py6
-rw-r--r--addons/document/directory_content.py2
-rw-r--r--addons/document/directory_report.py2
-rw-r--r--addons/document/document.py10
-rw-r--r--addons/document/document_directory.py6
-rw-r--r--addons/document/document_storage.py10
-rw-r--r--addons/document/wizard/document_configuration.py2
-rw-r--r--addons/document_ftp/wizard/ftp_browse.py4
-rw-r--r--addons/document_ftp/wizard/ftp_configuration.py2
-rw-r--r--addons/document_ics/document_ics.py2
-rw-r--r--addons/document_webdav/document_webdav.py2
-rw-r--r--addons/email_template/email_template.py6
-rw-r--r--addons/email_template/email_template_account.py4
-rw-r--r--addons/email_template/email_template_mailbox.py2
-rw-r--r--addons/event/event.py20
-rw-r--r--addons/event/wizard/partner_event_registration.py4
-rw-r--r--addons/event_project/event_project.py2
-rw-r--r--addons/event_project/wizard/event_project_retro.py2
-rw-r--r--addons/fetchmail/fetchmail.py8
-rw-r--r--addons/google_map/wizard/google_map_launch.py2
-rw-r--r--addons/hr/hr.py18
-rw-r--r--addons/hr_contract/hr_contract.py2
-rw-r--r--addons/hr_evaluation/hr_evaluation.py2
-rw-r--r--addons/hr_expense/hr_expense.py2
-rw-r--r--addons/hr_payroll/hr_payroll.py14
-rw-r--r--addons/hr_payroll_account/hr_payroll_account.py2
-rw-r--r--addons/hr_recruitment/hr_recruitment.py6
-rw-r--r--addons/hr_timesheet_sheet/hr_timesheet_sheet.py4
-rw-r--r--addons/idea/idea.py4
-rw-r--r--addons/idea/wizard/idea_post_vote.py4
-rw-r--r--addons/l10n_ch/wizard/create_dta.py2
-rw-r--r--addons/lunch/lunch.py8
-rw-r--r--addons/lunch/wizard/lunch_cashbox_clean.py2
-rw-r--r--addons/lunch/wizard/lunch_order_cancel.py2
-rw-r--r--addons/lunch/wizard/lunch_order_confirm.py2
-rw-r--r--addons/mail_gateway/mail_gateway.py12
-rw-r--r--addons/marketing_campaign/marketing_campaign.py22
-rw-r--r--addons/membership/membership.py26
-rw-r--r--addons/membership/wizard/membership_invoice.py2
-rw-r--r--addons/mrp/mrp.py20
-rw-r--r--addons/mrp/procurement.py8
-rw-r--r--addons/mrp/product.py4
-rw-r--r--addons/mrp/stock.py6
-rw-r--r--addons/mrp/wizard/change_production_qty.py2
-rw-r--r--addons/mrp/wizard/mrp_change_standard_price.py2
-rw-r--r--addons/mrp/wizard/mrp_price.py2
-rw-r--r--addons/mrp/wizard/mrp_product_produce.py4
-rw-r--r--addons/mrp/wizard/mrp_track_prod.py4
-rw-r--r--addons/mrp/wizard/mrp_workcenter_load.py2
-rw-r--r--addons/mrp_operations/mrp_operations.py22
-rw-r--r--addons/mrp_repair/mrp_repair.py20
-rw-r--r--addons/mrp_repair/wizard/cancel_repair.py4
-rw-r--r--addons/mrp_repair/wizard/make_invoice.py2
-rw-r--r--addons/mrp_subproduct/mrp_subproduct.py2
-rwxr-xr-xaddons/outlook/installer.py2
-rw-r--r--addons/point_of_sale/account_bank_statement.py2
-rw-r--r--addons/point_of_sale/point_of_sale.py54
-rw-r--r--addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py2
-rw-r--r--addons/point_of_sale/wizard/pos_box_entries.py4
-rw-r--r--addons/point_of_sale/wizard/pos_box_out.py4
-rw-r--r--addons/point_of_sale/wizard/pos_close_statement.py2
-rw-r--r--addons/point_of_sale/wizard/pos_discount.py2
-rw-r--r--addons/point_of_sale/wizard/pos_open_statement.py2
-rw-r--r--addons/point_of_sale/wizard/pos_payment.py8
-rw-r--r--addons/point_of_sale/wizard/pos_receipt.py4
-rw-r--r--addons/point_of_sale/wizard/pos_return.py15
-rw-r--r--addons/point_of_sale/wizard/pos_sales_user.py2
-rw-r--r--addons/point_of_sale/wizard/pos_sales_user_current_user.py2
-rw-r--r--addons/point_of_sale/wizard/pos_sales_user_today.py2
-rw-r--r--addons/point_of_sale/wizard/pos_scan_product.py2
-rw-r--r--addons/process/process.py12
-rw-r--r--addons/procurement/procurement.py36
-rw-r--r--addons/procurement/schedulers.py6
-rw-r--r--addons/procurement/wizard/make_procurement_product.py4
-rw-r--r--addons/procurement/wizard/mrp_procurement.py4
-rw-r--r--addons/procurement/wizard/orderpoint_procurement.py4
-rw-r--r--addons/procurement/wizard/schedulers_all.py4
-rw-r--r--addons/product/pricelist.py16
-rw-r--r--addons/product/product.py52
-rw-r--r--addons/product/wizard/product_price.py2
-rw-r--r--addons/product_expiry/product_expiry.py2
-rw-r--r--addons/product_margin/wizard/product_margin.py2
-rw-r--r--addons/project/project.py40
-rw-r--r--addons/project_caldav/project_caldav.py5
-rw-r--r--addons/project_issue/project_issue.py15
-rw-r--r--addons/project_long_term/project_long_term.py14
-rw-r--r--addons/project_long_term/wizard/project_compute_phases.py2
-rw-r--r--addons/project_mailgate/project_mailgate.py4
-rw-r--r--addons/project_messages/project_messages.py2
-rw-r--r--addons/project_mrp/project_procurement.py2
-rw-r--r--addons/project_planning/project_planning.py8
-rw-r--r--addons/project_scrum/project_scrum.py2
-rw-r--r--addons/project_scrum/wizard/project_scrum_email.py2
-rw-r--r--addons/purchase/purchase.py32
-rw-r--r--addons/purchase/stock.py6
-rw-r--r--addons/purchase/wizard/purchase_order_group.py4
-rw-r--r--addons/purchase_requisition/purchase_requisition.py16
-rw-r--r--addons/purchase_requisition/wizard/purchase_requisition_partner.py4
-rw-r--r--addons/report_webkit/ir_report.py6
-rw-r--r--addons/report_webkit/webkit_report.py2
-rw-r--r--addons/resource/resource.py6
-rw-r--r--addons/sale/stock.py4
-rw-r--r--addons/sale/wizard/sale_make_invoice.py2
-rw-r--r--addons/sale/wizard/sale_make_invoice_advance.py2
-rw-r--r--addons/sale_crm/wizard/crm_make_sale.py4
-rwxr-xr-xaddons/sale_layout/sale_layout.py10
-rw-r--r--addons/sale_margin/sale_margin.py8
-rw-r--r--addons/sale_order_dates/sale_order_dates.py4
-rw-r--r--addons/stock/product.py2
-rw-r--r--addons/stock/stock.py62
-rw-r--r--addons/stock/wizard/stock_change_standard_price.py6
-rw-r--r--addons/stock/wizard/stock_fill_inventory.py4
-rw-r--r--addons/stock/wizard/stock_inventory_line_split.py4
-rw-r--r--addons/stock/wizard/stock_inventory_merge.py4
-rw-r--r--addons/stock/wizard/stock_move.py14
-rw-r--r--addons/stock/wizard/stock_partial_move.py6
-rw-r--r--addons/stock/wizard/stock_partial_picking.py6
-rw-r--r--addons/stock/wizard/stock_return_picking.py6
-rw-r--r--addons/stock/wizard/stock_split_move.py4
-rw-r--r--addons/stock/wizard/stock_splitinto.py2
-rw-r--r--addons/stock/wizard/stock_traceability.py2
-rw-r--r--addons/stock_invoice_directly/wizard/stock_invoice.py2
-rw-r--r--addons/stock_location/procurement_pull.py8
-rw-r--r--addons/stock_location/stock_location.py4
-rw-r--r--addons/stock_planning/stock_planning.py24
-rw-r--r--addons/stock_planning/wizard/stock_planning_create_periods.py4
-rw-r--r--addons/stock_planning/wizard/stock_planning_forecast.py2
-rw-r--r--addons/subscription/subscription.py10
-rw-r--r--addons/survey/survey.py34
-rw-r--r--addons/survey/wizard/survey_answer.py23
-rw-r--r--addons/survey/wizard/survey_browse_answer.py1
-rw-r--r--addons/survey/wizard/survey_print.py2
-rw-r--r--addons/survey/wizard/survey_print_answer.py2
-rw-r--r--addons/survey/wizard/survey_print_statistics.py2
-rw-r--r--addons/survey/wizard/survey_selection.py1
-rw-r--r--addons/survey/wizard/survey_send_invitation.py6
-rw-r--r--addons/thunderbird/installer.py2
-rw-r--r--addons/wiki/wiki.py6
-rw-r--r--addons/wiki/wizard/wiki_create_menu.py2
-rw-r--r--addons/wiki/wizard/wiki_make_index.py2
-rw-r--r--addons/wiki/wizard/wiki_show_diff.py2
-rw-r--r--addons/wiki/wizard/wiki_wiki_page_open.py2
220 files changed, 306 insertions, 1255 deletions
diff --git a/addons/account/account.py b/addons/account/account.py
index 65db73f8d0a..eb60c41ed35 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -182,7 +182,7 @@ class account_account(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
- if not context:
+ if context is None:
context = {}
pos = 0
@@ -215,8 +215,6 @@ class account_account(osv.osv):
order, context=context, count=count)
def _get_children_and_consol(self, cr, uid, ids, context=None):
- if not context:
- context = {}
#this function search for all the children and all consolidated children (recursively) of the given account ids
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)
ids3 = []
@@ -310,16 +308,12 @@ class account_account(osv.osv):
return res
def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None):
- if not context:
- context = {}
result = {}
for rec in self.browse(cr, uid, ids, context=context):
result[rec.id] = (rec.company_id.currency_id.id,rec.company_id.currency_id.code)
return result
def _get_child_ids(self, cr, uid, ids, field_name, arg, context=None):
- if not context:
- context = {}
result = {}
for record in self.browse(cr, uid, ids, context=context):
if record.child_parent_ids:
@@ -335,8 +329,6 @@ class account_account(osv.osv):
return result
def _get_level(self, cr, uid, ids, field_name, arg, context=None):
- if not context:
- context = {}
res={}
accounts = self.browse(cr, uid, ids, context=context)
for account in accounts:
@@ -403,8 +395,6 @@ class account_account(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
- if not context:
- context = {}
obj_self = self.browse(cr, uid, ids[0], context=context)
p_id = obj_self.parent_id and obj_self.parent_id.id
if (obj_self in obj_self.child_consol_ids) or (p_id and (p_id is obj_self.id)):
@@ -434,8 +424,6 @@ class account_account(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
- if not context:
- context = {}
args = args[:]
ids = []
try:
@@ -499,8 +487,6 @@ class account_account(osv.osv):
return super(account_account, self).copy(cr, uid, id, default, context=context)
def _check_moves(self, cr, uid, ids, method, context=None):
- if not context:
- context = {}
line_obj = self.pool.get('account.move.line')
account_ids = self.search(cr, uid, [('id', 'child_of', ids)])
@@ -517,8 +503,6 @@ class account_account(osv.osv):
return True
def _check_allow_type_change(self, cr, uid, ids, new_type, context=None):
- if not context:
- context = {}
group1 = ['payable', 'receivable', 'other']
group2 = ['consolidation','view']
line_obj = self.pool.get('account.move.line')
@@ -535,7 +519,7 @@ class account_account(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
- if not context:
+ if context is None:
context = {}
if 'company_id' in vals:
@@ -709,7 +693,7 @@ class account_journal(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
- if not context:
+ if context is None:
context = {}
ids = []
if context.get('journal_type', False):
@@ -791,8 +775,6 @@ class account_fiscalyear(osv.osv):
return True
def _check_duration(self, cr, uid, ids, context=None):
- if not context:
- context = {}
obj_fy = self.browse(cr, uid, ids[0], context=context)
if obj_fy.date_stop < obj_fy.date_start:
return False
@@ -839,7 +821,7 @@ class account_fiscalyear(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
- if not context:
+ if context is None:
context = {}
ids = []
if name:
@@ -871,16 +853,12 @@ class account_period(osv.osv):
_order = "date_start"
def _check_duration(self,cr,uid,ids,context=None):
- if not context:
- context = {}
obj_period = self.browse(cr, uid, ids[0], context=context)
if obj_period.date_stop < obj_period.date_start:
return False
return True
def _check_year_limit(self,cr,uid,ids,context=None):
- if not context:
- context = {}
for obj_period in self.browse(cr, uid, ids, context=context):
if obj_period.special:
continue
@@ -903,16 +881,12 @@ class account_period(osv.osv):
]
def next(self, cr, uid, period, step, context=None):
- if not context:
- context = {}
ids = self.search(cr, uid, [('date_start','>',period.date_start)])
if len(ids)>=step:
return ids[step-1]
return False
def find(self, cr, uid, dt=None, context=None):
- if not context:
- context = {}
if not dt:
dt = time.strftime('%Y-%m-%d')
#CHECKME: shouldn't we check the state of the period?
@@ -931,8 +905,6 @@ class account_period(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
if args is None:
args = []
- if not context:
- context = {}
ids = []
if name:
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
@@ -941,8 +913,6 @@ class account_period(osv.osv):
return self.name_get(cr, user, ids, context=context)
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
if 'company_id' in vals:
move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)])
if move_lines:
@@ -969,8 +939,6 @@ class account_journal_period(osv.osv):
_description = "Journal Period"
def _icon_get(self, cr, uid, ids, field_name, arg=None, context=None):
- if not context:
- context = {}
result = {}.fromkeys(ids, 'STOCK_NEW')
for r in self.read(cr, uid, ids, ['state']):
result[r['id']] = {
@@ -993,8 +961,6 @@ class account_journal_period(osv.osv):
}
def _check(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for obj in self.browse(cr, uid, ids, context=context):
cr.execute('select * from account_move_line where journal_id=%s and period_id=%s limit 1', (obj.journal_id.id, obj.period_id.id))
res = cr.fetchall()
@@ -1007,8 +973,6 @@ class account_journal_period(osv.osv):
return super(account_journal_period, self).write(cr, uid, ids, vals, context=context)
def create(self, cr, uid, vals, context=None):
- if not context:
- context = {}
period_id=vals.get('period_id',False)
if period_id:
period = self.pool.get('account.period').browse(cr, uid, period_id, context=context)
@@ -1068,8 +1032,6 @@ class account_move(osv.osv):
if not args:
args = []
- if not context:
- context = {}
ids = []
if name:
ids += self.search(cr, user, [('name','ilike',name)]+args, limit=limit, context=context)
@@ -1087,8 +1049,6 @@ class account_move(osv.osv):
ids = [ids]
if not ids:
return []
- if not context:
- context = {}
res = []
data_move = self.pool.get('account.move').browse(cursor, user, ids, context=context)
for move in data_move:
@@ -1100,8 +1060,6 @@ class account_move(osv.osv):
return res
def _get_period(self, cr, uid, context=None):
- if not context:
- context = {}
periods = self.pool.get('account.period').find(cr, uid)
if periods:
return periods[0]
@@ -1163,7 +1121,6 @@ class account_move(osv.osv):
}
def _check_centralisation(self, cursor, user, ids, context=None):
- if not context: context = {}
for move in self.browse(cursor, user, ids, context=context):
if move.journal_id.centralisation:
move_ids = self.search(cursor, user, [
@@ -1175,7 +1132,6 @@ class account_move(osv.osv):
return True
def _check_period_journal(self, cursor, user, ids, context=None):
- if not context: context = {}
for move in self.browse(cursor, user, ids, context=context):
for line in move.line_id:
if line.period_id.id != move.period_id.id:
@@ -1194,7 +1150,7 @@ class account_move(osv.osv):
]
def post(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
invoice = context.get('invoice', False)
valid_moves = self.validate(cr, uid, ids, context)
@@ -1227,8 +1183,6 @@ class account_move(osv.osv):
return True
def button_validate(self, cursor, user, ids, context=None):
- if not context:
- context = {}
for move in self.browse(cursor, user, ids, context=context):
top = None
for line in move.line_id:
@@ -1253,7 +1207,7 @@ class account_move(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
- if not context:
+ if context is None:
context = {}
c = context.copy()
c['novalidate'] = True
@@ -1317,7 +1271,6 @@ class account_move(osv.osv):
return super(account_move, self).copy(cr, uid, id, default, context)
def unlink(self, cr, uid, ids, context=None, check=True):
- context = context or {}
toremove = []
obj_move_line = self.pool.get('account.move.line')
for move in self.browse(cr, uid, ids, context=context):
@@ -1335,7 +1288,6 @@ class account_move(osv.osv):
return result
def _compute_balance(self, cr, uid, id, context=None):
- context = context or {}
move = self.browse(cr, uid, [id], context=context)[0]
amount = 0
for line in move.line_id:
@@ -1767,7 +1719,7 @@ class account_tax(osv.osv):
"""
if not args:
args = []
- if not context:
+ if context is None:
context = {}
ids = []
if name:
diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py
index 064c724a52a..d4ee5428bb9 100644
--- a/addons/account_analytic_analysis/account_analytic_analysis.py
+++ b/addons/account_analytic_analysis/account_analytic_analysis.py
@@ -519,7 +519,7 @@ class account_analytic_account_summary_user(osv.osv):
')')
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
- if not context:
+ if context is None:
context = {}
if not ids:
return []
@@ -695,7 +695,7 @@ class account_analytic_account_summary_month(osv.osv):
')')
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
- if not context:
+ if context is None:
context = {}
if not ids:
return []
diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py
index abd6c741da0..edb675862ca 100644
--- a/addons/account_analytic_plans/account_analytic_plans.py
+++ b/addons/account_analytic_plans/account_analytic_plans.py
@@ -28,7 +28,7 @@ from tools.translate import _
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if not context:
+ if context is None:
context = {}
res = {}
for id in ids:
@@ -115,7 +115,7 @@ class account_analytic_plan_instance(osv.osv):
return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context=context)
def _default_journal(self, cr, uid, context=None):
- if not context:
+ if context is None:
context = {}
journal_obj = self.pool.get('account.journal')
if context.has_key('journal_id') and context['journal_id']:
diff --git a/addons/account_anglo_saxon/stock.py b/addons/account_anglo_saxon/stock.py
index 9e400b00b7f..ad7bba3103e 100644
--- a/addons/account_anglo_saxon/stock.py
+++ b/addons/account_anglo_saxon/stock.py
@@ -31,7 +31,7 @@ class stock_picking(osv.osv):
def action_invoice_create(self, cr, uid, ids, journal_id=False,
group=False, type='out_invoice', context=None):
'''Return ids of created invoices for the pickings'''
- if not context: context = {}
+ if context is None: context = {}
res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
if type == 'in_refund':
for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context):
diff --git a/addons/account_budget/account_budget.py b/addons/account_budget/account_budget.py
index 5287a7fe8f0..590b431a63f 100644
--- a/addons/account_budget/account_budget.py
+++ b/addons/account_budget/account_budget.py
@@ -111,7 +111,7 @@ class crossovered_budget_lines(osv.osv):
def _prac_amt(self, cr, uid, ids, context=None):
res = {}
result = 0.0
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
acc_ids = [x.id for x in line.general_budget_id.account_ids]
if not acc_ids:
@@ -134,14 +134,14 @@ class crossovered_budget_lines(osv.osv):
def _prac(self, cr, uid, ids, name, args, context=None):
res={}
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
return res
def _theo_amt(self, cr, uid, ids, context=None):
res = {}
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
today = datetime.datetime.today()
date_to = today.strftime("%Y-%m-%d")
@@ -172,7 +172,7 @@ class crossovered_budget_lines(osv.osv):
def _theo(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id]
return res
diff --git a/addons/account_coda/account_coda.py b/addons/account_coda/account_coda.py
index b4714045de2..ab3aa8c37f6 100644
--- a/addons/account_coda/account_coda.py
+++ b/addons/account_coda/account_coda.py
@@ -43,7 +43,7 @@ class account_coda(osv.osv):
}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- if not context: context = {}
+ if context is None: context = {}
res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
if context.get('bank_statement', False) and not res:
diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py
index 7db7faf0146..6219d210e53 100644
--- a/addons/account_coda/wizard/account_coda_import.py
+++ b/addons/account_coda/wizard/account_coda_import.py
@@ -66,7 +66,7 @@ class account_coda_import(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
line_obj = self.pool.get('account.move.line')
- if not context:
+ if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
@@ -321,7 +321,7 @@ class account_coda_import(osv.osv_memory):
}
def action_open_window(self, cr, uid, data, context=None):
- if not context:
+ if context is None:
context = {}
return {
diff --git a/addons/account_invoice_layout/account_invoice_layout.py b/addons/account_invoice_layout/account_invoice_layout.py
index 72504ad6ef7..5945eb88442 100644
--- a/addons/account_invoice_layout/account_invoice_layout.py
+++ b/addons/account_invoice_layout/account_invoice_layout.py
@@ -127,13 +127,13 @@ class account_invoice_line(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
- if not context: context = {}
+ if context is None: context = {}
default['state'] = self.browse(cr, uid, id, context=context).state
return super(account_invoice_line, self).copy_data(cr, uid, id, default, context)
def _fnct(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context: context = {}
+ if context is None: context = {}
lines = self.browse(cr, uid, ids, context=context)
account_ids = [line.account_id.id for line in lines]
account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context))
@@ -181,7 +181,7 @@ account_invoice_line()
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if not context:
+ if context is None:
context = {}
if not values:
values = {}
diff --git a/addons/account_payment/account_invoice.py b/addons/account_payment/account_invoice.py
index 11a1f7f2155..5876f138095 100644
--- a/addons/account_payment/account_invoice.py
+++ b/addons/account_payment/account_invoice.py
@@ -31,7 +31,7 @@ class Invoice(osv.osv):
if not ids:
return {}
res = {}
- if not context: context = {}
+ if context is None: context = {}
for invoice in self.browse(cursor, user, ids, context=context):
res[invoice.id] = 0.0
if invoice.move_id:
diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py
index 4f70d98a9cc..12e2b53bedb 100644
--- a/addons/account_payment/account_move_line.py
+++ b/addons/account_payment/account_move_line.py
@@ -50,7 +50,7 @@ class account_move_line(osv.osv):
def _to_pay_search(self, cr, uid, obj, name, args, context=None):
if not args:
return []
- if not context: context = {}
+ if context is None: context = {}
line_obj = self.pool.get('account.move.line')
query = line_obj._query_get(cr, uid, context={})
where = ' and '.join(map(lambda x: '''(SELECT
@@ -89,7 +89,7 @@ class account_move_line(osv.osv):
"""
payment_mode_obj = self.pool.get('payment.mode')
line2bank = {}
- if not context: context = {}
+ if context is None: context = {}
if not ids:
return {}
bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type,
diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py
index 0389902ad2a..10904e2d181 100644
--- a/addons/account_payment/account_payment.py
+++ b/addons/account_payment/account_payment.py
@@ -67,7 +67,7 @@ class payment_order(osv.osv):
if not ids:
return {}
res = {}
- if not context: context = {}
+ if context is None: context = {}
for order in self.browse(cursor, user, ids, context=context):
if order.line_ids:
res[order.id] = reduce(lambda x, y: x + y.amount, order.line_ids, 0.0)
@@ -128,7 +128,7 @@ class payment_order(osv.osv):
return True
def copy(self, cr, uid, id, default={}, context=None):
- if not context: context = {}
+ if context is None: context = {}
default.update({
'state': 'draft',
'line_ids': [],
@@ -272,7 +272,7 @@ class payment_line(osv.osv):
def _get_currency(self, cr, uid, context=None):
user_obj = self.pool.get('res.users')
currency_obj = self.pool.get('res.currency')
- if not context: context = {}
+ if context is None: context = {}
user = user_obj.browse(cr, uid, uid, context=context)
if user.company_id:
@@ -410,7 +410,7 @@ class payment_line(osv.osv):
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
data = {}
- if not context: context = {}
+ if context is None: context = {}
partner_zip_obj = self.pool.get('res.partner.zip')
partner_obj = self.pool.get('res.partner')
payment_mode_obj = self.pool.get('payment.mode')
diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py
index 25967b386d9..4c4058f0afd 100644
--- a/addons/account_sequence/account_sequence.py
+++ b/addons/account_sequence/account_sequence.py
@@ -30,7 +30,7 @@ class account_move(osv.osv):
}
def post(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
obj_sequence = self.pool.get('ir.sequence')
res = super(account_move, self).post(cr, uid, ids, context=context)
seq_no = False
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 37a7964298a..317d65eeaf4 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -32,7 +32,7 @@ class account_move_line(osv.osv):
def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.debit - line.credit
if line.reconcile_partial_id:
@@ -51,18 +51,18 @@ account_move_line()
class account_voucher(osv.osv):
def _get_type(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
return context.get('type', False)
def _get_period(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
if context.get('period_id', False):
return context.get('period_id')
periods = self.pool.get('account.period').find(cr, uid)
return periods and periods[0] or False
def _get_journal(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
journal_pool = self.pool.get('account.journal')
if context.get('journal_id', False):
return context.get('journal_id')
@@ -76,7 +76,7 @@ class account_voucher(osv.osv):
return res and res[0] or False
def _get_tax(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False)
if not journal_id:
@@ -96,7 +96,7 @@ class account_voucher(osv.osv):
return False
def _get_currency(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal_id = context.get('journal_id', False)
if journal_id:
@@ -107,26 +107,26 @@ class account_voucher(osv.osv):
return False
def _get_partner(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
return context.get('partner_id', False)
def _get_reference(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
return context.get('reference', False)
def _get_narration(self, cr, uid, context=None):
- if not context: context = {}
+ if context is None: context = {}
return context.get('narration', False)
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
- if not context: context = {}
+ if context is None: context = {}
return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
mod_obj = self.pool.get('ir.model.data')
- if not context: context = {}
+ if context is None: context = {}
if not view_id and context.get('invoice_type', False):
if context.get('invoice_type', False) in ('out_invoice', 'out_refund'):
result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
@@ -224,7 +224,7 @@ class account_voucher(osv.osv):
position_pool = self.pool.get('account.fiscal.position')
voucher_line_pool = self.pool.get('account.voucher.line')
voucher_pool = self.pool.get('account.voucher')
- if not context: context = {}
+ if context is None: context = {}
for voucher in voucher_pool.browse(cr, uid, ids, context=context):
voucher_amount = 0.0
@@ -274,7 +274,7 @@ class account_voucher(osv.osv):
}
voucher_total = 0.0
voucher_line_ids = []
- if not context: context = {}
+ if context is None: context = {}
total = 0.0
total_tax = 0.0
@@ -333,7 +333,7 @@ class account_voucher(osv.osv):
default = {
'value':{},
}
- if not context: context = {}
+ if context is None: context = {}
if not partner_id or not journal_id:
return default
@@ -505,7 +505,7 @@ class account_voucher(osv.osv):
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
if not journal_id:
return False
- if not context: context = {}
+ if context is None: context = {}
journal_pool = self.pool.get('account.journal')
journal = journal_pool.browse(cr, uid, journal_id, context=context)
account_id = journal.default_credit_account_id or journal.default_debit_account_id
@@ -535,7 +535,7 @@ class account_voucher(osv.osv):
def cancel_voucher(self, cr, uid, ids, context=None):
reconcile_pool = self.pool.get('account.move.reconcile')
move_pool = self.pool.get('account.move')
- if not context: context = {}
+ if context is None: context = {}
for voucher in self.browse(cr, uid, ids, context=context):
recs = []
@@ -591,7 +591,7 @@ class account_voucher(osv.osv):
terms = term_pool.compute(cr, uid, term_id, amount)
return terms
return False
- if not context:
+ if context is None:
context = {}
move_pool = self.pool.get('account.move')
move_line_pool = self.pool.get('account.move.line')
@@ -769,7 +769,7 @@ class account_voucher_line(osv.osv):
def _compute_balance(self, cr, uid, ids, name, args, context=None):
currency_pool = self.pool.get('res.currency')
rs_data = {}
- if not context: context = {}
+ if context is None: context = {}
for line in self.browse(cr, uid, ids, context=context):
res = {}
company_currency = line.voucher_id.journal_id.company_id.currency_id.id
@@ -821,7 +821,7 @@ class account_voucher_line(osv.osv):
@return: Returns a dict which contains new values, and context
"""
res = {}
- if not context: context = {}
+ if context is None: context = {}
move_line_pool = self.pool.get('account.move.line')
if move_line_id:
move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
@@ -846,7 +846,7 @@ class account_voucher_line(osv.osv):
@return: Returns a dict that contains default values for fields
"""
- if not context: context = {}
+ if context is None: context = {}
journal_id = context.get('journal_id', False)
partner_id = context.get('partner_id', False)
journal_pool = self.pool.get('account.journal')
@@ -883,7 +883,7 @@ class account_bank_statement(osv.osv):
def button_cancel(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
- if not context: context = {}
+ if context is None: context = {}
for st in self.browse(cr, uid, ids, context=context):
voucher_ids = []
for line in st.line_ids:
@@ -897,7 +897,7 @@ class account_bank_statement(osv.osv):
wf_service = netsvc.LocalService("workflow")
move_line_obj = self.pool.get('account.move.line')
bank_st_line_obj = self.pool.get('account.bank.statement.line')
- if not context: context = {}
+ if context is None: context = {}
st_line = bank_st_line_obj.browse(cr, uid, st_line_id, context=context)
if st_line.voucher_id:
voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
@@ -923,7 +923,7 @@ class account_bank_statement_line(osv.osv):
return {}
res = {}
- if not context: context = {}
+ if context is None: context = {}
# company_currency_id = False
for line in self.browse(cursor, user, ids, context=context):
# if not company_currency_id:
@@ -945,7 +945,7 @@ class account_bank_statement_line(osv.osv):
}
def unlink(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
voucher_obj = self.pool.get('account.voucher')
statement_line = self.browse(cr, uid, ids, context=context)
unlink_ids = []
diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py
index 2cb31f15555..c8e90d283cc 100644
--- a/addons/account_voucher/invoice.py
+++ b/addons/account_voucher/invoice.py
@@ -27,7 +27,7 @@ class invoice(osv.osv):
def invoice_pay_customer(self, cr, uid, ids, context=None):
if not ids: return []
- if not context: context = {}
+ if context is None: context = {}
inv = self.browse(cr, uid, ids[0], context=context)
return {
'name':_("Pay Invoice"),
diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py
index b85c95a58cc..df314012ccd 100644
--- a/addons/account_voucher/wizard/account_statement_from_invoice.py
+++ b/addons/account_voucher/wizard/account_statement_from_invoice.py
@@ -35,7 +35,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
}
def populate_statement(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
statement_id = context.get('statement_id', False)
if not statement_id:
return {}
@@ -134,7 +134,7 @@ class account_statement_from_invoice(osv.osv_memory):
}
def search_invoices(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
line_obj = self.pool.get('account.move.line')
statement_obj = self.pool.get('account.bank.statement')
journal_obj = self.pool.get('account.journal')
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index d1849f6da1e..d5be6c1a81d 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -29,7 +29,6 @@ class account_analytic_account(osv.osv):
_description = 'Analytic Account'
def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
- if not context: context = {}
def recursive_computation(account_id, res):
account = self.browse(cr, uid, account_id)
for son in account.child_ids:
@@ -93,7 +92,6 @@ class account_analytic_account(osv.osv):
if not ids:
return []
res = []
- if not context: context = {}
for account in self.browse(cr, uid, ids, context=context):
data = []
acc = account
@@ -139,7 +137,6 @@ class account_analytic_account(osv.osv):
}
def _default_company(self, cr, uid, context=None):
- if not context: context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
@@ -166,7 +163,6 @@ class account_analytic_account(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context: context = {}
default['code'] = False
default['line_ids'] = []
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
@@ -187,7 +183,7 @@ class account_analytic_account(osv.osv):
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args=[]
- if not context:
+ if context is None:
context={}
account = self.search(cr, uid, [('code', '=', name)]+args, limit=limit, context=context)
if not account:
diff --git a/addons/auction/auction.py b/addons/auction/auction.py
index d4cad3bdc5a..019dcde8052 100644
--- a/addons/auction/auction.py
+++ b/addons/auction/auction.py
@@ -57,8 +57,6 @@ class auction_dates(osv.osv):
return res
def name_get(self, cr, uid, ids, context=None):
- if not context:
- context={}
if not ids:
return []
reads = self.read(cr, uid, ids, ['name', 'auction1'], context)
@@ -68,8 +66,6 @@ class auction_dates(osv.osv):
def _get_invoice(self, cr, uid, ids, name, arg, context=None):
lots_obj = self.pool.get('auction.lots')
result = {}
- if not context:
- context={}
for data in self.browse(cr, uid, ids, context=context):
buyer_inv_ids = []
seller_inv_ids = []
@@ -122,8 +118,6 @@ class auction_dates(osv.osv):
RETURN: True
"""
- if not context:
- context={}
lots_obj = self.pool.get('auction.lots')
lots_ids = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('state', '=', 'draft'), ('obj_price', '>', 0)])
lots_obj.lots_invoice(cr, uid, lots_ids, {}, None)
@@ -196,8 +190,6 @@ class aie_category(osv.osv):
}
def name_get(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = []
if not ids:
return res
@@ -231,8 +223,6 @@ auction_lot_category()
# Lots
#----------------------------------------------------------
def _type_get(self, cr, uid, context=None):
- if not context:
- context = {}
obj = self.pool.get('auction.lot.category')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['name'], context)
@@ -247,23 +237,15 @@ class auction_lots(osv.osv):
_description=__doc__
def button_not_bought(self, cr, uid, ids, context=None):
- if not context:
- context={}
return self.write(cr, uid, ids, {'state':'unsold'})
def button_taken_away(self, cr, uid, ids, context=None):
- if not context:
- context={}
return self.write(cr, uid, ids, {'state':'taken_away', 'ach_emp': True})
def button_unpaid(self, cr, uid, ids, context=None):
- if not context:
- context={}
return self.write(cr, uid, ids, {'state':'draft'})
def button_bought(self, cr, uid, ids, context=None):
- if not context:
- context={}
return self.write(cr, uid, ids, {'state':'sold'})
def _getprice(self, cr, uid, ids, fields, args, context=None):
@@ -273,12 +255,10 @@ class auction_lots(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary of function fields value.
"""
- if not context:
- context = {}
res = {}
account_analytic_line_obj = self.pool.get('account.analytic.line')
- lots = self.browse(cr, uid, ids, context)
+ lots = self.browse(cr, uid, ids, context=context)
pt_tax = self.pool.get('account.tax')
for lot in lots:
taxes = []
@@ -364,8 +344,6 @@ class auction_lots(osv.osv):
return res
def onchange_obj_ret(self, cr, uid, ids, obj_ret, context=None):
- if not context:
- context={}
if obj_ret:
return {'value': {'obj_price': 0}}
return {}
@@ -432,16 +410,12 @@ class auction_lots(osv.osv):
}
def name_get(self, cr, user, ids, context=None):
- if not context:
- context={}
if not ids:
return []
result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name', 'obj_num'])]
return result
def name_search(self, cr, user, name, args=None, operator='ilike', context=None):
- if not context:
- context={}
if not args:
args = []
ids = []
@@ -585,14 +559,12 @@ class auction_lots(osv.osv):
def buyer_proforma(self, cr, uid, ids, context=None):
- if not context:
- context={}
invoices = {}
inv_ref = self.pool.get('account.invoice')
res_obj = self.pool.get('res.partner')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
- for lot in self.browse(cr, uid, ids, context):
+ for lot in self.browse(cr, uid, ids, context=context):
if not lot.obj_price>0:
continue
if not lot.ach_uid.id:
@@ -645,12 +617,10 @@ class auction_lots(osv.osv):
"""
# use each list of object in turn
invoices = {}
- if not context:
- context={}
inv_ref=self.pool.get('account.invoice')
inv_line_obj = self.pool.get('account.invoice.line')
wf_service = netsvc.LocalService('workflow')
- for lot in self.browse(cr, uid, ids, context):
+ for lot in self.browse(cr, uid, ids, context=context):
if not lot.auction_id.id:
continue
if lot.bord_vnd_id.id in invoices:
@@ -686,7 +656,7 @@ class auction_lots(osv.osv):
}
inv_line_obj.create(cr, uid, inv_line, context)
inv_ref.button_compute(cr, uid, invoices.values())
- for inv in inv_ref.browse(cr, uid, invoices.values(), context):
+ for inv in inv_ref.browse(cr, uid, invoices.values(), context=context):
inv_ref.write(cr, uid, [inv.id], {
'check_total': inv.amount_total
})
diff --git a/addons/auction/report/report_auction.py b/addons/auction/report/report_auction.py
index 25cdab88e89..406aedbed89 100644
--- a/addons/auction/report/report_auction.py
+++ b/addons/auction/report/report_auction.py
@@ -28,8 +28,6 @@ import time
import tools
def _type_get(self, cr, uid, context=None):
- if not context:
- context = {}
obj = self.pool.get('auction.lot.category')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['name'], context)
diff --git a/addons/auction/wizard/auction_aie_send.py b/addons/auction/wizard/auction_aie_send.py
index ac04c80ce8c..1076f789b1d 100644
--- a/addons/auction/wizard/auction_aie_send.py
+++ b/addons/auction/wizard/auction_aie_send.py
@@ -60,7 +60,7 @@ class auction_lots_send_aie(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
+ if context is None: context = {}
res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
@@ -149,7 +149,7 @@ class auction_lots_send_aie(osv.osv_memory):
self._photo_bin_send(uname, passwd, ref, did, fname, bin)
def get_dates(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
import httplib
data_obj = self.pool.get('ir.model.data')
conn = httplib.HTTPConnection('www.auction-in-europe.com')
@@ -177,7 +177,6 @@ class auction_lots_send_aie(osv.osv_memory):
}
def _send(self, cr, uid, ids, context=None):
- if not context: context = {}
import pickle, thread, sql_db
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
@@ -215,7 +214,6 @@ class auction_lots_send_aie(osv.osv_memory):
return {}
def send_pdf(self, cr, uid, ids, context=None):
- if not context: context = {}
threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
diff --git a/addons/auction/wizard/auction_aie_send_result.py b/addons/auction/wizard/auction_aie_send_result.py
index bf3d24c4aeb..dd302ac73b5 100644
--- a/addons/auction/wizard/auction_aie_send_result.py
+++ b/addons/auction/wizard/auction_aie_send_result.py
@@ -55,7 +55,7 @@ class auction_lots_pay(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
+ if context is None: context = {}
res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
@@ -98,7 +98,7 @@ class auction_lots_pay(osv.osv_memory):
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def get_dates(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
data_obj = self.pool.get('ir.model.data')
@@ -127,7 +127,7 @@ class auction_lots_pay(osv.osv_memory):
}
def send(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
import pickle
service = netsvc.LocalService("object_proxy")
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
diff --git a/addons/auction/wizard/auction_catalog_flagey_report.py b/addons/auction/wizard/auction_catalog_flagey_report.py
index 746de25b456..22c239e3d6c 100644
--- a/addons/auction/wizard/auction_catalog_flagey_report.py
+++ b/addons/auction/wizard/auction_catalog_flagey_report.py
@@ -36,7 +36,6 @@ class auction_catalog_flagey(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
res = super(auction_catalog_flagey, self).default_get(cr, uid, fields, context=context)
return res
@@ -53,7 +52,7 @@ class auction_catalog_flagey(osv.osv_memory):
"""
lots_obj = self.pool.get('auction.lots')
auc_dates_obj = self.pool.get('auction.dates')
- if not context: context = {}
+ if context is None: context = {}
current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', []))
v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)])
v_ids = lots_obj.browse(cr, uid, v_lots, context=context)
@@ -72,7 +71,7 @@ class auction_catalog_flagey(osv.osv_memory):
@param context: A standard dictionary
@return: Report
"""
- if not context: context = {}
+ if context is None: context = {}
datas = {'ids': context.get('active_ids',[])}
return {
'type': 'ir.actions.report.xml',
diff --git a/addons/auction/wizard/auction_lots_able.py b/addons/auction/wizard/auction_lots_able.py
index 03004de41ce..d9da89385a1 100644
--- a/addons/auction/wizard/auction_lots_able.py
+++ b/addons/auction/wizard/auction_lots_able.py
@@ -38,7 +38,7 @@ class auction_lots_able(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: List of auction lots able’s IDs.
"""
- if not context: context = {}
+ if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True})
return {}
diff --git a/addons/auction/wizard/auction_lots_auction_move.py b/addons/auction/wizard/auction_lots_auction_move.py
index e77fe02528d..97330f922fe 100644
--- a/addons/auction/wizard/auction_lots_auction_move.py
+++ b/addons/auction/wizard/auction_lots_auction_move.py
@@ -44,7 +44,7 @@ class auction_lots_auction_move(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: List of auction lots auction move’s IDs.
"""
- if not context:
+ if context is None:
context={}
auction_bid_line_obj = self.pool.get('auction.bid_line')
auction_lot_history_obj = self.pool.get('auction.lot.history')
diff --git a/addons/auction/wizard/auction_lots_buyer_map.py b/addons/auction/wizard/auction_lots_buyer_map.py
index 3e91bd635d1..f5e9d828936 100644
--- a/addons/auction/wizard/auction_lots_buyer_map.py
+++ b/addons/auction/wizard/auction_lots_buyer_map.py
@@ -42,7 +42,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
+ if context is None: context = {}
res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context=context)
auction_lots_obj = self.pool.get('auction.lots')
lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')])
@@ -63,8 +63,6 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: login field from current record.
"""
- if not context:
- context={}
lots_obj = self.pool.get('auction.lots')
for rec in lots_obj.browse(cr, uid, ids, context=context):
if (len(ids)==1) and (not rec.ach_uid and not rec.ach_login):
@@ -82,7 +80,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param ids: List of ids
@param context: A standard dictionary
"""
- if not context:
+ if context is None:
context={}
rec_ids = context and context.get('active_ids',[]) or []
assert rec_ids, _('Active IDs not Found')
@@ -103,7 +101,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
- if not context:
+ if context is None:
context={}
record_ids = context and context.get('active_ids', []) or []
res = super(wiz_auc_lots_buyer_map, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
diff --git a/addons/auction/wizard/auction_lots_cancel.py b/addons/auction/wizard/auction_lots_cancel.py
index b731f0e4c51..62313315bd9 100644
--- a/addons/auction/wizard/auction_lots_cancel.py
+++ b/addons/auction/wizard/auction_lots_cancel.py
@@ -40,7 +40,7 @@ class auction_lots_cancel(osv.osv):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context={}
lots_obj = self.pool.get('auction.lots')
invoice_obj = self.pool.get('account.invoice')
diff --git a/addons/auction/wizard/auction_lots_enable.py b/addons/auction/wizard/auction_lots_enable.py
index a7f8c43a778..41b6ec909cc 100644
--- a/addons/auction/wizard/auction_lots_enable.py
+++ b/addons/auction/wizard/auction_lots_enable.py
@@ -35,7 +35,7 @@ class auction_lots_enable(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: List of auction lots enable’s IDs.
"""
- if not context: context = {}
+ if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False})
return {}
diff --git a/addons/auction/wizard/auction_lots_invoice.py b/addons/auction/wizard/auction_lots_invoice.py
index eac3d397bc1..ac296ec1dd7 100644
--- a/addons/auction/wizard/auction_lots_invoice.py
+++ b/addons/auction/wizard/auction_lots_invoice.py
@@ -46,7 +46,7 @@ class auction_lots_invoice(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
+ if context is None: context = {}
res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
@@ -102,7 +102,7 @@ class auction_lots_invoice(osv.osv_memory):
@param ids: List of Auction lots make invoice buyer’s IDs
@return: dictionary of account invoice form.
"""
- if not context: context = {}
+ if context is None: context = {}
service = netsvc.LocalService("object_proxy")
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['number','ach_uid'])
diff --git a/addons/auction/wizard/auction_lots_make_invoice.py b/addons/auction/wizard/auction_lots_make_invoice.py
index e4a6f1dd924..3a87a202b74 100644
--- a/addons/auction/wizard/auction_lots_make_invoice.py
+++ b/addons/auction/wizard/auction_lots_make_invoice.py
@@ -50,7 +50,7 @@ class auction_lots_make_invoice(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context={}
res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
lots_obj = self.pool.get('auction.lots')
@@ -69,7 +69,7 @@ class auction_lots_make_invoice(osv.osv_memory):
@param ids: List of Auction lots make invoice’s IDs
@return: dictionary of account invoice form.
"""
- if not context:
+ if context is None:
context={}
order_obj = self.pool.get('auction.lots')
mod_obj = self.pool.get('ir.model.data')
diff --git a/addons/auction/wizard/auction_lots_make_invoice_buyer.py b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
index 5732da610d8..dc39ccbb717 100644
--- a/addons/auction/wizard/auction_lots_make_invoice_buyer.py
+++ b/addons/auction/wizard/auction_lots_make_invoice_buyer.py
@@ -45,7 +45,7 @@ class auction_lots_make_invoice_buyer(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context={}
res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context)
lots_obj=self.pool.get('auction.lots')
diff --git a/addons/auction/wizard/auction_lots_numerotate.py b/addons/auction/wizard/auction_lots_numerotate.py
index 260f9c6bf00..a4532059d3d 100644
--- a/addons/auction/wizard/auction_lots_numerotate.py
+++ b/addons/auction/wizard/auction_lots_numerotate.py
@@ -48,7 +48,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
+ if context is None: context = {}
res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context)
active_id = context.get('active_id',False)
active_model = context.get('active_model')
@@ -91,6 +91,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
}
def numerotate(self, cr, uid, ids, context=None):
+ if context is None: context = {}
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
@@ -133,6 +134,7 @@ class auction_lots_numerotate_per_lot(osv.osv_memory):
return lots_datas[0]
def test_exist(self, cr, uid, ids, context=None):
+ if context is None: context = {}
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/auction/wizard/auction_lots_sms_send.py b/addons/auction/wizard/auction_lots_sms_send.py
index d2f1b217951..ea1d094f55b 100644
--- a/addons/auction/wizard/auction_lots_sms_send.py
+++ b/addons/auction/wizard/auction_lots_sms_send.py
@@ -44,7 +44,7 @@ class auction_lots_sms_send(osv.osv_memory):
@param context: A standard dictionary
@return: number indicating the acknowledgement
"""
- if not context: context = {}
+ if context is None: context = {}
lot_obj = self.pool.get('auction.lots')
partner_obj = self.pool.get('res.partner')
partner_address_obj = self.pool.get('res.partner.address')
diff --git a/addons/auction/wizard/auction_pay_buy.py b/addons/auction/wizard/auction_pay_buy.py
index ce3ee20a339..1dc029ed12a 100644
--- a/addons/auction/wizard/auction_pay_buy.py
+++ b/addons/auction/wizard/auction_pay_buy.py
@@ -48,7 +48,7 @@ class auction_pay_buy(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context={}
res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context)
auction_lots_obj= self.pool.get('auction.lots')
@@ -70,7 +70,7 @@ class auction_pay_buy(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context: context = {}
+ if context is None: context = {}
lot_obj = self.pool.get('auction.lots')
bank_statement_line_obj = self.pool.get('account.bank.statement.line')
diff --git a/addons/auction/wizard/auction_pay_sel.py b/addons/auction/wizard/auction_pay_sel.py
index e3dd5402b61..23b16743246 100644
--- a/addons/auction/wizard/auction_pay_sel.py
+++ b/addons/auction/wizard/auction_pay_sel.py
@@ -42,7 +42,7 @@ class auction_pay_sel(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context: context = {}
+ if context is None: context = {}
lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context=context)
invoice_obj = self.pool.get('account.invoice')
for datas in self.read(cr, uid, ids, context=context):
diff --git a/addons/auction/wizard/auction_payer_sel.py b/addons/auction/wizard/auction_payer_sel.py
index b6dec9546d3..f1df4d1cd47 100644
--- a/addons/auction/wizard/auction_payer_sel.py
+++ b/addons/auction/wizard/auction_payer_sel.py
@@ -26,7 +26,7 @@ class auction_payer(osv.osv_memory):
_description = "Auction payer"
def payer(self, cr, uid, ids, context=None):
- if not context: context = {}
+ if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'})
return {}
@@ -46,7 +46,7 @@ class auction_payer_sel(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: List of auction payer sel’s IDs.
"""
- if not context: context = {}
+ if context is None: context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True})
return {}
diff --git a/addons/auction/wizard/auction_taken.py b/addons/auction/wizard/auction_taken.py
index 4ad4fcbe372..8ada436ae5d 100644
--- a/addons/auction/wizard/auction_taken.py
+++ b/addons/auction/wizard/auction_taken.py
@@ -42,7 +42,7 @@ class auction_taken(osv.osv_memory):
@param ids: List of Auction taken’s IDs
@return: dictionary of lot_ids fields with empty list
"""
- if not context:
+ if context is None:
context={}
lot_obj = self.pool.get('auction.lots')
for current in self.browse(cr, uid, ids, context=context):
diff --git a/addons/auction/wizard/auction_transfer_unsold_object.py b/addons/auction/wizard/auction_transfer_unsold_object.py
index 65b4329f622..8bc0cb8cb5b 100644
--- a/addons/auction/wizard/auction_transfer_unsold_object.py
+++ b/addons/auction/wizard/auction_transfer_unsold_object.py
@@ -63,7 +63,7 @@ class auction_transfer_unsold_object(osv.osv):
@param context: A standard dictionary
@return:
"""
- if not context: context = {}
+ if context is None: context = {}
bid_line_obj = self.pool.get('auction.bid_line')
lots_obj = self.pool.get('auction.lots')
lot_history_obj = self.pool.get('auction.lot.history')
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index c2ef5f5d4a4..d394eab6563 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -196,8 +196,6 @@ class audittrail_objects_proxy(osv_pool):
@param values: Values for field to be converted into textual values
@return: values: List of textual values for given fields
"""
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
field_pool = pool.get('ir.model.fields')
model_pool = pool.get('ir.model')
diff --git a/addons/audittrail/wizard/audittrail_view_log.py b/addons/audittrail/wizard/audittrail_view_log.py
index 54955dbc388..7d3894c8a1d 100644
--- a/addons/audittrail/wizard/audittrail_view_log.py
+++ b/addons/audittrail/wizard/audittrail_view_log.py
@@ -42,8 +42,6 @@ class audittrail_view_log(osv.osv_memory):
@param ids: List of audittrail view log’s IDs.
@return: Dictionary of audittrail log form on given date range.
"""
- if not context:
- context = {}
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 43bed5f5ecd..bf34c137b5a 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -157,7 +157,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return True
def _create(self, old_create, model, context=None):
- if not context:
+ if context is None:
context = {}
def make_call_old(cr, uid, vals, context=context):
new_id = old_create(cr, uid, vals, context=context)
@@ -167,7 +167,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return make_call_old
def _write(self, old_write, model, context=None):
- if not context:
+ if context is None:
context = {}
def make_call_old(cr, uid, ids, vals, context=context):
if isinstance(ids, (str, int, long)):
@@ -178,7 +178,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
return make_call_old
def _register_hook(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
for action_rule in self.browse(cr, uid, ids, context=context):
model = action_rule.model_id.model
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 9aa5b4bfd9e..2228a33c2e2 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -106,7 +106,6 @@ def _links_get(self, cr, uid, context=None):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain object and name and id.
"""
- if not context: context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
@@ -234,7 +233,6 @@ class calendar_attendee(osv.osv):
"""
name = name[0]
result = {}
- if not context: context = {}
for attdata in self.browse(cr, uid, ids, context=context):
id = attdata.id
result[id] = {}
@@ -301,7 +299,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain object and name and id.
"""
- if not context: context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
@@ -315,7 +312,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
@return: list of dictionary which contain code and name and id.
"""
- if not context: context = {}
obj = self.pool.get('res.lang')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['code', 'name'], context=context)
@@ -1595,7 +1591,6 @@ true, it will allow you to hide the event alarm information without removing it.
@return: True
"""
res = False
- if not context: context = {}
for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context):
event_id = event_datas['id']
if isinstance(event_id, (int, long)):
@@ -1700,7 +1695,6 @@ class calendar_todo(osv.osv):
"""
res = {}
- if not context: context = {}
for event in self.browse(cr, uid, ids, context=context):
res[event.id] = event.date_start
return res
diff --git a/addons/base_calendar/wizard/base_calendar_invite_attendee.py b/addons/base_calendar/wizard/base_calendar_invite_attendee.py
index af3e5ef3703..48f39e609f9 100644
--- a/addons/base_calendar/wizard/base_calendar_invite_attendee.py
+++ b/addons/base_calendar/wizard/base_calendar_invite_attendee.py
@@ -62,7 +62,7 @@ send an Email to Invited Person')
@return: Dictionary of {}.
"""
- if not context:
+ if context is None:
context = {}
model = False
diff --git a/addons/base_calendar/wizard/base_calendar_set_exrule.py b/addons/base_calendar/wizard/base_calendar_set_exrule.py
index 44b70b03ee2..fa65c27f72c 100644
--- a/addons/base_calendar/wizard/base_calendar_set_exrule.py
+++ b/addons/base_calendar/wizard/base_calendar_set_exrule.py
@@ -82,7 +82,7 @@ class base_calendar_set_exrule(osv.osv_memory):
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
"""
- if not context: context = {}
+ if context is None: context = {}
event_obj = self.pool.get(context.get('active_model'))
for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context):
if not event.rrule:
@@ -103,7 +103,7 @@ class base_calendar_set_exrule(osv.osv_memory):
weekstring = ''
monthstring = ''
yearstring = ''
- if not context: context = {}
+ if context is None: context = {}
ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False))
model = context.get('model', False)
model_obj = self.pool.get(model)
diff --git a/addons/base_calendar/wizard/calendar_event_edit_all.py b/addons/base_calendar/wizard/calendar_event_edit_all.py
index e9698a33445..a9b0a9f347e 100644
--- a/addons/base_calendar/wizard/calendar_event_edit_all.py
+++ b/addons/base_calendar/wizard/calendar_event_edit_all.py
@@ -69,7 +69,7 @@ class calendar_event_edit_all(osv.osv_memory):
@param ids: List of calendar event edit all’s IDs
@return: dictionary {}
"""
- if not context:
+ if context is None:
context = {}
context_id = context and context.get('active_id', False) or False
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index d0339f55d7a..827ac56fa17 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -36,7 +36,6 @@ class res_partner_contact(osv.osv):
@fields: Get Fields
@param context: A standard dictionary for contextual values
@param arg: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...]. """
- if not context: context = {}
res = dict.fromkeys(ids, False)
res_partner_job_obj = self.pool.get('res.partner.job')
@@ -92,7 +91,6 @@ class res_partner_contact(osv.osv):
if not len(ids):
return []
res = []
- if not context: context = {}
for contact in self.browse(cr, user, ids, context=context):
_contact = ""
if contact.title:
@@ -133,7 +131,7 @@ class res_partner_address(osv.osv):
if not len(ids):
return []
res = []
- if not context: context = {}
+ if context is None: context = {}
for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']):
if context.get('contact_display', 'contact')=='partner' and r['partner_id']:
res.append((r['id'], r['partner_id'][1]))
@@ -238,7 +236,6 @@ class res_partner_job(osv.osv):
@address_id : ID of the Address selected,
@param context: A standard dictionary for contextual values
"""
- if not context: context = {}
partner_id = False
if address_id:
address = self.pool.get('res.partner.address')\
diff --git a/addons/base_contact/base_contact_installer.py b/addons/base_contact/base_contact_installer.py
index a20e04849c3..6d979da7a02 100644
--- a/addons/base_contact/base_contact_installer.py
+++ b/addons/base_contact/base_contact_installer.py
@@ -35,7 +35,6 @@ class base_contact_installer(osv.osv_memory):
"""
This function is used to create contact and address from existing partner address
"""
- if not context: context = {}
obj = self.pool.get("base.contact.installer").browse(cr, uid, uid, context=context)
if obj.migrate:
cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;
diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py
index 345c0b8a797..e6c61d69836 100644
--- a/addons/base_iban/base_iban.py
+++ b/addons/base_iban/base_iban.py
@@ -75,14 +75,12 @@ class res_partner_bank(osv.osv):
def create(self, cr, uid, vals, context=None):
#overwrite to format the iban number correctly
- if not context: context = {}
if 'iban' in vals and vals['iban']:
vals['iban'] = _format_iban(vals['iban'])
return super(res_partner_bank, self).create(cr, uid, vals, context)
def write(self, cr, uid, ids, vals, context=None):
#overwrite to format the iban number correctly
- if not context: context = {}
if 'iban' in vals and vals['iban']:
vals['iban'] = _format_iban(vals['iban'])
return super(res_partner_bank, self).write(cr, uid, ids, vals, context)
@@ -91,7 +89,6 @@ class res_partner_bank(osv.osv):
'''
Check the IBAN number
'''
- if not context: context = {}
for bank_acc in self.browse(cr, uid, ids, context=context):
if not bank_acc.iban:
continue
@@ -126,7 +123,6 @@ class res_partner_bank(osv.osv):
def name_get(self, cr, uid, ids, context=None):
res = []
to_check_ids = []
- if not context: context = {}
for id in self.browse(cr, uid, ids, context=context):
if id.state=='iban':
res.append((id.id,id.iban))
@@ -137,7 +133,6 @@ class res_partner_bank(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
#overwrite the search method in order to search not only on bank type == basic account number but also on type == iban
- if not context: context = {}
res = super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
if filter(lambda x:x[0]=='acc_number' ,args):
#get the value of the search
@@ -156,7 +151,6 @@ class res_partner_bank(osv.osv):
This function returns the bank account number computed from the iban account number, thanks to the mapping_list dictionary that contains the rules associated to its country.
'''
res = {}
- if not context: context = {}
mapping_list = {
#TODO add rules for others countries
'be': lambda x: x[4:],
diff --git a/addons/base_module_doc_rst/base_module_doc_rst.py b/addons/base_module_doc_rst/base_module_doc_rst.py
index 18036edf09e..57b26fd0d44 100755
--- a/addons/base_module_doc_rst/base_module_doc_rst.py
+++ b/addons/base_module_doc_rst/base_module_doc_rst.py
@@ -37,7 +37,6 @@ class module(osv.osv):
def _get_graphical_representation(self, cr, uid, model_ids, level=1, context=None):
obj_model = self.pool.get('ir.model')
- if not context: context = {}
if level == 0:
return tuple()
relation = []
@@ -100,7 +99,7 @@ class module(osv.osv):
return obj_ids
def get_relation_graph(self, cr, uid, module_name, context=None):
- if not context: context = {}
+ if context is None: context = {}
object_ids = self._get_module_objects(cr, uid, module_name, context=context)
if not object_ids:
return {'module_file': False}
diff --git a/addons/base_module_doc_rst/wizard/generate_relation_graph.py b/addons/base_module_doc_rst/wizard/generate_relation_graph.py
index a70c8eaa0f7..7b04f183129 100644
--- a/addons/base_module_doc_rst/wizard/generate_relation_graph.py
+++ b/addons/base_module_doc_rst/wizard/generate_relation_graph.py
@@ -30,7 +30,6 @@ form_rep = '''<?xml version="1.0"?>
def _get_graph(self, cr, uid, datas, context=None):
mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
- if not context: context = {}
modules = mod_obj.browse(cr, uid, datas['ids'], context=context)
for module in modules:
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)
diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py
index 13447778043..24a721debe6 100644
--- a/addons/base_report_creator/base_report_creator.py
+++ b/addons/base_report_creator/base_report_creator.py
@@ -363,7 +363,6 @@ class report_creator(osv.osv):
@return: Dictionary of sql query.
"""
result = {}
- if not context: context = {}
for obj in self.browse(cr, uid, ids, context=context):
fields = []
groupby = []
@@ -452,7 +451,7 @@ class report_creator(osv.osv):
@param context: A standard dictionary for contextual values
@return : Dictionary value for base creator report form
"""
- if not context:
+ if context is None:
context = {}
rep = self.browse(cr, uid, ids, context=context)
@@ -487,7 +486,6 @@ class report_creator(osv.osv):
@return: True if display field which are stored in database.
or false if display field which are not store in dtabase.
"""
- if not context: context = {}
this_objs = self.browse(cr, uid, ids, context=context)
for obj in this_objs:
for fld in obj.field_ids:
@@ -509,7 +507,6 @@ class report_creator(osv.osv):
@return: True if model colume type is in integer or float.
or false model colume type is not in integer or float.
"""
- if not context: context = {}
aggregate_columns = ('integer', 'float')
apply_functions = ('sum', 'min', 'max', 'avg', 'count')
this_objs = self.browse(cr, uid, ids, context=context)
@@ -525,7 +522,6 @@ class report_creator(osv.osv):
def _calander_view_error(self, cr, uid, ids, context=None):
required_types = []
- if not context: context = {}
this_objs = self.browse(cr, uid, ids, context=context)
for obj in this_objs:
if obj.view_type1 == 'calendar' or obj.view_type2 == 'calendar' or obj.view_type3 == 'calendar':
diff --git a/addons/base_report_creator/wizard/report_menu_create.py b/addons/base_report_creator/wizard/report_menu_create.py
index 84b952f976a..9f6eba3f806 100644
--- a/addons/base_report_creator/wizard/report_menu_create.py
+++ b/addons/base_report_creator/wizard/report_menu_create.py
@@ -40,7 +40,7 @@ class report_menu_create(osv.osv_memory):
@param ids: List of Report Menu Create's IDs
@return: Dictionary {}.
"""
- if not context:
+ if context is None:
context = {}
context_id = context and context.get('active_id', False) or False
obj_menu = self.pool.get('ir.ui.menu')
diff --git a/addons/base_report_designer/base_report_designer.py b/addons/base_report_designer/base_report_designer.py
index 93c05a93f48..16edc45560d 100644
--- a/addons/base_report_designer/base_report_designer.py
+++ b/addons/base_report_designer/base_report_designer.py
@@ -46,7 +46,6 @@ class report_xml(osv.osv):
'''
Untested function
'''
- if not context: context = {}
pool = pooler.get_pool(cr.dbname)
sxwval = StringIO(base64.decodestring(file_sxw))
if file_type=='sxw':
@@ -61,7 +60,6 @@ class report_xml(osv.osv):
return True
def report_get(self, cr, uid, report_id, context=None):
- if not context: context = {}
report = self.browse(cr, uid, report_id, context=context)
return {
'file_type' : report.report_type,
diff --git a/addons/base_report_designer/installer.py b/addons/base_report_designer/installer.py
index 68947ef6d88..d21fd11af00 100644
--- a/addons/base_report_designer/installer.py
+++ b/addons/base_report_designer/installer.py
@@ -30,7 +30,6 @@ class base_report_designer_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def default_get(self, cr, uid, fields, context=None):
- if not context: context = {}
data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context=context)
plugin_file = open(addons.get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
data['plugin_file'] = base64.encodestring(plugin_file.read())
diff --git a/addons/base_report_designer/wizard/base_report_designer_modify.py b/addons/base_report_designer/wizard/base_report_designer_modify.py
index e96f6ced73f..fef2d1c56af 100644
--- a/addons/base_report_designer/wizard/base_report_designer_modify.py
+++ b/addons/base_report_designer/wizard/base_report_designer_modify.py
@@ -39,7 +39,6 @@ class base_report_sxw(osv.osv_memory):
def get_report(self, cr, uid, ids, context=None):
- if not context: context = {}
data = self.read(cr,uid,ids)[0]
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw')
@@ -75,12 +74,11 @@ class base_report_file_sxw(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
- if not context: context = {}
res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context)
report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[])
data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0]
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
- if not context:
+ if context is None:
context={}
if 'report_id' in fields:
res['report_id'] = data['report_id']
@@ -96,7 +94,6 @@ class base_report_file_sxw(osv.osv_memory):
def upload_report(self, cr, uid, ids, context=None):
from base_report_designer import openerp_sxw2rml
import StringIO
- if not context: context = {}
data=self.read(cr,uid,ids)[0]
sxwval = StringIO.StringIO(base64.decodestring(data['file_sxw_upload']))
fp = tools.file_open('normalized_oo2rml.xsl',subdir='addons/base_report_designer/openerp_sxw2rml')
@@ -137,8 +134,6 @@ class base_report_rml_save(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
- if not context:
- context = {}
res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context)
report_id = self.pool.get('base.report.sxw').search(cr,uid,[])
diff --git a/addons/base_synchro/wizard/base_synchro.py b/addons/base_synchro/wizard/base_synchro.py
index 7c6ab6e42f0..d3c1de40d6d 100644
--- a/addons/base_synchro/wizard/base_synchro.py
+++ b/addons/base_synchro/wizard/base_synchro.py
@@ -66,8 +66,6 @@ class base_synchro(osv.osv_memory):
report_write = 0
def synchronize(self, cr, uid, server, object, context=None):
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
self.meta = {}
ids = []
@@ -139,8 +137,6 @@ class base_synchro(osv.osv_memory):
return True
def get_id(self, cr, uid, object_id, id, action, context=None):
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
line_pool = pool.get('base.synchro.obj.line')
field_src = (action=='u') and 'local_id' or 'remote_id'
@@ -154,8 +150,6 @@ class base_synchro(osv.osv_memory):
def relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context=None):
if not id:
return False
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
cr.execute('''select o.id from base_synchro_obj o left join ir_model m on (o.model_id =m.id) where
m.model=%s and
@@ -189,8 +183,6 @@ class base_synchro(osv.osv_memory):
def data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context=None):
self.meta.setdefault(pool_src, {})
- if not context:
- context = {}
if not object in self.meta[pool_src]:
self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context=context)
fields = self.meta[pool_src][object]
@@ -221,8 +213,6 @@ class base_synchro(osv.osv_memory):
def upload_download(self, cr, uid, ids, context=None):
- if not context:
- context = {}
start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
syn_obj = self.browse(cr, uid, ids, context=context)[0]
pool = pooler.get_pool(cr.dbname)
@@ -260,8 +250,6 @@ Exceptions:
return True
def upload_download_multi_thread(self, cr, uid, data, context=None):
- if not context:
- context = {}
threaded_synchronization = threading.Thread(target=self.upload_download, args=(cr, uid, data, context))
threaded_synchronization.run()
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/board/board.py b/addons/board/board.py
index 0c51ae8632f..0a7cd030043 100644
--- a/addons/board/board.py
+++ b/addons/board/board.py
@@ -38,8 +38,6 @@ class board_board(osv.osv):
@param ids: List of Board's IDs
@return: arch of xml view.
"""
- if not context:
- context = {}
board = self.pool.get('board.board').browse(cr, uid, ids, context=context)
left = []
right = []
@@ -81,8 +79,6 @@ class board_board(osv.osv):
dictionary must be with the form: {‘name_of_the_field’: value, ...}.
@return: True
"""
- if not context:
- context = {}
result = super(board_board, self).write(cr, uid, ids, vals, context=context)
board = self.pool.get('board.board').browse(cr, uid, ids[0], context=context)
@@ -101,8 +97,6 @@ class board_board(osv.osv):
@return: id of new created record of board.board.
"""
- if not context:
- context = {}
if not 'name' in vals:
return False
@@ -126,8 +120,6 @@ class board_board(osv.osv):
@return: Dictionary of Fields, arch and toolbar.
"""
- if not context:
- context = {}
res = {}
res = super(board_board, self).fields_view_get(cr, user, view_id, view_type,\
diff --git a/addons/board/wizard/board_menu_create.py b/addons/board/wizard/board_menu_create.py
index 18eae8d1e3f..2b688962265 100644
--- a/addons/board/wizard/board_menu_create.py
+++ b/addons/board/wizard/board_menu_create.py
@@ -55,7 +55,7 @@ class board_menu_create(osv.osv_memory):
@param ids: List of Board Menu Create's IDs
@return: Dictionary {}.
"""
- if not context:
+ if context is None:
context = {}
context_id = context and context.get('active_id', False) or False
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index b01b5f97cc3..d60b7f90e91 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -149,7 +149,7 @@ def get_attribute_mapping(cr, uid, calname, context=None):
@param calname: Get Calendar name
@param context: A standard dictionary for contextual values """
- if not context:
+ if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
field_obj = pool.get('basic.calendar.fields')
@@ -470,7 +470,7 @@ class CalDAV(object):
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
ids = []
model_obj = self.pool.get(context.get('model'))
@@ -592,7 +592,7 @@ class Calendar(CalDAV, osv.osv):
}
def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None):
- if not context:
+ if context is None:
context = {}
if not domain:
domain = []
@@ -622,7 +622,7 @@ class Calendar(CalDAV, osv.osv):
def get_cal_max_modified(self, cr, uid, ids, parent=None, domain=None, context=None):
- if not context:
+ if context is None:
context = {}
if not domain:
domain = []
@@ -652,7 +652,7 @@ class Calendar(CalDAV, osv.osv):
@param vobj: the type of object to export
@return the ical data.
"""
- if not context:
+ if context is None:
context = {}
ctx_model = context.get('model', None)
ctx_res_id = context.get('res_id', None)
@@ -684,7 +684,7 @@ class Calendar(CalDAV, osv.osv):
@param data_id: Get Data’s ID or False
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
vals = []
ical_data = content
@@ -1066,7 +1066,7 @@ class Timezone(CalDAV, osv.osv_memory):
@param model: Get Model's name
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
ctx = context.copy()
ctx.update({'model': model})
@@ -1125,7 +1125,7 @@ class Alarm(CalDAV, osv.osv_memory):
@param alarm_id: Get Alarm's Id
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
valarm = vevent.add('valarm')
alarm_object = self.pool.get(model)
@@ -1246,7 +1246,7 @@ class Attendee(CalDAV, osv.osv_memory):
@param attendee_ids: Get Attendee's Id
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
attendee_object = self.pool.get(model)
ctx = context.copy()
diff --git a/addons/caldav/calendar_collection.py b/addons/caldav/calendar_collection.py
index 828927668cd..1258ba5bf18 100644
--- a/addons/caldav/calendar_collection.py
+++ b/addons/caldav/calendar_collection.py
@@ -35,8 +35,6 @@ class calendar_collection(osv.osv):
}
def _get_root_calendar_directory(self, cr, uid, context=None):
- if not context:
- context = {}
objid = self.pool.get('ir.model.data')
try:
mid = objid._get_id(cr, uid, 'document', 'dir_calendars')
@@ -52,8 +50,6 @@ class calendar_collection(osv.osv):
return False
def get_node_class(self, cr, uid, ids, dbro=None, dynamic=False, context=None):
- if not context:
- context = {}
if dbro is None:
dbro = self.browse(cr, uid, ids, context=context)
@@ -69,13 +65,9 @@ class calendar_collection(osv.osv):
def get_description(self, cr, uid, ids, context=None):
#TODO : return description of all calendars
- if not context:
- context = {}
return False
def get_schedule_inbox_URL(self, cr, uid, ids, context=None):
- if not context:
- context = {}
calendar_obj = self.pool.get('basic.calendar')
calendar_ids = calendar_obj.search(cr, uid, [
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 0382cb12564..2d4f997fc91 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -53,7 +53,7 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
if not context.get('portal', False):
return False
@@ -66,7 +66,7 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
if not context.get('portal', False):
return False
@@ -136,8 +136,6 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
return user.context_section_id.id or False
@@ -149,8 +147,6 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
- if not context:
- context = {}
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context=context):
@@ -183,8 +179,6 @@ class crm_case(object):
@param uid: the current user’s ID for security checks,
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
- if not context:
- context = {}
stage_pool = self.pool.get('crm.case.stage')
model = self._name
for case in self.browse(cr, uid, ids, context=context):
@@ -384,8 +378,6 @@ class crm_case(object):
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
for case in self.browse(cr, uid, ids, context=context):
if not case.section_id.reply_to:
raise osv.except_osv(_('Error!'), ("Reply To is not specified in the sales team"))
@@ -450,7 +442,7 @@ class crm_case(object):
return self._action(cr, uid, cases, False, context=context)
def _action(self, cr, uid, cases, state_to, scrit=None, context=None):
- if not context:
+ if context is None:
context = {}
context['state_to'] = state_to
rule_obj = self.pool.get('base.action.rule')
@@ -469,8 +461,6 @@ class crm_case(object):
""" Get a list of emails of the people following this thread
"""
res = {}
- if not context:
- context = {}
for case in self.browse(cr, uid, ids, context=context):
l=[]
if case.email_cc:
@@ -587,7 +577,7 @@ class crm_case_section(osv.osv):
@param uid: the current user’s ID for security checks,
@param ids: List of sales team ids
"""
- if not context:
+ if context is None:
context = {}
res = []
@@ -661,8 +651,6 @@ def _links_get(self, cr, uid, context=None):
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
obj = self.pool.get('res.request.link')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['object', 'name'], context)
diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py
index 0c8d6ac492f..477f9132fab 100644
--- a/addons/crm/crm_action_rule.py
+++ b/addons/crm/crm_action_rule.py
@@ -51,8 +51,6 @@ 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=None):
- if not context:
- 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:
@@ -74,8 +72,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values"""
- if not context:
- context = {}
ok = super(base_action_rule, self).do_check(cr, uid, action, obj, context=context)
if hasattr(obj, 'section_id'):
@@ -111,8 +107,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
res = super(base_action_rule, self).do_action(cr, uid, action, model_obj, obj, context=context)
write = {}
@@ -150,8 +144,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
res = super(base_action_rule, self).state_get(cr, uid, context=context)
return res + crm.AVAILABLE_STATES
@@ -160,8 +152,6 @@ this if you want the rule to send an email to the partner."),
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
res = super(base_action_rule, self).priority_get(cr, uid, context=context)
return res + crm.AVAILABLE_PRIORITIES
diff --git a/addons/crm/crm_installer.py b/addons/crm/crm_installer.py
index 7c068c9cabc..32551d438c4 100644
--- a/addons/crm/crm_installer.py
+++ b/addons/crm/crm_installer.py
@@ -40,8 +40,6 @@ class crm_installer(osv.osv_memory):
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- if not context:
- context = {}
res = super(crm_installer, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
#Checking sale module is installed or not
cr.execute("SELECT * from ir_module_module where state='installed' and name = 'sale'")
diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py
index ee649c18dc9..6522085be9b 100644
--- a/addons/crm/crm_lead.py
+++ b/addons/crm/crm_lead.py
@@ -53,8 +53,6 @@ class crm_lead(crm_case, osv.osv):
res_obj = self.pool.get('resource.resource')
res = {}
- if not context:
- context = {}
for lead in self.browse(cr, uid, ids, context=context):
for field in fields:
res[lead.id] = {}
@@ -237,7 +235,7 @@ class crm_lead(crm_case, osv.osv):
@param context: A standard dictionary for contextual values
@return: Value of action in dict
"""
- if not context:
+ if context is None:
context = {}
context.update({'active_ids': ids})
@@ -321,8 +319,6 @@ class crm_lead(crm_case, osv.osv):
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks
"""
- if not context:
- context = {}
mailgate_pool = self.pool.get('email.server.tools')
subject = msg.get('subject')
@@ -366,8 +362,6 @@ class crm_lead(crm_case, osv.osv):
@param uid: the current user’s ID for security checks,
@param ids: List of update mail’s IDs
"""
- if not context:
- context = {}
if isinstance(ids, (str, int, long)):
ids = [ids]
diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py
index d6ec3d7f9cd..cb18b1fe270 100644
--- a/addons/crm/crm_meeting.py
+++ b/addons/crm/crm_meeting.py
@@ -91,9 +91,6 @@ class crm_meeting(crm_case, osv.osv):
@return: Dictionary value which open Crm Meeting form.
"""
- if not context:
- context = {}
-
data_obj = self.pool.get('ir.model.data')
value = {}
@@ -154,8 +151,6 @@ class calendar_attendee(osv.osv):
@param context: A standard dictionary for contextual values
"""
name = name[0]
- if not context:
- context = {}
result = super(calendar_attendee, self)._compute_data(cr, uid, ids, name, arg, context=context)
for attdata in self.browse(cr, uid, ids, context=context):
diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py
index eeca1a6cb50..3c2f1ba2050 100644
--- a/addons/crm/crm_opportunity.py
+++ b/addons/crm/crm_opportunity.py
@@ -145,9 +145,6 @@ class crm_opportunity(osv.osv):
if not stage_id:
return {'value':{}}
- if not context:
- context = {}
-
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context=context)
if not stage.on_change:
@@ -171,8 +168,6 @@ class crm_opportunity(osv.osv):
@return : Dictionary value for created Meeting view
"""
value = {}
- if not context:
- context = {}
for opp in self.browse(cr, uid, ids, context=context):
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py
index 1ad8878f0d4..2b2066f6eb2 100644
--- a/addons/crm/crm_phonecall.py
+++ b/addons/crm/crm_phonecall.py
@@ -157,8 +157,6 @@ class crm_phonecall(crm_case, osv.osv):
@return : Dictionary value for created Meeting view
"""
value = {}
- if not context:
- context = {}
for phonecall in self.browse(cr, uid, ids, context=context):
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/crm/wizard/crm_add_note.py b/addons/crm/wizard/crm_add_note.py
index 6bdf472cd97..3c57156a23f 100644
--- a/addons/crm/wizard/crm_add_note.py
+++ b/addons/crm/wizard/crm_add_note.py
@@ -19,7 +19,7 @@ class crm_add_note(osv.osv_memory):
}
def action_add(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
if not context.get('active_model'):
diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py
index 5e1c8ae946b..b008939ef95 100644
--- a/addons/crm/wizard/crm_lead_to_opportunity.py
+++ b/addons/crm/wizard/crm_lead_to_opportunity.py
@@ -122,7 +122,7 @@ class crm_lead2opportunity(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@@ -177,7 +177,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
- if not context:
+ if context is None:
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
@@ -214,7 +214,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@return : Dictionary value for Opportunity form
"""
value = {}
- if not context:
+ if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
@@ -247,7 +247,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@@ -282,7 +282,7 @@ class crm_lead2opportunity_action(osv.osv_memory):
@return : Dictionary value for Opportunity form
"""
value = {}
- if not context:
+ if context is None:
context = {}
data_obj = self.pool.get('ir.model.data')
view_id = False
diff --git a/addons/crm/wizard/crm_lead_to_partner.py b/addons/crm/wizard/crm_lead_to_partner.py
index e21580a9522..08e75874d67 100644
--- a/addons/crm/wizard/crm_lead_to_partner.py
+++ b/addons/crm/wizard/crm_lead_to_partner.py
@@ -135,7 +135,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary value for next form.
"""
- if not context:
+ if context is None:
context = {}
view_obj = self.pool.get('ir.ui.view')
@@ -163,7 +163,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary {}.
"""
- if not context:
+ if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@@ -226,7 +226,7 @@ class crm_lead2partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
- if not context:
+ if context is None:
context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
diff --git a/addons/crm/wizard/crm_phonecall_to_meeting.py b/addons/crm/wizard/crm_phonecall_to_meeting.py
index bbad4644168..06c46b8bf55 100644
--- a/addons/crm/wizard/crm_phonecall_to_meeting.py
+++ b/addons/crm/wizard/crm_phonecall_to_meeting.py
@@ -32,7 +32,7 @@ import pooler
class phonecall2meeting(wizard.interface):
def _makeMeeting(self, cr, uid, data, context=None):
- if not context:
+ if context is None:
context = {}
pool = pooler.get_pool(cr.dbname)
phonecall_case_obj = pool.get('crm.phonecall')
diff --git a/addons/crm/wizard/crm_phonecall_to_partner.py b/addons/crm/wizard/crm_phonecall_to_partner.py
index ac411f1c5ce..38e673108e4 100644
--- a/addons/crm/wizard/crm_phonecall_to_partner.py
+++ b/addons/crm/wizard/crm_phonecall_to_partner.py
@@ -63,7 +63,7 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Partner id if any for selected phonecall.
"""
- if not context:
+ if context is None:
context = {}
phonecall_obj = self.pool.get('crm.phonecall')
@@ -99,8 +99,6 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary value for next form.
"""
- if not context:
- context = {}
view_obj = self.pool.get('ir.ui.view')
view_id = view_obj.search(cr, uid, [('model', '=', 'crm.phonecall2partner'), \
@@ -127,7 +125,7 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary {}.
"""
- if not context:
+ if context is None:
context = {}
phonecall_obj = self.pool.get('crm.phonecall')
@@ -178,8 +176,6 @@ class crm_phonecall2partner(osv.osv_memory):
@return : Dictionary value for created Partner form.
"""
- if not context:
- context = {}
partner_ids = self._create_partner(cr, uid, ids, context=context)
mod_obj = self.pool.get('ir.model.data')
diff --git a/addons/crm/wizard/crm_send_email.py b/addons/crm/wizard/crm_send_email.py
index 95bc978be73..eeb635b7c3b 100644
--- a/addons/crm/wizard/crm_send_email.py
+++ b/addons/crm/wizard/crm_send_email.py
@@ -65,7 +65,7 @@ class crm_send_new_email(osv.osv_memory):
"""
hist_obj = self.pool.get('mailgate.message')
- if not context:
+ if context is None:
context = {}
if not context.get('active_model'):
@@ -162,7 +162,7 @@ class crm_send_new_email(osv.osv_memory):
"""
This function gets default values
"""
- if not context:
+ if context is None:
context = {}
if not context.get('active_model'):
@@ -263,7 +263,7 @@ class crm_send_new_email(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
if not context.get('active_model'):
diff --git a/addons/crm/wizard/wizard_history_event.py b/addons/crm/wizard/wizard_history_event.py
index 5e1ea1e3ba0..b71ee0d6cd0 100644
--- a/addons/crm/wizard/wizard_history_event.py
+++ b/addons/crm/wizard/wizard_history_event.py
@@ -25,8 +25,6 @@ import pooler
import time
def _open_history_event(self, cr, uid, data, context=None):
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
data_obj = pool.get('ir.model.data')
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_filter')
diff --git a/addons/crm_caldav/crm_caldav.py b/addons/crm_caldav/crm_caldav.py
index c2ed193dc23..8ba59909143 100644
--- a/addons/crm_caldav/crm_caldav.py
+++ b/addons/crm_caldav/crm_caldav.py
@@ -36,8 +36,7 @@ class crm_meeting(osv.osv):
@param ids: List of CRM Meeting’s IDs
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
+ if context is None: context = {}
ids = map(lambda x: base_calendar.base_calendar_id2real_id(x), ids)
event_data = self.read(cr, uid, ids, context=context)
event_obj = self.pool.get('basic.calendar.event')
@@ -54,8 +53,6 @@ class crm_meeting(osv.osv):
@param data_id: calendar's Id
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
event_obj = self.pool.get('basic.calendar.event')
vals = event_obj.import_cal(cr, uid, data, context=context)
return self.check_import(cr, uid, vals, context=context)
@@ -68,7 +65,7 @@ class crm_meeting(osv.osv):
@param vals: Get Values
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
ids = []
model_obj = self.pool.get(context.get('model'))
diff --git a/addons/crm_partner_assign/partner_geo_assign.py b/addons/crm_partner_assign/partner_geo_assign.py
index 83cbc9717eb..bc3a9795834 100644
--- a/addons/crm_partner_assign/partner_geo_assign.py
+++ b/addons/crm_partner_assign/partner_geo_assign.py
@@ -71,8 +71,6 @@ class res_partner(osv.osv):
'partner_weight': lambda *args: 0
}
def geo_localize(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for partner in self.browse(cr, uid, ids, context=context):
if not partner.address:
continue
@@ -111,8 +109,6 @@ class crm_lead(osv.osv):
def assign_partner(self, cr, uid, ids, context=None):
ok = False
- if not context:
- context = {}
for part in self.browse(cr, uid, ids, context=context):
if not part.country_id:
continue
diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
index 1ee6b355b6a..fdb7acff35c 100644
--- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
+++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py
@@ -169,7 +169,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"""
Forward the lead to a partner
"""
- if not context:
+ if context is None:
context = {}
this = self.browse(cr, uid, ids[0], context=context)
case_pool = self.pool.get(context.get('active_model'))
@@ -202,8 +202,6 @@ class crm_lead_forward_to_partner(osv.osv_memory):
def get_lead_details(self, cr, uid, lead_id, context=None):
body = []
- if not context:
- context = {}
lead_proxy = self.pool.get('crm.lead')
lead = lead_proxy.browse(cr, uid, lead_id, context=context)
if not lead.type or lead.type == 'lead' or not lead.partner_address_id:
diff --git a/addons/crm_profiling/crm_profiling.py b/addons/crm_profiling/crm_profiling.py
index 6db0e06f9d9..20b9b585e34 100644
--- a/addons/crm_profiling/crm_profiling.py
+++ b/addons/crm_profiling/crm_profiling.py
@@ -167,8 +167,6 @@ class questionnaire(osv.osv):
@param data: Get Data
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
query = """
select name, id
from crm_profiling_question
@@ -221,8 +219,6 @@ class partner(osv.osv):
@param context: A standard dictionary for contextual values """
temp = []
- if not context:
- context = {}
for x in data['form']:
if x.startswith("quest_form") and data['form'][x] != 0 :
temp.append(data['form'][x])
@@ -244,8 +240,6 @@ class partner(osv.osv):
@param ids: List of crm profiling’s IDs
@param context: A standard dictionary for contextual values """
- if not context:
- context={}
if 'answers_ids' in vals:
vals['category_id']=[[6, 0, _recompute_categ(self, cr, uid, ids[0], vals['answers_ids'][0][2])]]
return super(partner, self).write(cr, uid, ids, vals, context=context)
diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py
index f0d907461c3..aae6f566b69 100644
--- a/addons/delivery/delivery.py
+++ b/addons/delivery/delivery.py
@@ -30,7 +30,7 @@ class delivery_carrier(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
- if not context:
+ if context is None:
context = {}
order_id = context.get('order_id',False)
if not order_id:
@@ -42,7 +42,7 @@ class delivery_carrier(osv.osv):
return res
def get_price(self, cr, uid, ids, field_name, arg=None, context=None):
res={}
- if not context:
+ if context is None:
context = {}
sale_obj=self.pool.get('sale.order')
grid_obj=self.pool.get('delivery.grid')
@@ -70,8 +70,6 @@ class delivery_carrier(osv.osv):
'active': lambda *args:1
}
def grid_get(self, cr, uid, ids, contact_id, context=None):
- if not context:
- context = {}
contact = self.pool.get('res.partner.address').browse(cr, uid, [contact_id], context=context)[0]
for carrier in self.browse(cr, uid, ids, context=context):
for grid in carrier.grids_id:
@@ -114,8 +112,6 @@ class delivery_grid(osv.osv):
total = 0
weight = 0
volume = 0
- if not context:
- context = {}
for line in order.order_line:
if not line.product_id:
continue
diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py
index 9fe51b04256..5614248a001 100644
--- a/addons/delivery/stock.py
+++ b/addons/delivery/stock.py
@@ -30,8 +30,6 @@ class stock_picking(osv.osv):
def _cal_weight(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context:
- context = {}
uom_obj = self.pool.get('product.uom')
for picking in self.browse(cr, uid, ids, context=context):
total_weight = total_weight_net = 0.00
@@ -78,9 +76,6 @@ class stock_picking(osv.osv):
grid_obj = self.pool.get('delivery.grid')
invoice_line_obj = self.pool.get('account.invoice.line')
- if not context:
- context = {}
-
result = super(stock_picking, self).action_invoice_create(cursor, user,
ids, journal_id=journal_id, group=group, type=type,
context=context)
@@ -142,8 +137,6 @@ class stock_move(osv.osv):
def _cal_move_weight(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context:
- context = {}
uom_obj = self.pool.get('product.uom')
for move in self.browse(cr, uid, ids, context=context):
weight = weight_net = 0.00
diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py
index 3a2f52337d6..f20426bbc35 100644
--- a/addons/delivery/wizard/delivery_sale_order.py
+++ b/addons/delivery/wizard/delivery_sale_order.py
@@ -47,8 +47,6 @@ class make_delivery(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
- if not context:
- context = {}
res = super(make_delivery, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', []), context=context):
@@ -60,7 +58,7 @@ class make_delivery(osv.osv_memory):
return res
def view_init(self, cr , uid , fields, context=None):
- if not context:
+ if context is None:
context = {}
order_obj = self.pool.get('sale.order')
for order in order_obj.browse(cr, uid, context.get('active_ids', []), context=context):
@@ -81,7 +79,7 @@ class make_delivery(osv.osv_memory):
@return:
"""
- if not context:
+ if context is None:
context = {}
rec_ids = context and context.get('active_ids',[])
order_obj = self.pool.get('sale.order')
diff --git a/addons/document/directory_content.py b/addons/document/directory_content.py
index 8c0c9e0e88b..cd0c44584a7 100644
--- a/addons/document/directory_content.py
+++ b/addons/document/directory_content.py
@@ -110,7 +110,7 @@ class document_directory_content(osv.osv):
return True
def process_read(self, cr, uid, node, context=None):
- if not context:
+ if context is None:
context = {}
if node.extension != '.pdf':
raise Exception("Invalid content: %s" % node.extension)
diff --git a/addons/document/directory_report.py b/addons/document/directory_report.py
index 97d70e1a3cb..6eb18dae850 100644
--- a/addons/document/directory_report.py
+++ b/addons/document/directory_report.py
@@ -28,8 +28,6 @@ class ir_action_report_xml(osv.osv):
def _model_get(self, cr, uid, ids, name, arg, context=None):
res = {}
- if not context:
- context = {}
model_pool = self.pool.get('ir.model')
for data in self.read(cr, uid, ids, ['model']):
model = data.get('model',False)
diff --git a/addons/document/document.py b/addons/document/document.py
index 0ccd0ec51ec..7e575f38a37 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -39,7 +39,7 @@ class document_file(osv.osv):
return os.path.join(DMS_ROOT_PATH, cr.dbname)
def _data_get(self, cr, uid, ids, name, arg, context=None):
- if not context:
+ if context is None:
context = {}
fbrl = self.browse(cr, uid, ids, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
@@ -64,8 +64,6 @@ class document_file(osv.osv):
def _data_set(self, cr, uid, id, name, value, arg, context=None):
if not value:
return True
- if not context:
- context = {}
fbro = self.browse(cr, uid, id, context=context)
nctx = nodes.get_node_context(cr, uid, context={})
fnode = nodes.node_file(None, None, nctx, fbro)
@@ -140,8 +138,6 @@ class document_file(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
if 'name' not in default:
name = self.read(cr, uid, [id])[0]['name']
default.update({'name': name + " (copy)"})
@@ -233,8 +229,6 @@ class document_file(osv.osv):
It is a hack that will try to discover if the mentioned record is
clearly associated with a partner record.
"""
- if not context:
- context = {}
obj_model = self.pool.get(res_model)
if obj_model._name == 'res.partner':
return res_id
@@ -249,8 +243,6 @@ class document_file(osv.osv):
def unlink(self, cr, uid, ids, context=None):
stor = self.pool.get('document.storage')
unres = []
- if not context:
- context = {}
# We have to do the unlink in 2 stages: prepare a list of actual
# files to be unlinked, update the db (safer to do first, can be
# rolled back) and then unlink the files. The list wouldn't exist
diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py
index a8a54955b74..1f7d1e15807 100644
--- a/addons/document/document_directory.py
+++ b/addons/document/document_directory.py
@@ -175,8 +175,6 @@ class document_directory(osv.osv):
""" Return a node object for the given uri.
This fn merely passes the call to node_context
"""
- if not context:
- context = {}
return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
@@ -186,8 +184,6 @@ class document_directory(osv.osv):
This function can be overriden by inherited classes ;)
@param dbro The browse object, if caller already has it
"""
- if not context:
- context = {}
if dbro is None:
dbro = self.browse(cr, uid, ids, context=context)
@@ -237,8 +233,6 @@ class document_directory(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default ={}
- if not context:
- context = {}
name = self.read(cr, uid, [id])[0]['name']
default.update({'name': name+ " (copy)"})
return super(document_directory,self).copy(cr, uid, id, default, context=context)
diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py
index eaa4244f10f..b61b7fd65fc 100644
--- a/addons/document/document_storage.py
+++ b/addons/document/document_storage.py
@@ -422,9 +422,7 @@ class document_storage(osv.osv):
optionally, fil_obj could point to the browse object of the file
(ir.attachment)
"""
- if not context:
- context = {}
- boo = self.browse(cr, uid, id, context)
+ boo = self.browse(cr, uid, id, context=context)
if not boo.online:
raise IOError(errno.EREMOTE, 'medium offline')
@@ -540,8 +538,6 @@ class document_storage(osv.osv):
This function MUST be used from an ir.attachment. It wouldn't make sense
to store things persistently for other types (dynamic).
"""
- if not context:
- context = {}
boo = self.browse(cr, uid, id, context=context)
if fil_obj:
ira = fil_obj
@@ -688,8 +684,6 @@ class document_storage(osv.osv):
@return the dict of values that can safely be be stored in the db.
"""
- if not context:
- context = {}
sbro = self.browse(cr, uid, file_node.storage_id, context=context)
assert sbro, "The file #%d didn't provide storage" % file_node.file_id
@@ -732,8 +726,6 @@ class document_storage(osv.osv):
file should move to.
@return the dict of values that can safely be be stored in the db.
"""
- if not context:
- context = {}
sbro = self.browse(cr, uid, file_node.storage_id, context=context)
assert sbro, "The file #%d didn't provide storage" % file_node.file_id
diff --git a/addons/document/wizard/document_configuration.py b/addons/document/wizard/document_configuration.py
index bc25e6bdc44..26ce8652599 100644
--- a/addons/document/wizard/document_configuration.py
+++ b/addons/document/wizard/document_configuration.py
@@ -33,8 +33,6 @@ class document_configuration(osv.osv_memory):
def execute(self, cr, uid, ids, context=None):
- if not context:
- context = {}
conf_id = ids and ids[0] or False
conf = self.browse(cr, uid, conf_id, context=context)
dir_pool = self.pool.get('document.directory')
diff --git a/addons/document_ftp/wizard/ftp_browse.py b/addons/document_ftp/wizard/ftp_browse.py
index b1a8bc01b73..3e5787819b2 100644
--- a/addons/document_ftp/wizard/ftp_browse.py
+++ b/addons/document_ftp/wizard/ftp_browse.py
@@ -33,8 +33,6 @@ class document_ftp_browse(osv.osv_memory):
def default_get(self, cr, uid, fields, context=None):
res = {}
- if not context:
- context = {}
if 'url' in fields:
user_pool = self.pool.get('res.users')
current_user = user_pool.browse(cr, uid, uid, context=context)
@@ -52,8 +50,6 @@ class document_ftp_browse(osv.osv_memory):
def browse_ftp(self, cr, uid, ids, context=None):
data_id = ids and ids[0] or False
- if not context:
- context = {}
data = self.browse(cr, uid, data_id, context=context)
final_url = data.url
return {
diff --git a/addons/document_ftp/wizard/ftp_configuration.py b/addons/document_ftp/wizard/ftp_configuration.py
index 43442a0ed45..17dc99d202e 100644
--- a/addons/document_ftp/wizard/ftp_configuration.py
+++ b/addons/document_ftp/wizard/ftp_configuration.py
@@ -39,8 +39,6 @@ class document_ftp_configuration(osv.osv_memory):
}
def execute(self, cr, uid, ids, context=None):
- if not context:
- context = {}
conf = self.browse(cr, uid, ids[0], context=context)
data_pool = self.pool.get('ir.model.data')
# Update the action for FTP browse.
diff --git a/addons/document_ics/document_ics.py b/addons/document_ics/document_ics.py
index 9133a525afa..82a672c2006 100644
--- a/addons/document_ics/document_ics.py
+++ b/addons/document_ics/document_ics.py
@@ -347,7 +347,7 @@ class crm_meeting(osv.osv):
"""
if not default: default = {}
- if not context: context = {}
+ if context is None: context = {}
default.update({'code': self.pool.get('ir.sequence').get(cr, uid, 'crm.meeting'), 'id': False})
return super(crm_meeting, self).copy(cr, uid, id, default, context)
diff --git a/addons/document_webdav/document_webdav.py b/addons/document_webdav/document_webdav.py
index b06032089aa..d2107e4f927 100644
--- a/addons/document_webdav/document_webdav.py
+++ b/addons/document_webdav/document_webdav.py
@@ -46,8 +46,6 @@ class document_davdir(osv.osv):
raise ValueError("dir node for %s type", dbro.type)
def _prepare_context(self, cr, uid, nctx, context=None):
- if not context:
- context = {}
nctx.node_file_class = nodes.node_file
# We can fill some more fields, but avoid any expensive function
# that might be not worth preparing.
diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py
index b5e38532691..836fe5b77e4 100644
--- a/addons/email_template/email_template.py
+++ b/addons/email_template/email_template.py
@@ -72,8 +72,6 @@ def get_value(cursor, user, recid, message=None, template=None, context=None):
@return: Computed message (unicode) or u""
"""
pool = pooler.get_pool(cursor.dbname)
- if not context:
- context = {}
if message is None:
message = {}
#Returns the computed expression
@@ -274,7 +272,7 @@ This is useful for CRM leads for example"),
def create_action(self, cr, uid, ids, context=None):
vals = {}
- if not context:
+ if context is None:
context = {}
template_obj = self.browse(cr, uid, ids, context=context)[0]
src_obj = template_obj.object_name.model
@@ -304,8 +302,6 @@ This is useful for CRM leads for example"),
return True
def unlink_action(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for template in self.browse(cr, uid, ids, context=context):
try:
if template.ref_ir_act_window:
diff --git a/addons/email_template/email_template_account.py b/addons/email_template/email_template_account.py
index 6acf88d5e95..40ea0fd53c1 100644
--- a/addons/email_template/email_template_account.py
+++ b/addons/email_template/email_template_account.py
@@ -209,8 +209,6 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
@return: SMTP server object or Exception
"""
- if not context:
- context = {}
#Type cast ids to integer
if type(ids) == list:
ids = ids[0]
@@ -268,8 +266,6 @@ unless it is already specified in the From Email, e.g: John Doe <john@doe.com>",
This method should now wrap smtp_connection
"""
#This function returns a SMTP server object
- if not context:
- context = {}
logger = netsvc.Logger()
core_obj = self.browse(cursor, user, id, context=context)
if core_obj.smtpserver and core_obj.smtpport and core_obj.state == 'approved':
diff --git a/addons/email_template/email_template_mailbox.py b/addons/email_template/email_template_mailbox.py
index 51d73ffc76c..738c9034366 100644
--- a/addons/email_template/email_template_mailbox.py
+++ b/addons/email_template/email_template_mailbox.py
@@ -196,8 +196,6 @@ class email_template_mailbox(osv.osv):
It just changes the folder of the item to "Trash", if it is no in Trash folder yet,
or completely deletes it if it is already in Trash.
"""
- if not context:
- context = {}
to_update = []
to_remove = []
for mail in self.browse(cr, uid, ids, context=context):
diff --git a/addons/event/event.py b/addons/event/event.py
index 25aa7425c10..84712d44c11 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -101,11 +101,11 @@ class event_event(osv.osv):
@param context: A standard dictionary for contextual values
@return: True
"""
- if not context:
- context = {}
res = False
if type(ids) in (int, long,):
ids = [ids]
+ if context is None:
+ context = {}
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
for event in self.browse(cr, uid, ids, context=context):
@@ -141,8 +141,6 @@ class event_event(osv.osv):
"""
register_pool = self.pool.get('event.registration')
res = {}
- if not context:
- context = {}
for event in self.browse(cr, uid, ids, context=context):
res[event.id] = {}
for field in fields:
@@ -394,7 +392,7 @@ class event_registration(osv.osv):
inv_pool = self.pool.get('account.invoice')
product_pool = self.pool.get('product.product')
contact_pool = self.pool.get('res.partner.contact')
- if not context:
+ if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
# last day of the last month as invoice date
@@ -450,7 +448,7 @@ class event_registration(osv.osv):
def do_close(self, cr, uid, ids, context=None):
""" Close Registration
"""
- if not context:
+ if context is None:
context = {}
invoice_id = context.get('invoice_id', False)
values = {'state': 'done', 'date_closed': time.strftime('%Y-%m-%d %H:%M:%S')}
@@ -467,12 +465,12 @@ class event_registration(osv.osv):
@param context: A standard dictionary for contextual values
@return: True
"""
- if not context:
- context = {}
if type(ids) in (int, long,):
ids = [ids]
data_pool = self.pool.get('ir.model.data')
unconfirmed_ids = []
+ if context is None:
+ context = {}
for registration in self.browse(cr, uid, ids, context=context):
total_confirmed = registration.event_id.register_current + registration.nb_register
if total_confirmed <= registration.event_id.register_max or registration.event_id.register_max == 0:
@@ -500,10 +498,10 @@ class event_registration(osv.osv):
def button_reg_close(self, cr, uid, ids, context=None):
"""This Function Close Event Registration.
"""
- if not context:
- context = {}
data_pool = self.pool.get('ir.model.data')
unclosed_ids = []
+ if context is None:
+ context = {}
for registration in self.browse(cr, uid, ids, context=context):
if registration.tobe_invoiced and not registration.invoice_id:
unclosed_ids.append(registration.id)
@@ -538,8 +536,6 @@ class event_registration(osv.osv):
"""
Send email to user
"""
- if not context:
- context = {}
for regestration in self.browse(cr, uid, ids, context=context):
src = regestration.event_id.reply_to or False
diff --git a/addons/event/wizard/partner_event_registration.py b/addons/event/wizard/partner_event_registration.py
index d8639b4e646..b8521e404e2 100644
--- a/addons/event/wizard/partner_event_registration.py
+++ b/addons/event/wizard/partner_event_registration.py
@@ -105,8 +105,6 @@ class partner_event_registration(osv.osv_memory):
"""Overrides orm name_get method
@param ids: List of partner_event_register ids
"""
- if not context:
- context = {}
res = []
if not ids:
@@ -124,7 +122,7 @@ class partner_event_registration(osv.osv_memory):
event_obj = self.pool.get('event.event')
product_obj = self.pool.get('product.product')
partner_obj = self.pool.get('res.partner')
- if not context:
+ if context is None:
context = {}
partner_id = context.get('active_id', False)
if event_id:
diff --git a/addons/event_project/event_project.py b/addons/event_project/event_project.py
index b892835bb49..8590b84c4ad 100644
--- a/addons/event_project/event_project.py
+++ b/addons/event_project/event_project.py
@@ -24,8 +24,6 @@ from osv import fields, osv
class one2many_mod_task(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if not context:
- context = {}
if not values:
values = {}
res = {}
diff --git a/addons/event_project/wizard/event_project_retro.py b/addons/event_project/wizard/event_project_retro.py
index 799d952acf4..ada9b7fa17b 100644
--- a/addons/event_project/wizard/event_project_retro.py
+++ b/addons/event_project/wizard/event_project_retro.py
@@ -65,8 +65,6 @@ class event_project(osv.osv_memory):
}
def create_duplicate(self, cr, uid, ids, context=None):
- if not context:
- context = {}
event_obj = self.pool.get('event.event')
project_obj = self.pool.get('project.project')
event = event_obj.browse(cr, uid, context.get('active_id', False), context=context)
diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py
index 295f8813047..05363819e15 100644
--- a/addons/fetchmail/fetchmail.py
+++ b/addons/fetchmail/fetchmail.py
@@ -100,7 +100,7 @@ class email_server(osv.osv):
return True
def button_confirm_login(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
for server in self.browse(cr, uid, ids, context=context):
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
@@ -147,7 +147,7 @@ class email_server(osv.osv):
return self.fetch_mail(cr, uid, ids, context=context)
def fetch_mail(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
email_tool = self.pool.get('email.server.tools')
action_pool = self.pool.get('ir.actions.server')
@@ -209,7 +209,7 @@ class mailgate_message(osv.osv):
_order = 'id desc'
def create(self, cr, uid, values, context=None):
- if not context:
+ if context is None:
context={}
server_id = context.get('server_id',False)
server_type = context.get('server_type',False)
@@ -221,7 +221,7 @@ class mailgate_message(osv.osv):
return res
def write(self, cr, uid, ids, values, context=None):
- if not context:
+ if context is None:
context={}
server_id = context.get('server_id',False)
server_type = context.get('server_type',False)
diff --git a/addons/google_map/wizard/google_map_launch.py b/addons/google_map/wizard/google_map_launch.py
index 6ae9c19d2ce..a2b3003da7c 100644
--- a/addons/google_map/wizard/google_map_launch.py
+++ b/addons/google_map/wizard/google_map_launch.py
@@ -26,8 +26,6 @@ from osv import fields
import time
def _launch_wizard(self, cr, uid, data, context=None):
- if not context:
- context = {}
address_obj= pooler.get_pool(cr.dbname).get('res.partner.address')
m= address_obj.browse(cr, uid, data['id'], context=context)
url=''
diff --git a/addons/hr/hr.py b/addons/hr/hr.py
index d8dfe2907ad..b1742a0f87c 100644
--- a/addons/hr/hr.py
+++ b/addons/hr/hr.py
@@ -28,8 +28,6 @@ class hr_employee_category(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not ids:
return []
- if not context:
- context = {}
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = []
for record in reads:
@@ -40,8 +38,6 @@ class hr_employee_category(osv.osv):
return res
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
- if not context:
- context = {}
res = self.name_get(cr, uid, ids, context=context)
return dict(res)
@@ -55,8 +51,6 @@ class hr_employee_category(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
- if not context:
- context = {}
level = 100
while len(ids):
cr.execute('select distinct parent_id from hr_employee_category where id IN %s', (tuple(ids), ))
@@ -86,16 +80,12 @@ class hr_job(osv.osv):
def _no_of_employee(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context:
- context = {}
for job in self.browse(cr, uid, ids, context=context):
res[job.id] = len(job.employee_ids or [])
return res
def _no_of_recruitement(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context:
- context = {}
for job in self.browse(cr, uid, ids, context=context):
res[job.id] = job.expected_employees - job.no_of_employee
return res
@@ -175,8 +165,6 @@ class hr_employee(osv.osv):
def onchange_company(self, cr, uid, ids, company, context=None):
address_id = False
- if not context:
- context = {}
if company:
company_id = self.pool.get('res.company').browse(cr, uid, company, context=context)
address = self.pool.get('res.partner').address_get(cr, uid, [company_id.partner_id.id], ['default'])
@@ -185,8 +173,6 @@ class hr_employee(osv.osv):
def onchange_user(self, cr, uid, ids, user_id, context=None):
work_email = False
- if not context:
- context = {}
if user_id:
work_email = self.pool.get('res.users').browse(cr, uid, user_id, context=context).user_email
return {'value': {'work_email' : work_email}}
@@ -203,8 +189,6 @@ class hr_employee(osv.osv):
def _check_recursion(self, cr, uid, ids, context=None):
level = 100
- if not context:
- context = {}
while len(ids):
cr.execute('SELECT DISTINCT parent_id FROM hr_employee WHERE id IN %s AND parent_id!=id',(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
@@ -214,8 +198,6 @@ class hr_employee(osv.osv):
return True
def _check_department_id(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for emp in self.browse(cr, uid, ids, context=context):
if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id:
return False
diff --git a/addons/hr_contract/hr_contract.py b/addons/hr_contract/hr_contract.py
index 51d83cd33cd..3ad44ef3065 100644
--- a/addons/hr_contract/hr_contract.py
+++ b/addons/hr_contract/hr_contract.py
@@ -29,8 +29,6 @@ class hr_employee(osv.osv):
def _get_latest_contract(self, cr, uid, ids, field_name, args, context=None):
res = {}
- if not context:
- context = {}
obj_contract = self.pool.get('hr.contract')
for emp in self.browse(cr, uid, ids, context=context):
contract_ids = obj_contract.search(cr, uid, [('employee_id','=',emp.id),], order='date_start', context=context)
diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py
index 2d4a8948265..4e635f5f594 100644
--- a/addons/hr_evaluation/hr_evaluation.py
+++ b/addons/hr_evaluation/hr_evaluation.py
@@ -371,7 +371,7 @@ class hr_evaluation_interview(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary value for print survey form.
"""
- if not context:
+ if context is None:
context = {}
record = self.browse(cr, uid, ids, context=context)
record = record and record[0]
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index aa98d1d0c98..638d6eb19fb 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -100,8 +100,6 @@ class hr_expense_expense(osv.osv):
def onchange_employee_id(self, cr, uid, ids, employee_id, context=None):
department_id = False
- if not context:
- context = {}
if employee_id:
department_id = self.pool.get('hr.employee').browse(cr, uid, employee_id, context=context).department_id.id or False
return {'value':{'department_id':department_id}}
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index e6e750acfa8..69b2b0f33aa 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -133,7 +133,7 @@ class hr_contract(osv.osv):
def compute_basic(self, cr, uid, ids, context=None):
res = {}
- if not context:
+ if context is None:
context = {}
ids += context.get('employee_structure', [])
@@ -248,8 +248,6 @@ class hr_contract(osv.osv):
return False
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
- if not context:
- context = {}
res = self.compute_basic(cr, uid, ids, context=context)
vals = {}
for rs in self.browse(cr, uid, ids, context=context):
@@ -346,8 +344,6 @@ class payroll_register(osv.osv):
deduction = 0.0
net = 0.0
grows = 0.0
- if not context:
- context = {}
for register in self.browse(cr, uid, ids, context=context):
for slip in register.line_ids:
allounce += slip.allounce
@@ -614,8 +610,6 @@ class contrib_register(osv.osv):
_description = 'Contribution Register'
def _total_contrib(self, cr, uid, ids, field_names, arg, context=None):
- if not context:
- context = {}
line_pool = self.pool.get('hr.contibution.register.line')
res = {}
@@ -782,8 +776,6 @@ class company_contribution(osv.osv):
return res
def compute(self, cr, uid, id, value, context=None):
- if not context:
- context = {}
contrib = self.browse(cr, uid, id, context=context)
if contrib.amount_type == 'fix':
return contrib.contribute_per
@@ -1001,8 +993,6 @@ class hr_payslip(osv.osv):
return True
def verify_sheet(self, cr, uid, ids, context=None):
- if not context:
- context = {}
register_pool = self.pool.get('company.contribution')
register_line_pool = self.pool.get('hr.contibution.register.line')
@@ -1437,8 +1427,6 @@ class hr_employee(osv.osv):
def _calculate_salary(self, cr, uid, ids, field_names, arg, context=None):
vals = {}
- if not context:
- context = {}
slip_line_pool = self.pool.get('hr.payslip.line')
for employee in self.browse(cr, uid, ids, context=context):
diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py
index 7d147ce4d66..a3b3cd72b9b 100644
--- a/addons/hr_payroll_account/hr_payroll_account.py
+++ b/addons/hr_payroll_account/hr_payroll_account.py
@@ -110,8 +110,6 @@ class payroll_register(osv.osv):
func_pool = self.pool.get('hr.payroll.structure')
slip_line_pool = self.pool.get('hr.payslip.line')
wf_service = netsvc.LocalService("workflow")
- if not context:
- context = {}
vals = self.browse(cr, uid, ids, context=context)[0]
emp_ids = emp_pool.search(cr, uid, [])
diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py
index 900a15806e1..bc38e9444ee 100644
--- a/addons/hr_recruitment/hr_recruitment.py
+++ b/addons/hr_recruitment/hr_recruitment.py
@@ -200,8 +200,6 @@ class hr_applicant(crm.crm_case, osv.osv):
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
stage_obj = self.pool.get('hr.recruitment.stage')
- if not context:
- context = {}
for case in self.browse(cr, uid, ids, context=context):
department = (case.department_id.id or False)
st = case.stage_id.id or False
@@ -219,8 +217,6 @@ class hr_applicant(crm.crm_case, osv.osv):
@param ids: List of case IDs
@param context: A standard dictionary for contextual values"""
stage_obj = self.pool.get('hr.recruitment.stage')
- if not context:
- context = {}
for case in self.browse(cr, uid, ids, context=context):
department = (case.department_id.id or False)
st = case.stage_id.id or False
@@ -291,7 +287,7 @@ class hr_applicant(crm.crm_case, osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary value for print survey form.
"""
- if not context:
+ if context is None:
context = {}
record = self.browse(cr, uid, ids, context=context)
record = record and record[0]
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index e36ed2a5e0b..ddaba6ebdf9 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -349,8 +349,6 @@ class hr_timesheet_sheet(osv.osv):
}
def _sheet_date(self, cr, uid, ids, forced_user_id=False, context=None):
- if not context:
- context = {}
for sheet in self.browse(cr, uid, ids, context=context):
new_user_id = forced_user_id or sheet.user_id and sheet.user_id.id
if new_user_id:
@@ -364,8 +362,6 @@ class hr_timesheet_sheet(osv.osv):
return True
def _date_current_check(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for sheet in self.browse(cr, uid, ids, context=context):
if sheet.date_current < sheet.date_from or sheet.date_current > sheet.date_to:
return False
diff --git a/addons/idea/idea.py b/addons/idea/idea.py
index 3cabb9ad4cc..deda3ab1350 100644
--- a/addons/idea/idea.py
+++ b/addons/idea/idea.py
@@ -121,8 +121,6 @@ class idea_idea(osv.osv):
@param ids: List of vote read’s IDs """
res = {}
- if not context:
- context = {}
for id in ids:
res[id] = '-1'
vote_obj = self.pool.get('idea.vote')
@@ -248,8 +246,6 @@ class idea_idea(osv.osv):
@return: Returns True on success, False otherwise
"""
- if not context:
- context = {}
state = self.browse(cr, user, ids[0], context=context).state
if vals.get('my_vote', False):
diff --git a/addons/idea/wizard/idea_post_vote.py b/addons/idea/wizard/idea_post_vote.py
index 540796c0d9e..a4f179eedbb 100644
--- a/addons/idea/wizard/idea_post_vote.py
+++ b/addons/idea/wizard/idea_post_vote.py
@@ -48,7 +48,7 @@ class idea_post_vote(osv.osv_memory):
@param fields: List of fields for default value
@param context: A standard dictionary for contextual values
"""
- if not context:
+ if context is None:
context = {}
idea_obj = self.pool.get('idea.idea')
@@ -149,7 +149,7 @@ class idea_select(osv.osv_memory):
@param ids: List of load column,
@return: dictionary of query logs clear message window
"""
- if not context:
+ if context is None:
context = {}
idea_obj = self.browse(cr, uid, ids, context=context)
for idea in idea_obj:
diff --git a/addons/l10n_ch/wizard/create_dta.py b/addons/l10n_ch/wizard/create_dta.py
index 94c623af13d..cf87b88024b 100644
--- a/addons/l10n_ch/wizard/create_dta.py
+++ b/addons/l10n_ch/wizard/create_dta.py
@@ -581,7 +581,7 @@ class create_dta_wizard(osv.osv_memory):
'dta_file':fields.binary('DTA File', readonly=True)
}
def create_dta(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
data = {}
active_ids = context.get('active_ids', [])
diff --git a/addons/lunch/lunch.py b/addons/lunch/lunch.py
index c1f4b539bdb..1499dd4414e 100644
--- a/addons/lunch/lunch.py
+++ b/addons/lunch/lunch.py
@@ -72,8 +72,6 @@ class lunch_cashbox(osv.osv):
@param ids: List of create menu’s IDs
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
cr.execute("SELECT box,sum(amount) from lunch_cashmove where active = 't' group by box")
amount = dict(cr.fetchall())
for i in ids:
@@ -126,8 +124,6 @@ class lunch_order(osv.osv):
@param ids: List of Lunch order’s IDs
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
res = {}
for price in self.browse(cr, uid, ids, context=context):
res[price.id] = price.product.price
@@ -162,8 +158,6 @@ class lunch_order(osv.osv):
@param ids: List of confirm order’s IDs
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
cashmove_ref = self.pool.get('lunch.cashmove')
for order in self.browse(cr, uid, ids, context=context):
if order.state == 'confirmed':
@@ -185,8 +179,6 @@ class lunch_order(osv.osv):
@param ids: List of create menu’s IDs
@param context: A standard dictionary for contextual values """
- if not context:
- context = {}
orders = self.browse(cr, uid, ids, context=context)
for order in orders:
if not order.cashmove:
diff --git a/addons/lunch/wizard/lunch_cashbox_clean.py b/addons/lunch/wizard/lunch_cashbox_clean.py
index f964854d677..9c03173fd0e 100644
--- a/addons/lunch/wizard/lunch_cashbox_clean.py
+++ b/addons/lunch/wizard/lunch_cashbox_clean.py
@@ -36,7 +36,7 @@ class lunch_cashbox_clean(osv.osv_memory):
@return:Dictionary {}.
"""
#TOFIX: use orm methods
- if not context:
+ if context is None:
context = {}
data = context and context.get('active_ids', []) or []
cashmove_ref = self.pool.get('lunch.cashmove')
diff --git a/addons/lunch/wizard/lunch_order_cancel.py b/addons/lunch/wizard/lunch_order_cancel.py
index 9e3185fdca4..a0c8779b323 100644
--- a/addons/lunch/wizard/lunch_order_cancel.py
+++ b/addons/lunch/wizard/lunch_order_cancel.py
@@ -34,7 +34,7 @@ class lunch_order_cancel(osv.osv_memory):
@param uid: the current user’s ID for security checks,
@param ids: List Lunch Order Cancel’s IDs
"""
- if not context:
+ if context is None:
context = {}
data = context and context.get('active_ids', []) or []
return self.pool.get('lunch.order').lunch_order_cancel(cr, uid, data, context)
diff --git a/addons/lunch/wizard/lunch_order_confirm.py b/addons/lunch/wizard/lunch_order_confirm.py
index ed0037fc980..4a9ba66ce9f 100644
--- a/addons/lunch/wizard/lunch_order_confirm.py
+++ b/addons/lunch/wizard/lunch_order_confirm.py
@@ -41,7 +41,7 @@ class lunch_order_confirm(osv.osv_memory):
@param ids: List Lunch Order confirm’s IDs
@return: Dictionary {}.
"""
- if not context:
+ if context is None:
context = {}
data = context and context.get('active_ids', []) or []
order_ref = self.pool.get('lunch.order')
diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py
index cce1f2685f3..a5d48956b1a 100644
--- a/addons/mail_gateway/mail_gateway.py
+++ b/addons/mail_gateway/mail_gateway.py
@@ -76,8 +76,6 @@ class mailgate_thread(osv.osv):
""" Get a list of emails of the people following this thread
"""
res = {}
- if not context:
- context = {}
if isinstance(ids, (str, int, long)):
ids = [long(ids)]
for thread in self.browse(cr, uid, ids, context=context):
@@ -190,8 +188,6 @@ class mailgate_message(osv.osv):
@param context: A standard dictionary
"""
action_data = False
- if not context:
- context = {}
if ids:
message_id = ids[0]
mailgate_data = self.browse(cr, uid, message_id, context=context)
@@ -217,8 +213,6 @@ class mailgate_message(osv.osv):
@param context: A standard dictionary
"""
action_data = False
- if not context:
- context = {}
action_pool = self.pool.get('ir.actions.act_window')
message_pool = self.browse(cr ,uid, ids, context=context)[0]
action_ids = action_pool.search(cr, uid, [('res_model', '=', 'ir.attachment')])
@@ -323,8 +317,6 @@ class mailgate_tool(osv.osv_memory):
"""
if isinstance(res_ids, (int, long)):
res_ids = [res_ids]
- if not context:
- context = {}
msg_pool = self.pool.get('mailgate.message')
for res_id in res_ids:
@@ -358,8 +350,6 @@ class mailgate_tool(osv.osv_memory):
@param email_error: Default Email address in case of any Problem
"""
model_pool = self.pool.get(model)
- if not context:
- context = {}
for res in model_pool.browse(cr, uid, res_ids, context=context):
message_followers = model_pool.message_followers(cr, uid, [res.id])[res.id]
@@ -400,7 +390,7 @@ class mailgate_tool(osv.osv_memory):
if isinstance(message, xmlrpclib.Binary):
message = str(message.data)
- if not context:
+ if context is None:
context = {}
if custom_values is None or not isinstance(custom_values, dict):
diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py
index 7144f401034..bd2a63e06ec 100644
--- a/addons/marketing_campaign/marketing_campaign.py
+++ b/addons/marketing_campaign/marketing_campaign.py
@@ -167,8 +167,6 @@ Normal - the campaign runs normally and automatically sends all emails and repor
def _signal(self, cr, uid, record, signal, run_existing=True, context=None):
if not signal:
raise ValueError('signal cannot be False')
- if not context:
- context = {}
Workitems = self.pool.get('marketing.campaign.workitem')
domain = [('object_id.model', '=', record._table._name),
@@ -249,8 +247,6 @@ class marketing_campaign_segment(osv.osv):
}
def _check_model(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for obj in self.browse(cr, uid, ids, context=context):
if not obj.ir_filter_id:
return True
@@ -302,8 +298,6 @@ class marketing_campaign_segment(osv.osv):
return True
def process_segment(self, cr, uid, segment_ids=None, context=None):
- if not context:
- context = {}
Workitems = self.pool.get('marketing.campaign.workitem')
if not segment_ids:
segment_ids = self.search(cr, uid, [('state', '=', 'running')], context=context)
@@ -466,8 +460,6 @@ class marketing_campaign_activity(osv.osv):
return res == False and True or res
def process(self, cr, uid, act_id, wi_id, context=None):
- if not context:
- context = {}
activity = self.browse(cr, uid, act_id, context=context)
method = '_process_wi_%s' % (activity.type,)
action = getattr(self, method, None)
@@ -504,8 +496,6 @@ class marketing_campaign_transition(osv.osv):
def _delta(self, cr, uid, ids, context=None):
assert len(ids) == 1
- if not context:
- context = {}
transition = self.browse(cr, uid, ids[0], context=context)
if transition.trigger != 'time':
raise ValueError('Delta is only relevant for timed transiton')
@@ -539,8 +529,6 @@ class marketing_campaign_transition(osv.osv):
'trigger': 'time',
}
def _check_campaign(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for obj in self.browse(cr, uid, ids, context=context):
if obj.activity_from_id.campaign_id != obj.activity_to_id.campaign_id:
return False
@@ -562,8 +550,6 @@ class marketing_campaign_workitem(osv.osv):
def _res_name_get(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, '/')
- if not context:
- context = {}
for wi in self.browse(cr, uid, ids, context=context):
if not wi.res_id:
continue
@@ -625,16 +611,12 @@ class marketing_campaign_workitem(osv.osv):
}
def button_draft(self, cr, uid, workitem_ids, context=None):
- if not context:
- context = {}
for wi in self.browse(cr, uid, workitem_ids, context=context):
if wi.state in ('exception', 'cancelled'):
self.write(cr, uid, [wi.id], {'state':'todo'}, context=context)
return True
def button_cancel(self, cr, uid, workitem_ids, context=None):
- if not context:
- context = {}
for wi in self.browse(cr, uid, workitem_ids, context=context):
if wi.state in ('todo','exception'):
self.write(cr, uid, [wi.id], {'state':'cancelled'}, context=context)
@@ -644,8 +626,6 @@ class marketing_campaign_workitem(osv.osv):
if workitem.state != 'todo':
return
- if not context:
- context = {}
activity = workitem.activity_id
proxy = self.pool.get(workitem.object_id.model)
object_id = proxy.browse(cr, uid, workitem.res_id, context=context)
@@ -756,8 +736,6 @@ class marketing_campaign_workitem(osv.osv):
def preview(self, cr, uid, ids, context=None):
res = {}
- if not context:
- context = {}
wi_obj = self.browse(cr, uid, ids[0], context=context)
if wi_obj.activity_id.type == 'email':
data_obj = self.pool.get('ir.model.data')
diff --git a/addons/membership/membership.py b/addons/membership/membership.py
index e34e7e2849b..5f9a9e6ee66 100644
--- a/addons/membership/membership.py
+++ b/addons/membership/membership.py
@@ -50,8 +50,6 @@ class membership_line(osv.osv):
def _get_partners(self, cr, uid, ids, context=None):
list_membership_line = []
- if not context:
- context = {}
member_line_obj = self.pool.get('membership.membership_line')
for partner in self.pool.get('res.partner').browse(cr, uid, ids, context=context):
if partner.member_lines:
@@ -60,8 +58,6 @@ class membership_line(osv.osv):
def _get_membership_lines(self, cr, uid, ids, context=None):
list_membership_line = []
- if not context:
- context = {}
member_line_obj = self.pool.get('membership.membership_line')
for invoice in self.pool.get('account.invoice').browse(cr, uid, ids, context=context):
if invoice.invoice_line:
@@ -103,8 +99,6 @@ class membership_line(osv.osv):
@param return: Dictionary of state Value
"""
res = {}
- if not context:
- context = {}
inv_obj = self.pool.get('account.invoice')
for line in self.browse(cr, uid, ids, context=context):
cr.execute('''
@@ -185,8 +179,6 @@ class Partner(osv.osv):
def _get_partner_id(self, cr, uid, ids, context=None):
member_line_obj = self.pool.get('membership.membership_line')
res_obj = self.pool.get('res.partner')
- if not context:
- context = {}
data_inv = member_line_obj.browse(cr, uid, ids, context=context)
list_partner = []
for data in data_inv:
@@ -200,8 +192,6 @@ class Partner(osv.osv):
def _get_invoice_partner(self, cr, uid, ids, context=None):
inv_obj = self.pool.get('account.invoice')
res_obj = self.pool.get('res.partner')
- if not context:
- context = {}
data_inv = inv_obj.browse(cr, uid, ids, context=context)
list_partner = []
for data in data_inv:
@@ -226,8 +216,6 @@ class Partner(osv.osv):
for id in ids:
res[id] = 'none'
today = time.strftime('%Y-%m-%d')
- if not context:
- context = {}
for id in ids:
partner_data = self.browse(cr, uid, id, context=context)
if partner_data.membership_cancel and today > partner_data.membership_cancel:
@@ -285,8 +273,6 @@ class Partner(osv.osv):
name = name[0]
res = {}
member_line_obj = self.pool.get('membership.membership_line')
- if not context:
- context = {}
for partner in self.browse(cr, uid, ids, context=context):
if partner.associate_member:
partner_id = partner.associate_member.id
@@ -320,8 +306,6 @@ class Partner(osv.osv):
def _get_partners(self, cr, uid, ids, context=None):
ids2 = ids
- if not context:
- context = {}
while ids2:
ids2 = self.search(cr, uid, [('associate_member', 'in', ids2)], context=context)
ids += ids2
@@ -386,8 +370,6 @@ class Partner(osv.osv):
"""Check Recursive for Associated Members.
"""
level = 100
- if not context:
- context = {}
while len(ids):
cr.execute('SELECT DISTINCT associate_member FROM res_partner WHERE id IN %s', (tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
@@ -419,7 +401,7 @@ class Partner(osv.osv):
invoice_tax_obj = self.pool.get('account.invoice.tax')
product_id = product_id or datas.get('membership_product_id', False)
amount = datas.get('amount', 0.0)
- if not context:
+ if context is None:
context={}
invoice_list = []
if type(ids) in (int, long,):
@@ -478,7 +460,7 @@ class Product(osv.osv):
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
model_obj = self.pool.get('ir.model.data')
- if not context:
+ if context is None:
context = {}
if ('product' in context) and (context['product']=='membership_product'):
@@ -531,7 +513,7 @@ class account_invoice_line(osv.osv):
def write(self, cr, uid, ids, vals, context=None):
"""Overrides orm write method
"""
- if not context:
+ if context is None:
context={}
member_line_obj = self.pool.get('membership.membership_line')
res = super(account_invoice_line, self).write(cr, uid, ids, vals, context=context)
@@ -561,7 +543,7 @@ class account_invoice_line(osv.osv):
def unlink(self, cr, uid, ids, context=None):
"""Remove Membership Line Record for Account Invoice Line
"""
- if not context:
+ if context is None:
context={}
member_line_obj = self.pool.get('membership.membership_line')
for id in ids:
diff --git a/addons/membership/wizard/membership_invoice.py b/addons/membership/wizard/membership_invoice.py
index 670e3470eb2..b97926e564c 100644
--- a/addons/membership/wizard/membership_invoice.py
+++ b/addons/membership/wizard/membership_invoice.py
@@ -42,7 +42,7 @@ class membership_invoice(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
partner_obj = self.pool.get('res.partner')
datas = {}
- if not context:
+ if context is None:
context = {}
data = self.browse(cr, uid, ids, context=context)
if data:
diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 0338d6ff242..88ac6a5e266 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -132,7 +132,7 @@ class mrp_bom(osv.osv):
@return: Dictionary of values
"""
result = {}
- if not context:
+ if context is None:
context = {}
bom_obj = self.pool.get('mrp.bom')
bom_id = context and context.get('active_id', False) or False
@@ -164,8 +164,6 @@ class mrp_bom(osv.osv):
@return: Dictionary of values
"""
res = dict(map(lambda x: (x,''), ids))
- if not context:
- context = {}
for line in self.browse(cr, uid, ids, context=context):
if line.type == 'phantom' and not line.bom_id:
res[line.id] = 'set'
@@ -223,8 +221,6 @@ class mrp_bom(osv.osv):
def _check_recursion(self, cr, uid, ids, context=None):
level = 100
- if not context:
- context = {}
while len(ids):
cr.execute('select distinct bom_id from mrp_bom where id IN %s',(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
@@ -370,8 +366,6 @@ class mrp_production(osv.osv):
@return: Dictionary of values.
"""
result = {}
- if not context:
- context = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = {
'hour_total': 0.0,
@@ -389,8 +383,6 @@ class mrp_production(osv.osv):
@return: Dictionary of values.
"""
result = {}
- if not context:
- context = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned
return result
@@ -402,8 +394,6 @@ class mrp_production(osv.osv):
@return: Dictionary of values.
"""
result = {}
- if not context:
- context = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned[:10]
return result
@@ -460,8 +450,6 @@ class mrp_production(osv.osv):
_order = 'priority desc, date_planned asc';
def _check_qty(self, cr, uid, ids, context=None):
- if not context:
- context = {}
orders = self.browse(cr, uid, ids, context=context)
for order in orders:
if order.product_qty <= 0:
@@ -519,8 +507,6 @@ class mrp_production(osv.osv):
'bom_id': False,
'routing_id': False
}}
- if not context:
- context = {}
bom_obj = self.pool.get('mrp.bom')
product = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
bom_id = bom_obj._bom_find(cr, uid, product.id, product.uom_id and product.uom_id.id, [])
@@ -544,8 +530,6 @@ class mrp_production(osv.osv):
return {'value': {
'routing_id': False
}}
- if not context:
- context = {}
bom_pool = self.pool.get('mrp.bom')
bom_point = bom_pool.browse(cr, uid, bom_id, context=context)
routing_id = bom_point.routing_id.id or False
@@ -657,7 +641,7 @@ class mrp_production(osv.osv):
@param production_mode: specify production mode (consume/consume&produce).
@return: True
"""
- if not context:
+ if context is None:
context = {}
stock_mov_obj = self.pool.get('stock.move')
production = self.browse(cr, uid, production_id, context=context)
diff --git a/addons/mrp/procurement.py b/addons/mrp/procurement.py
index 947169afa7c..b19c2c0e15e 100644
--- a/addons/mrp/procurement.py
+++ b/addons/mrp/procurement.py
@@ -50,8 +50,6 @@ class procurement_order(osv.osv):
return True
def get_phantom_bom_id(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
if procurement.move_id and procurement.move_id.product_id.supply_method=='produce' \
and procurement.move_id.product_id.procure_method=='make_to_order':
@@ -66,8 +64,6 @@ class procurement_order(osv.osv):
""" This is action which call from workflow to assign production order to procurements
@return: True
"""
- if not context:
- context = {}
procurement_obj = self.pool.get('procurement.order')
res = procurement_obj.make_mo(cr, uid, ids, context=context)
res = res.values()
@@ -78,14 +74,12 @@ class procurement_order(osv.osv):
@return: New created Production Orders procurement wise
"""
res = {}
- if not context:
- context = {}
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
procurement_obj = self.pool.get('procurement.order')
- for procurement in procurement_obj.browse(cr, uid, ids):
+ 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)
diff --git a/addons/mrp/product.py b/addons/mrp/product.py
index 29ecb3bec01..bb9bc27625f 100644
--- a/addons/mrp/product.py
+++ b/addons/mrp/product.py
@@ -31,8 +31,6 @@ class product_product(osv.osv):
@param product_id: product id
@return: dictionary which contains information regarding stock input account, stock output account and stock journal
"""
- if not context:
- context = {}
product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
res = super(product_product,self).get_product_accounts(cr, uid, product_id, context=context)
stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False
@@ -62,7 +60,7 @@ class product_product(osv.osv):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
res = super(product_product, self).do_change_standard_price(cr, uid, ids, datas, context=context)
bom_obj = self.pool.get('mrp.bom')
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index f1493dffb25..3e50552cd9e 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -41,8 +41,6 @@ class StockMove(osv.osv):
procurement_obj = self.pool.get('procurement.order')
product_obj = self.pool.get('product.product')
wf_service = netsvc.LocalService("workflow")
- if not context:
- context = {}
if move.product_id.supply_method == 'produce' and move.product_id.procure_method == 'make_to_order':
bis = bom_obj.search(cr, uid, [
('product_id','=',move.product_id.id),
@@ -126,8 +124,6 @@ class StockMove(osv.osv):
@return: Scraped lines
"""
res = []
- if not context:
- context = {}
production_obj = self.pool.get('mrp.production')
wf_service = netsvc.LocalService("workflow")
for move in self.browse(cr, uid, ids, context=context):
@@ -175,8 +171,6 @@ class spilt_in_production_lot(osv.osv_memory):
production_obj = self.pool.get('mrp.production')
move_obj = self.pool.get('stock.move')
res = []
- if not context:
- context = {}
for move in move_obj.browse(cr, uid, move_ids, context=context):
new_moves = super(spilt_in_production_lot, self).split(cr, uid, ids, move_ids, context=context)
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py
index 318da999caa..87b6d00190e 100644
--- a/addons/mrp/wizard/change_production_qty.py
+++ b/addons/mrp/wizard/change_production_qty.py
@@ -39,7 +39,7 @@ class change_production_qty(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
res = super(change_production_qty, self).default_get(cr, uid, fields, context=context)
prod_obj = self.pool.get('mrp.production')
diff --git a/addons/mrp/wizard/mrp_change_standard_price.py b/addons/mrp/wizard/mrp_change_standard_price.py
index a353e433598..4ee92aac16b 100644
--- a/addons/mrp/wizard/mrp_change_standard_price.py
+++ b/addons/mrp/wizard/mrp_change_standard_price.py
@@ -42,7 +42,7 @@ class change_standard_price(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
res = self.browse(cr, uid, ids, context=context)
context.update({'change_parent_price': res[0].change_parent_price})
diff --git a/addons/mrp/wizard/mrp_price.py b/addons/mrp/wizard/mrp_price.py
index b57998f8c70..8e26561adad 100644
--- a/addons/mrp/wizard/mrp_price.py
+++ b/addons/mrp/wizard/mrp_price.py
@@ -39,7 +39,7 @@ class mrp_price(osv.osv_memory):
@param context: A standard dictionary
@return : Report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['number'])
diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py
index a64329cbd0b..b1c06ad403d 100644
--- a/addons/mrp/wizard/mrp_product_produce.py
+++ b/addons/mrp/wizard/mrp_product_produce.py
@@ -42,7 +42,7 @@ class mrp_product_produce(osv.osv_memory):
@param context: A standard dictionary
@return: Quantity
"""
- if not context:
+ if context is None:
context = {}
prod = self.pool.get('mrp.production').browse(cr, uid,
context['active_id'], context=context)
@@ -66,7 +66,7 @@ class mrp_product_produce(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
prod_obj = self.pool.get('mrp.production')
move_ids = context.get('active_ids', [])
diff --git a/addons/mrp/wizard/mrp_track_prod.py b/addons/mrp/wizard/mrp_track_prod.py
index fb8374cf17c..4b883abf98c 100644
--- a/addons/mrp/wizard/mrp_track_prod.py
+++ b/addons/mrp/wizard/mrp_track_prod.py
@@ -54,7 +54,7 @@ class mrp_track_move(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
- if not context:
+ if context is None:
context = {}
res = super(mrp_track_move, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
record_id = context and context.get('active_id', False) or False
@@ -98,7 +98,7 @@ class mrp_track_move(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
record_id = context and context.get('active_id', False) or False
assert record_id, 'Active ID not found'
diff --git a/addons/mrp/wizard/mrp_workcenter_load.py b/addons/mrp/wizard/mrp_workcenter_load.py
index d7cd7f8f35a..fc4c90f8c54 100644
--- a/addons/mrp/wizard/mrp_workcenter_load.py
+++ b/addons/mrp/wizard/mrp_workcenter_load.py
@@ -38,7 +38,7 @@ class mrp_workcenter_load(osv.osv_memory):
@param context: A standard dictionary
@return : Report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids' : context.get('active_ids',[])}
res = self.read(cr, uid, ids, ['time_unit','measure_unit'])
diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py
index 91589ad3bec..df5456baa4a 100644
--- a/addons/mrp_operations/mrp_operations.py
+++ b/addons/mrp_operations/mrp_operations.py
@@ -55,8 +55,6 @@ class mrp_production_workcenter_line(osv.osv):
@return: Dictionary of values.
"""
res={}
- if not context:
- context = {}
for op in self.browse(cr, uid, ids, context=context):
if op.date_start:
res[op.id] = op.date_start[:10]
@@ -68,8 +66,6 @@ class mrp_production_workcenter_line(osv.osv):
""" Finds ending date.
@return: Dictionary of values.
"""
- if not context:
- context = {}
ops = self.browse(cr, uid, ids, context=context)
date_and_hours_by_cal = [(op.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops if op.date_planned]
@@ -147,8 +143,6 @@ class mrp_production_workcenter_line(osv.osv):
return
def write(self, cr, uid, ids, vals, context=None, update=True):
- if not context:
- context = {}
result = super(mrp_production_workcenter_line, self).write(cr, uid, ids, vals, context=context)
prod_obj = self.pool.get('mrp.production')
if vals.get('date_planned', False) and update:
@@ -224,8 +218,6 @@ class mrp_production(osv.osv):
@return: Dictionary of values
"""
result = {}
- if not context:
- context = {}
for prod in self.browse(cr, uid, ids, context=context):
result[prod.id] = prod.date_planned
for line in prod.workcenter_lines:
@@ -267,7 +259,7 @@ class mrp_production(osv.osv):
@return: Calculated date
"""
dt_end = datetime.now()
- if not context:
+ if context is None:
context = {}
for po in self.browse(cr, uid, ids, context=context):
dt_end = datetime.strptime(po.date_planned, '%Y-%m-%d %H:%M:%S')
@@ -308,8 +300,6 @@ class mrp_production(osv.osv):
""" Calculates start date for stock moves finding interval from resource calendar.
@return: True
"""
- if not context:
- context = {}
for po in self.browse(cr, uid, ids, context=context):
if po.allow_reorder:
continue
@@ -338,8 +328,6 @@ class mrp_production(osv.osv):
""" Calculates start date for stock moves.
@return: True
"""
- if not context:
- context = {}
for po in self.browse(cr, uid, ids, context=context):
if po.allow_reorder:
continue
@@ -358,8 +346,6 @@ class mrp_production(osv.osv):
def write(self, cr, uid, ids, vals, context=None, update=True, mini=True):
direction = {}
- if not context:
- context = {}
if vals.get('date_start', False):
for po in self.browse(cr, uid, ids, context=context):
direction[po.id] = cmp(po.date_start, vals.get('date_start', False))
@@ -412,8 +398,6 @@ class mrp_operations_operation(osv.osv):
@return: Dictionary of values
"""
res={}
- if not context:
- context = {}
operation_obj = self.browse(cr, uid, ids, context=context)
for operation in operation_obj:
res[operation.id] = operation.production_id.date_planned
@@ -498,8 +482,6 @@ class mrp_operations_operation(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
oper_objs = self.browse(cr, uid, ids, context=context)[0]
vals['production_id']=oper_objs.production_id.id
vals['workcenter_id']=oper_objs.workcenter_id.id
@@ -517,8 +499,6 @@ class mrp_operations_operation(osv.osv):
return super(mrp_operations_operation, self).write(cr, uid, ids, vals, context=context)
def create(self, cr, uid, vals, context=None):
- if not context:
- context = {}
wf_service = netsvc.LocalService('workflow')
code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])])
code=self.pool.get('mrp_operations.operation.code').browse(cr, uid, code_ids, context=context)[0]
diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py
index 6de8b4f5492..dc51cd42b72 100644
--- a/addons/mrp_repair/mrp_repair.py
+++ b/addons/mrp_repair/mrp_repair.py
@@ -42,8 +42,6 @@ class mrp_repair(osv.osv):
@return: Dictionary of values.
"""
res = {}
- if not context:
- context = {}
cur_obj = self.pool.get('res.currency')
for repair in self.browse(cr, uid, ids, context=context):
@@ -66,8 +64,6 @@ class mrp_repair(osv.osv):
#return {}.fromkeys(ids, 0)
cur_obj = self.pool.get('res.currency')
tax_obj = self.pool.get('account.tax')
- if not context:
- context = {}
for repair in self.browse(cr, uid, ids, context=context):
val = 0.0
cur = repair.pricelist_id.currency_id
@@ -89,8 +85,6 @@ class mrp_repair(osv.osv):
@return: Dictionary of values.
"""
res = {}
- if not context:
- context = {}
untax = self._amount_untaxed(cr, uid, ids, field_name, arg, context=context)
tax = self._amount_tax(cr, uid, ids, field_name, arg, context=context)
cur_obj = self.pool.get('res.currency')
@@ -102,8 +96,6 @@ class mrp_repair(osv.osv):
def _get_default_address(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
partner_obj = self.pool.get('res.partner')
for data in self.browse(cr, uid, ids, context=context):
adr_id = False
@@ -192,8 +184,6 @@ class mrp_repair(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({
'state':'draft',
'repaired':False,
@@ -344,8 +334,6 @@ class mrp_repair(osv.osv):
""" Cancels repair order.
@return: True
"""
- if not context:
- context = {}
mrp_line_obj = self.pool.get('mrp.repair.line')
for repair in self.browse(cr, uid, ids, context=context):
mrp_line_obj.write(cr, uid, [l.id for l in repair.operations], {'state': 'cancel'})
@@ -362,8 +350,6 @@ class mrp_repair(osv.osv):
"""
res = {}
invoices_group = {}
- if not context:
- context = {}
inv_line_obj = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
repair_line_obj = self.pool.get('mrp.repair.line')
@@ -523,8 +509,6 @@ class mrp_repair(osv.osv):
@return: Picking ids.
"""
res = {}
- if not context:
- context = {}
move_obj = self.pool.get('stock.move')
wf_service = netsvc.LocalService("workflow")
repair_line_obj = self.pool.get('mrp.repair.line')
@@ -648,8 +632,6 @@ class mrp_repair_line(osv.osv, ProductChangeMixin):
@return: Dictionary of values.
"""
res = {}
- if not context:
- context = {}
cur_obj=self.pool.get('res.currency')
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
@@ -739,8 +721,6 @@ class mrp_repair_fee(osv.osv, ProductChangeMixin):
@return: Dictionary of values.
"""
res = {}
- if not context:
- context = {}
cur_obj = self.pool.get('res.currency')
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
diff --git a/addons/mrp_repair/wizard/cancel_repair.py b/addons/mrp_repair/wizard/cancel_repair.py
index 7e081919660..e7ef69c2dcc 100644
--- a/addons/mrp_repair/wizard/cancel_repair.py
+++ b/addons/mrp_repair/wizard/cancel_repair.py
@@ -35,7 +35,7 @@ class repair_cancel(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
record_id = context and context.get('active_id', False) or False
assert record_id, _('Active ID is not Found')
@@ -58,7 +58,7 @@ class repair_cancel(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
- if not context:
+ if context is None:
context = {}
res = super(repair_cancel, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
record_id = context and context.get('active_id', False) or False
diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py
index f3c9f6b36ed..2cb6409348e 100644
--- a/addons/mrp_repair/wizard/make_invoice.py
+++ b/addons/mrp_repair/wizard/make_invoice.py
@@ -39,7 +39,7 @@ class make_invoice(osv.osv_memory):
@param context: A standard dictionary
@return: Loads the view of new invoice(s).
"""
- if not context:
+ if context is None:
context = {}
inv = self.browse(cr, uid, ids[0], context=context)
order_obj = self.pool.get('mrp.repair')
diff --git a/addons/mrp_subproduct/mrp_subproduct.py b/addons/mrp_subproduct/mrp_subproduct.py
index c858aae0281..3229cdce33c 100644
--- a/addons/mrp_subproduct/mrp_subproduct.py
+++ b/addons/mrp_subproduct/mrp_subproduct.py
@@ -41,8 +41,6 @@ class mrp_subproduct(osv.osv):
@param product_id: Changed product_id
@return: Dictionary of changed values
"""
- if not context:
- context = {}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v = {'product_uom': prod.uom_id.id}
diff --git a/addons/outlook/installer.py b/addons/outlook/installer.py
index 6b571b7b70a..143567dd7cf 100755
--- a/addons/outlook/installer.py
+++ b/addons/outlook/installer.py
@@ -30,8 +30,6 @@ class outlook_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def default_get(self, cr, uid, fields, context=None):
- if not context:
- context = {}
data = super(outlook_installer, self).default_get(cr, uid, fields, context=context)
data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html'
file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-addin.exe'), 'r')
diff --git a/addons/point_of_sale/account_bank_statement.py b/addons/point_of_sale/account_bank_statement.py
index fa54ab265b2..edcf8573451 100644
--- a/addons/point_of_sale/account_bank_statement.py
+++ b/addons/point_of_sale/account_bank_statement.py
@@ -52,7 +52,7 @@ class account_cash_statement(osv.osv):
return True
def _user_allow(self, cr, uid, statement_id, context=None):
- if not context:
+ if context is None:
context = {}
statement = self.browse(cr, uid, statement_id, context=context)
if (not statement.journal_id.journal_users) and uid == 1: return True
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py
index 939f5dbe0e0..f603244d771 100644
--- a/addons/point_of_sale/point_of_sale.py
+++ b/addons/point_of_sale/point_of_sale.py
@@ -60,8 +60,6 @@ class pos_order(osv.osv):
_order = "date_order, create_date desc"
def unlink(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for rec in self.browse(cr, uid, ids, context=context):
for rec_statement in rec.statement_ids:
if (rec_statement.statement_id and rec_statement.statement_id.state == 'confirm') or rec.state == 'done':
@@ -72,8 +70,6 @@ class pos_order(osv.osv):
""" Changed price list on_change of partner_id"""
if not part:
return {'value': {}}
- if not context:
- context = {}
pricelist = self.pool.get('res.partner').browse(cr, uid, part, context=context).property_product_pricelist.id
return {'value': {'pricelist_id': pricelist}}
@@ -81,8 +77,6 @@ class pos_order(osv.osv):
""" Calculates amount_tax of order line
@param field_names: Names of fields.
@return: Dictionary of values """
- if not context:
- context = {}
cr.execute("""
SELECT
p.id,
@@ -109,8 +103,6 @@ class pos_order(osv.osv):
@return: Dictionary of values """
res = {}
val = None
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
cr.execute("SELECT date_payment FROM pos_order WHERE id = %s", (order.id,))
date_p = cr.fetchone()
@@ -161,8 +153,6 @@ class pos_order(osv.osv):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
res = {}
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
res[order.id] = {
'amount_paid': 0.0,
@@ -203,8 +193,6 @@ class pos_order(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({
'state': 'draft',
'partner_id': False,
@@ -299,8 +287,6 @@ class pos_order(osv.osv):
@param name: Names of fields.
@return: pricelist ID
"""
- if not context:
- context = {}
pricelist = self.pool.get('product.pricelist').search(cr, uid, [('name', '=', 'Public Pricelist')], context=context)
return pricelist and pricelist[0] or False
@@ -349,8 +335,6 @@ class pos_order(osv.osv):
""" Test all amount is paid for this order
@return: True
"""
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
if order.lines and not order.amount_total:
return True
@@ -425,8 +409,6 @@ class pos_order(osv.osv):
property_obj = self.pool.get("ir.property")
move_obj=self.pool.get('stock.move')
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
- if not context:
- context = {}
orders = self.browse(cr, uid, ids, context=context)
for order in orders:
if not order.picking_id:
@@ -516,8 +498,6 @@ class pos_order(osv.osv):
""" Changes order state to cancel
@return: True
"""
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
self.cancel_picking(cr, uid, ids, context=context)
return True
@@ -528,8 +508,6 @@ class pos_order(osv.osv):
statement_line_obj = self.pool.get('account.bank.statement.line')
prod_obj = self.pool.get('product.product')
property_obj = self.pool.get('ir.property')
- if not context:
- context = {}
curr_c = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
curr_company = curr_c.id
order = self.browse(cr, uid, order_id, context=context)
@@ -576,8 +554,6 @@ class pos_order(osv.osv):
def add_product(self, cr, uid, order_id, product_id, qty, context=None):
"""Create a new order line the order"""
- if not context:
- context = {}
line_obj = self.pool.get('pos.order.line')
values = self.read(cr, uid, order_id, ['partner_id', 'pricelist_id'])
@@ -600,8 +576,6 @@ class pos_order(osv.osv):
def refund(self, cr, uid, ids, context=None):
"""Create a copy of order for refund order"""
clone_list = []
- if not context:
- context = {}
line_obj = self.pool.get('pos.order.line')
for order in self.browse(cr, uid, ids, context=context):
@@ -630,8 +604,6 @@ class pos_order(osv.osv):
inv_line_ref = self.pool.get('account.invoice.line')
product_obj = self.pool.get('product.product')
inv_ids = []
- if not context:
- context = {}
for order in self.pool.get('pos.order').browse(cr, uid, ids, context=context):
if order.invoice_id:
@@ -692,8 +664,6 @@ class pos_order(osv.osv):
account_tax_obj = self.pool.get('account.tax')
res_obj=self.pool.get('res.users')
property_obj=self.pool.get('ir.property')
- if not context:
- context = {}
period = account_period_obj.find(cr, uid, context=context)[0]
for order in self.browse(cr, uid, ids, context=context):
@@ -885,8 +855,6 @@ class pos_order(osv.osv):
def cancel_picking(self, cr, uid, ids, context=None):
stock_picking_obj = self.pool.get('stock.picking')
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
for picking in order.pickings:
stock_picking_obj.unlink(cr, uid, [picking.id], context=context)
@@ -896,8 +864,6 @@ class pos_order(osv.osv):
def action_payment(self, cr, uid, ids, context=None):
vals = {'state': 'payment'}
sequence_obj = self.pool.get('ir.sequence')
- if not context:
- context = {}
for pos in self.browse(cr, uid, ids, context=context):
create_contract_nb = False
for line in pos.lines:
@@ -910,7 +876,7 @@ class pos_order(osv.osv):
self.write(cr, uid, ids, vals, context=context)
def action_paid(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
if context.get('flag', False):
self.create_picking(cr, uid, ids, context=None)
@@ -920,14 +886,10 @@ class pos_order(osv.osv):
return True
def action_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
return True
def action_done(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
if not order.journal_entry:
self.create_account_move(cr, uid, ids, context=None)
@@ -975,8 +937,6 @@ class pos_order_line(osv.osv):
def _get_amount(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
for line in self.browse(cr, uid, ids, context=context):
price = self.price_by_product(cr, uid, ids, line.order_id.pricelist_id.id, line.product_id.id, line.qty, line.order_id.partner_id.id)
res[line.id] = price
@@ -984,8 +944,6 @@ class pos_order_line(osv.osv):
def _amount_line_ttc(self, cr, uid, ids, field_name, arg, context=None):
res = dict.fromkeys(ids, 0.0)
- if not context:
- context = {}
account_tax_obj = self.pool.get('account.tax')
self.price_by_product_multi(cr, uid, ids)
for line in self.browse(cr, uid, ids, context=context):
@@ -1005,8 +963,6 @@ class pos_order_line(osv.osv):
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
self.price_by_product_multi(cr, uid, ids)
for line in self.browse(cr, uid, ids, context=context):
if line.discount!=0.0:
@@ -1017,8 +973,6 @@ class pos_order_line(osv.osv):
def _amount_line_all(self, cr, uid, ids, field_names, arg, context=None):
res = dict([(i, {}) for i in ids])
- if not context:
- context = {}
account_tax_obj = self.pool.get('account.tax')
self.price_by_product_multi(cr, uid, ids)
@@ -1155,8 +1109,6 @@ class pos_order_line(osv.osv):
return {'value': {'notice': 'No Discount', 'price_ded': price * discount * 0.01 or 0.0}}
def onchange_qty(self, cr, uid, ids, discount, qty, price, context=None):
- if not context:
- context = {}
subtotal = qty * price
if discount:
subtotal = subtotal - (subtotal * discount / 100)
@@ -1189,15 +1141,11 @@ class pos_order_line(osv.osv):
}
def create(self, cr, user, vals, context=None):
- if not context:
- context = {}
if vals.get('product_id'):
return super(pos_order_line, self).create(cr, user, vals, context=context)
return False
def write(self, cr, user, ids, values, context=None):
- if not context:
- context = {}
if 'product_id' in values and not values['product_id']:
return False
return super(pos_order_line, self).write(cr, user, ids, values, context=context)
diff --git a/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py b/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
index 139eea8301a..330668548e4 100644
--- a/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
+++ b/addons/point_of_sale/wizard/all_closed_cashbox_of_the_day.py
@@ -34,7 +34,7 @@ class all_closed_cashbox_of_the_day(osv.osv_memory):
@param context: A standard dictionary
@return : retrun report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
return {
diff --git a/addons/point_of_sale/wizard/pos_box_entries.py b/addons/point_of_sale/wizard/pos_box_entries.py
index d6441c467f9..dcc9779a903 100644
--- a/addons/point_of_sale/wizard/pos_box_entries.py
+++ b/addons/point_of_sale/wizard/pos_box_entries.py
@@ -61,8 +61,6 @@ class pos_box_entries(osv.osv_memory):
@param context: A standard dictionary
@return :Return of operation of product
"""
- if not context:
- context = {}
product_obj = self.pool.get('product.product')
ids = product_obj.search(cr, uid, [('income_pdt', '=', True)], context=context)
res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
@@ -97,8 +95,6 @@ class pos_box_entries(osv.osv_memory):
res_obj = self.pool.get('res.users')
product_obj = self.pool.get('product.product')
bank_statement = self.pool.get('account.bank.statement.line')
- if not context:
- context = {}
for data in self.read(cr, uid, ids, context=context):
vals = {}
curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
diff --git a/addons/point_of_sale/wizard/pos_box_out.py b/addons/point_of_sale/wizard/pos_box_out.py
index 80e0ae7fe61..a05c5f579e1 100644
--- a/addons/point_of_sale/wizard/pos_box_out.py
+++ b/addons/point_of_sale/wizard/pos_box_out.py
@@ -41,8 +41,6 @@ class pos_box_out(osv.osv_memory):
@return :Return of operation of product
"""
product_obj = self.pool.get('product.product')
- if not context:
- context = {}
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
ids = product_obj.search(cr, uid, ['&', ('expense_pdt', '=', True), '|', ('company_id', '=', company_id), ('company_id', '=', None)], context=context)
res = product_obj.read(cr, uid, ids, ['id', 'name'], context=context)
@@ -77,8 +75,6 @@ class pos_box_out(osv.osv_memory):
product_obj = self.pool.get('product.template')
productp_obj = self.pool.get('product.product')
res_obj = self.pool.get('res.users')
- if not context:
- context = {}
for data in self.read(cr, uid, ids, context=context):
curr_company = res_obj.browse(cr, uid, uid, context=context).company_id.id
statement_id = statement_obj.search(cr, uid, [('journal_id', '=', data['journal_id']), ('company_id', '=', curr_company), ('user_id', '=', uid), ('state', '=', 'open')], context=context)
diff --git a/addons/point_of_sale/wizard/pos_close_statement.py b/addons/point_of_sale/wizard/pos_close_statement.py
index 03f26b7f0d8..222338f6e10 100644
--- a/addons/point_of_sale/wizard/pos_close_statement.py
+++ b/addons/point_of_sale/wizard/pos_close_statement.py
@@ -43,8 +43,6 @@ class pos_close_statement(osv.osv_memory):
j_ids = map(lambda x1: x1[0], cr.fetchall())
journal_ids = journal_obj.search(cr, uid, [('auto_cash', '=', True), ('type', '=', 'cash'), ('id', 'in', j_ids)], context=context)
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', 'in', journal_ids)], context=context)
- if not context:
- context = {}
for journal in journal_obj.browse(cr, uid, journal_ids, context=context):
if not ids:
raise osv.except_osv(_('Message'), _('Cash registers are already closed.'))
diff --git a/addons/point_of_sale/wizard/pos_discount.py b/addons/point_of_sale/wizard/pos_discount.py
index 149f6260ad3..97e94620820 100644
--- a/addons/point_of_sale/wizard/pos_discount.py
+++ b/addons/point_of_sale/wizard/pos_discount.py
@@ -43,7 +43,7 @@ class pos_discount(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
- if not context:
+ if context is None:
context = {}
super(pos_discount, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py
index 0b10f0cab42..71be59c0b6d 100644
--- a/addons/point_of_sale/wizard/pos_open_statement.py
+++ b/addons/point_of_sale/wizard/pos_open_statement.py
@@ -40,7 +40,7 @@ class pos_open_statement(osv.osv_memory):
statement_obj = self.pool.get('account.bank.statement')
sequence_obj = self.pool.get('ir.sequence')
journal_obj = self.pool.get('account.journal')
- if not context:
+ if context is None:
context = {}
company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
cr.execute("SELECT DISTINCT journal_id FROM pos_journal_users "
diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py
index b8043d658ef..fe3dd14db73 100644
--- a/addons/point_of_sale/wizard/pos_payment.py
+++ b/addons/point_of_sale/wizard/pos_payment.py
@@ -81,7 +81,7 @@ class pos_make_payment(osv.osv_memory):
return res
def view_init(self, cr, uid, fields_list, context=None):
- if not context:
+ if context is None:
context = {}
super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
active_id = context and context.get('active_id', False) or False
@@ -142,7 +142,7 @@ class pos_make_payment(osv.osv_memory):
if the order is paid print invoice (if wanted) or ticket.
"""
order_obj = self.pool.get('pos.order')
- if not context:
+ if context is None:
context = {}
active_id = context and context.get('active_id', False)
order = order_obj.browse(cr, uid, active_id, context=context)
@@ -188,7 +188,7 @@ class pos_make_payment(osv.osv_memory):
"""
Create a invoice
"""
- if not context:
+ if context is None:
context = {}
active_ids = [context and context.get('active_id', False)]
datas = {'ids': active_ids}
@@ -207,7 +207,7 @@ class pos_make_payment(osv.osv_memory):
@param context: A standard dictionary
@return : retrun report
"""
- if not context:
+ if context is None:
context = {}
active_id = context.get('active_id', [])
datas = {'ids' : [active_id]}
diff --git a/addons/point_of_sale/wizard/pos_receipt.py b/addons/point_of_sale/wizard/pos_receipt.py
index 19ce8c2c359..71efee85b7c 100644
--- a/addons/point_of_sale/wizard/pos_receipt.py
+++ b/addons/point_of_sale/wizard/pos_receipt.py
@@ -35,8 +35,6 @@ class pos_receipt(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
- if not context:
- context = {}
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'], context=context)
def print_report(self, cr, uid, ids, context=None):
@@ -48,7 +46,7 @@ class pos_receipt(osv.osv_memory):
@param context: A standard dictionary
@return : retrun report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
return {
diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py
index 9d85d3c84fe..810ef86ec7b 100644
--- a/addons/point_of_sale/wizard/pos_return.py
+++ b/addons/point_of_sale/wizard/pos_return.py
@@ -44,9 +44,9 @@ class pos_return(osv.osv_memory):
res = super(pos_return, self).default_get(cr, uid, fields, context=context)
order_obj = self.pool.get('pos.order')
- active_ids = context.get('active_ids')
- if not context:
+ if context is None:
context={}
+ active_ids = context.get('active_ids')
for order in order_obj.browse(cr, uid, active_ids, context=context):
for line in order.lines:
if 'return%s'%(line.id) in fields:
@@ -64,7 +64,7 @@ class pos_return(osv.osv_memory):
"""
res = super(pos_return, self).view_init(cr, uid, fields_list, context=context)
order_obj=self.pool.get('pos.order')
- if not context:
+ if context is None:
context={}
active_ids=context.get('active_ids')
@@ -89,7 +89,7 @@ class pos_return(osv.osv_memory):
"""
result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
- if not context:
+ if context is None:
context={}
active_model = context.get('active_model')
if not active_model and active_model != 'pos.order':
@@ -143,7 +143,7 @@ class pos_return(osv.osv_memory):
@return: Return the add product form again for adding more product
"""
- if not context:
+ if context is None:
context = {}
current_rec = self.read(cr, uid, data[0], context=context)
order_obj =self.pool.get('pos.order')
@@ -174,7 +174,7 @@ class pos_return(osv.osv_memory):
'type': 'ir.actions.act_window',
}
def create_returns2(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
active_id = context.get('active_id', False)
order_obj =self.pool.get('pos.order')
@@ -270,7 +270,7 @@ class add_product(osv.osv_memory):
@param context: A standard dictionary
@return : Retrun the add product form again for adding more product
"""
- if not context:
+ if context is None:
context = {}
active_id=context.get('active_id', False)
@@ -336,6 +336,7 @@ class add_product(osv.osv_memory):
}
def close_action(self, cr, uid, ids, context=None):
+ if context is None: context = {}
active_ids=context.get('active_ids', False)
order_obj = self.pool.get('pos.order')
lines_obj = self.pool.get('pos.order.line')
diff --git a/addons/point_of_sale/wizard/pos_sales_user.py b/addons/point_of_sale/wizard/pos_sales_user.py
index 29837b1cc3a..e17aff8bdca 100644
--- a/addons/point_of_sale/wizard/pos_sales_user.py
+++ b/addons/point_of_sale/wizard/pos_sales_user.py
@@ -42,7 +42,7 @@ class pos_sale_user(osv.osv_memory):
@param context: A standard dictionary
@return : return report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
diff --git a/addons/point_of_sale/wizard/pos_sales_user_current_user.py b/addons/point_of_sale/wizard/pos_sales_user_current_user.py
index 86973d5efe4..100154ac734 100644
--- a/addons/point_of_sale/wizard/pos_sales_user_current_user.py
+++ b/addons/point_of_sale/wizard/pos_sales_user_current_user.py
@@ -39,7 +39,7 @@ class pos_sales_user_today_current_user(osv.osv_memory):
@param context: A standard dictionary
@return : retrun report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
diff --git a/addons/point_of_sale/wizard/pos_sales_user_today.py b/addons/point_of_sale/wizard/pos_sales_user_today.py
index 5645a879e4d..33c9dc8f3fc 100644
--- a/addons/point_of_sale/wizard/pos_sales_user_today.py
+++ b/addons/point_of_sale/wizard/pos_sales_user_today.py
@@ -40,7 +40,7 @@ class pos_sales_user_today(osv.osv_memory):
@param context: A standard dictionary
@return : retrun report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
diff --git a/addons/point_of_sale/wizard/pos_scan_product.py b/addons/point_of_sale/wizard/pos_scan_product.py
index cbf5315c471..49cd32eba4d 100644
--- a/addons/point_of_sale/wizard/pos_scan_product.py
+++ b/addons/point_of_sale/wizard/pos_scan_product.py
@@ -37,7 +37,7 @@ class pos_scan_product(osv.osv_memory):
@param context: A standard dictionary
@return : retrun gencod
"""
- if not context:
+ if context is None:
context = {}
data=self.read(cr, uid, ids)[0]
record_id = context and context.get('active_id',False)
diff --git a/addons/process/process.py b/addons/process/process.py
index 676b75ae47e..e8c524b6857 100644
--- a/addons/process/process.py
+++ b/addons/process/process.py
@@ -53,8 +53,6 @@ class process_process(osv.osv):
}
def search_by_model(self, cr, uid, res_model, context=None):
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
model_ids = (res_model or None) and pool.get('ir.model').search(cr, uid, [('model', '=', res_model)])
@@ -80,8 +78,6 @@ class process_process(osv.osv):
return result
def graph_get(self, cr, uid, id, res_model, res_id, scale, context=None):
- if not context:
- context = {}
pool = pooler.get_pool(cr.dbname)
@@ -256,9 +252,6 @@ class process_process(osv.osv):
if not default:
default = {}
- if not context:
- context = {}
-
pool = pooler.get_pool(cr.dbname)
process = pool.get('process.process').browse(cr, uid, [id], context=context)[0]
@@ -319,8 +312,6 @@ class process_node(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({
'transition_in': [],
'transition_out': []
@@ -379,9 +370,6 @@ class process_transition_action(osv.osv):
if not default:
default = {}
- if not context:
- context = {}
-
state = self.pool.get('process.transition.action').browse(cr, uid, [id], context=context)[0].state
if state:
default['state'] = state
diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py
index 939dd46496c..2c451dcf9bf 100644
--- a/addons/procurement/procurement.py
+++ b/addons/procurement/procurement.py
@@ -69,8 +69,6 @@ class StockMove(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
default = default or {}
- if not context:
- context = {}
default['procurements'] = []
return super(StockMove, self).copy(cr, uid, id, default, context=context)
@@ -132,8 +130,6 @@ class procurement_order(osv.osv):
def unlink(self, cr, uid, ids, context=None):
procurements = self.read(cr, uid, ids, ['state'])
unlink_ids = []
- if not context:
- context = {}
for s in procurements:
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
@@ -148,8 +144,6 @@ class procurement_order(osv.osv):
@param product_id: Changed id of product.
@return: Dictionary of values.
"""
- if not context:
- context = {}
if product_id:
w = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v = {
@@ -169,16 +163,12 @@ class procurement_order(osv.osv):
""" Checks if move is cancelled or not.
@return: True or False.
"""
- if not context:
- context = {}
return all(procurement.move_id.state == 'cancel' for procurement in self.browse(cr, uid, ids, context=context))
def check_move_done(self, cr, uid, ids, context=None):
""" Checks if move is done or not.
@return: True or False.
"""
- if not context:
- context = {}
return all(procurement.move_id.state == 'done' for procurement in self.browse(cr, uid, ids, context=context))
#
@@ -213,8 +203,6 @@ class procurement_order(osv.osv):
""" Finds quantity of product used in procurement.
@return: Quantity of product.
"""
- if not context:
- context = {}
proc = self.browse(cr, uid, id, context=context)
result = self._quantity_compute_get(cr, uid, proc, context=context)
if not result:
@@ -225,15 +213,13 @@ class procurement_order(osv.osv):
""" Finds UoM of product used in procurement.
@return: UoM of product.
"""
- if not context:
- context = {}
proc = self.browse(cr, uid, id, context=context)
result = self._uom_compute_get(cr, uid, proc, context=context)
if not result:
result = proc.product_uom.id
return result
- def check_waiting(self, cr, uid, ids, context=[]):
+ def check_waiting(self, cr, uid, ids, context=None):
""" Checks state of move.
@return: True or False
"""
@@ -243,8 +229,6 @@ class procurement_order(osv.osv):
return False
def check_produce_service(self, cr, uid, procurement, context=None):
- if not context:
- context = {}
return False
def check_produce_product(self, cr, uid, procurement, context=None):
@@ -252,8 +236,6 @@ class procurement_order(osv.osv):
@param procurement: Current procurement.
@return: True or False.
"""
- if not context:
- context = {}
return True
def check_make_to_stock(self, cr, uid, ids, context=None):
@@ -261,8 +243,6 @@ class procurement_order(osv.osv):
@return: True or False
"""
ok = True
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
if procurement.product_id.type == 'service':
ok = ok and self._check_make_to_stock_service(cr, uid, procurement, context)
@@ -275,8 +255,6 @@ class procurement_order(osv.osv):
@return: True or Product Id.
"""
res = True
- if not context:
- context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
for procurement in self.browse(cr, uid, ids, context=context):
if procurement.product_id.product_tmpl_id.supply_method <> 'produce':
@@ -334,8 +312,6 @@ class procurement_order(osv.osv):
@return: True
"""
move_obj = self.pool.get('stock.move')
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
if procurement.product_qty <= 0.00:
raise osv.except_osv(_('Data Insufficient !'),
@@ -383,8 +359,6 @@ class procurement_order(osv.osv):
@return: True or move id.
"""
ok = True
- if not context:
- context = {}
if procurement.move_id:
id = procurement.move_id.id
if not (procurement.move_id.state in ('done','assigned','cancel')):
@@ -484,8 +458,6 @@ class procurement_order(osv.osv):
''' Runs through scheduler.
@param use_new_cursor: False or the dbname
'''
- if not context:
- context={}
self._procure_confirm(cr, uid, use_new_cursor=use_new_cursor, context=context)
self._procure_orderpoint_confirm(cr, uid, automatic=automatic,\
use_new_cursor=use_new_cursor, context=context)
@@ -552,8 +524,6 @@ class stock_warehouse_orderpoint(osv.osv):
@param warehouse_id: Changed id of warehouse.
@return: Dictionary of values.
"""
- if not context:
- context = {}
if warehouse_id:
w = self.pool.get('stock.warehouse').browse(cr, uid, warehouse_id, context=context)
v = {'location_id': w.lot_stock_id.id}
@@ -565,8 +535,6 @@ class stock_warehouse_orderpoint(osv.osv):
@param product_id: Changed id of product.
@return: Dictionary of values.
"""
- if not context:
- context = {}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
v = {'product_uom': prod.uom_id.id}
@@ -576,8 +544,6 @@ class stock_warehouse_orderpoint(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({
'name': self.pool.get('ir.sequence').get(cr, uid, 'stock.orderpoint') or '',
})
diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py
index b5afe9c35d7..9c83499f0a5 100644
--- a/addons/procurement/schedulers.py
+++ b/addons/procurement/schedulers.py
@@ -43,7 +43,7 @@ class procurement_order(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary of values
'''
- if not context:
+ if context is None:
context = {}
try:
@@ -148,7 +148,7 @@ class procurement_order(osv.osv):
@param context: A standard dictionary for contextual values
@return: Dictionary of values
"""
- if not context:
+ if context is None:
context = {}
product_obj = self.pool.get('product.product')
proc_obj = self.pool.get('procurement.order')
@@ -200,7 +200,7 @@ class procurement_order(osv.osv):
@return: Dictionary of values
"""
'''
- if not context:
+ if context is None:
context = {}
if use_new_cursor:
cr = pooler.get_db(use_new_cursor).cursor()
diff --git a/addons/procurement/wizard/make_procurement_product.py b/addons/procurement/wizard/make_procurement_product.py
index 1b45517339a..0f5acf2f5c8 100644
--- a/addons/procurement/wizard/make_procurement_product.py
+++ b/addons/procurement/wizard/make_procurement_product.py
@@ -62,8 +62,6 @@ class make_procurement(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which loads Procurement form view.
"""
- if not context:
- context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context).login
wh_obj = self.pool.get('stock.warehouse')
procurement_obj = self.pool.get('procurement.order')
@@ -111,7 +109,7 @@ class make_procurement(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
record_id = context and context.get('active_id', False) or False
diff --git a/addons/procurement/wizard/mrp_procurement.py b/addons/procurement/wizard/mrp_procurement.py
index 7765728a834..7fa28adf5fe 100644
--- a/addons/procurement/wizard/mrp_procurement.py
+++ b/addons/procurement/wizard/mrp_procurement.py
@@ -28,8 +28,6 @@ class procurement_compute(osv.osv_memory):
def _procure_calculation_procure(self, cr, uid, ids, context=None):
try:
- if not context:
- context = {}
proc_obj = self.pool.get('procurement.order')
proc_obj._procure_confirm(cr, uid, use_new_cursor=cr.dbname, context=context)
finally:
@@ -44,8 +42,6 @@ class procurement_compute(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- if not context:
- context = {}
threaded_calculation = threading.Thread(target=self._procure_calculation_procure, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
diff --git a/addons/procurement/wizard/orderpoint_procurement.py b/addons/procurement/wizard/orderpoint_procurement.py
index 8c251846f7b..d94e6753231 100644
--- a/addons/procurement/wizard/orderpoint_procurement.py
+++ b/addons/procurement/wizard/orderpoint_procurement.py
@@ -47,8 +47,6 @@ class procurement_compute(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- if not context:
- context = {}
proc_obj = self.pool.get('procurement.order')
for proc in self.browse(cr, uid, ids, context=context):
proc_obj._procure_orderpoint_confirm(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname, context=context)
@@ -63,8 +61,6 @@ class procurement_compute(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- if not context:
- context = {}
threaded_calculation = threading.Thread(target=self._procure_calculation_orderpoint, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
diff --git a/addons/procurement/wizard/schedulers_all.py b/addons/procurement/wizard/schedulers_all.py
index 9e9ca3d2487..5fae2760edf 100644
--- a/addons/procurement/wizard/schedulers_all.py
+++ b/addons/procurement/wizard/schedulers_all.py
@@ -44,8 +44,6 @@ class procurement_compute_all(osv.osv_memory):
@param context: A standard dictionary
"""
proc_obj = self.pool.get('procurement.order')
- if not context:
- context = {}
for proc in self.browse(cr, uid, ids, context=context):
proc_obj.run_scheduler(cr, uid, automatic=proc.automatic, use_new_cursor=cr.dbname,\
context=context)
@@ -59,8 +57,6 @@ class procurement_compute_all(osv.osv_memory):
@param ids: List of IDs selected
@param context: A standard dictionary
"""
- if not context:
- context = {}
threaded_calculation = threading.Thread(target=self._procure_calculation_all, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index fea11385946..f9b8ddf86cc 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -40,8 +40,6 @@ class price_type(osv.osv):
mf = self.pool.get('ir.model.fields')
ids = mf.search(cr, uid, [('model','in', (('product.product'),('product.template'))), ('ttype','=','float')], context=context)
res = []
- if not context:
- context = {}
for field in mf.browse(cr, uid, ids, context=context):
res.append((field.name, field.field_description))
return res
@@ -84,8 +82,6 @@ product_pricelist_type()
class product_pricelist(osv.osv):
def _pricelist_type_get(self, cr, uid, context=None):
- if not context:
- context = {}
pricelist_type_obj = self.pool.get('product.pricelist.type')
pricelist_type_ids = pricelist_type_obj.search(cr, uid, [], order='name')
pricelist_types = pricelist_type_obj.read(cr, uid, pricelist_type_ids, ['key','name'], context=context)
@@ -112,8 +108,6 @@ class product_pricelist(osv.osv):
result= []
if not all(ids):
return result
- if not context:
- context = {}
for pl in self.browse(cr, uid, ids, context=context):
name = pl.name + ' ('+ pl.currency_id.name + ')'
result.append((pl.id,name))
@@ -298,8 +292,6 @@ class product_pricelist(osv.osv):
return results
def price_get(self, cr, uid, ids, prod_id, qty, partner=None, context=None):
- if not context:
- context = {}
res_multi = self.price_get_multi(cr, uid, pricelist_ids=ids, products_by_qty_by_partner=[(prod_id, qty, partner)], context=context)
res = res_multi[prod_id]
res.update({'item_id': {ids[-1]: ids[-1]}})
@@ -478,8 +470,6 @@ class product_pricelist_version(osv.osv):
return super(product_pricelist_version, self).copy(cr, uid, id, default, context)
def _check_date(self, cursor, user, ids, context=None):
- if not context:
- context = {}
for pricelist_version in self.browse(cursor, user, ids, context=context):
if not pricelist_version.active:
continue
@@ -510,8 +500,6 @@ product_pricelist_version()
class product_pricelist_item(osv.osv):
def _price_field_get(self, cr, uid, context=None):
- if not context:
- context = {}
pt = self.pool.get('product.price.type')
ids = pt.search(cr, uid, [], context=context)
result = []
@@ -533,8 +521,6 @@ class product_pricelist_item(osv.osv):
}
def _check_recursion(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for obj_list in self.browse(cr, uid, ids, context=context):
if obj_list.base == -1:
main_pricelist = obj_list.price_version_id.pricelist_id.id
@@ -579,8 +565,6 @@ class product_pricelist_item(osv.osv):
def product_id_change(self, cr, uid, ids, product_id, context=None):
if not product_id:
return {}
- if not context:
- context = {}
prod = self.pool.get('product.product').read(cr, uid, [product_id], ['code','name'])
if prod[0]['code']:
return {'value': {'name': prod[0]['code']}}
diff --git a/addons/product/product.py b/addons/product/product.py
index 067c9643b9a..f4a659bb92d 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -51,20 +51,14 @@ class product_uom(osv.osv):
def _factor_inv(self, cursor, user, ids, name, arg, context=None):
res = {}
- if not context:
- context = {}
for uom in self.browse(cursor, user, ids, context=context):
res[uom.id] = self._compute_factor_inv(uom.factor)
return res
def _factor_inv_write(self, cursor, user, id, name, value, arg, context=None):
- if not context:
- context = {}
return self.write(cursor, user, id, {'factor': self._compute_factor_inv(value)}, context=context)
def create(self, cr, uid, data, context=None):
- if not context:
- context = {}
if 'factor_inv' in data:
if data['factor_inv'] <> 1:
data['factor'] = self._compute_factor_inv(data['factor_inv'])
@@ -161,8 +155,6 @@ class product_category(osv.osv):
def name_get(self, cr, uid, ids, context=None):
if not len(ids):
return []
- if not context:
- context = {}
reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = []
for record in reads:
@@ -173,8 +165,6 @@ class product_category(osv.osv):
return res
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
- if not context:
- context = {}
res = self.name_get(cr, uid, ids, context=context)
return dict(res)
@@ -197,8 +187,6 @@ class product_category(osv.osv):
_order = "sequence"
def _check_recursion(self, cr, uid, ids, context=None):
level = 100
- if not context:
- context = {}
while len(ids):
cr.execute('select distinct parent_id from product_category where id IN %s',(tuple(ids),))
ids = filter(None, map(lambda x:x[0], cr.fetchall()))
@@ -224,8 +212,6 @@ class product_template(osv.osv):
_description = "Product Template"
def _calc_seller(self, cr, uid, ids, fields, arg, context=None):
result = {}
- if not context:
- context = {}
for product in self.browse(cr, uid, ids, context=context):
for field in fields:
result[product.id] = {field:False}
@@ -290,7 +276,7 @@ class product_template(osv.osv):
return res and res[0] or False
def _default_category(self, cr, uid, context=None):
- if not context:
+ if context is None:
context = {}
if 'categ_id' in context and context['categ_id']:
return context['categ_id']
@@ -324,16 +310,12 @@ class product_template(osv.osv):
}
def _check_uom(self, cursor, user, ids, context=None):
- if not context:
- context = {}
for product in self.browse(cursor, user, ids, context=context):
if product.uom_id.category_id.id <> product.uom_po_id.category_id.id:
return False
return True
def _check_uos(self, cursor, user, ids, context=None):
- if not context:
- context = {}
for product in self.browse(cursor, user, ids, context=context):
if product.uos_id \
and product.uos_id.category_id.id \
@@ -347,7 +329,7 @@ class product_template(osv.osv):
]
def name_get(self, cr, user, ids, context=None):
- if not context:
+ if context is None:
context = {}
if 'partner_id' in context:
pass
@@ -357,7 +339,7 @@ product_template()
class product_product(osv.osv):
def view_header_get(self, cr, uid, view_id, view_type, context=None):
- if not context:
+ if context is None:
context = {}
res = super(product_product, self).view_header_get(cr, uid, view_id, view_type, context)
if (context.get('categ_id', False)):
@@ -366,7 +348,7 @@ class product_product(osv.osv):
def _product_price(self, cr, uid, ids, name, arg, context=None):
res = {}
- if not context:
+ if context is None:
context = {}
quantity = context.get('quantity', 1)
pricelist = context.get('pricelist', False)
@@ -393,8 +375,6 @@ class product_product(osv.osv):
def _product_lst_price(self, cr, uid, ids, name, arg, context=None):
res = {}
- if not context:
- context = {}
product_uom_obj = self.pool.get('product.uom')
for id in ids:
res.setdefault(id, 0.0)
@@ -409,8 +389,6 @@ class product_product(osv.osv):
return res
def _get_partner_code_name(self, cr, uid, ids, product, partner_id, context=None):
- if not context:
- context = {}
for supinfo in product.seller_ids:
if supinfo.name.id == partner_id:
return {'code': supinfo.product_code or product.default_code, 'name': supinfo.product_name or product.name, 'variants': ''}
@@ -419,7 +397,7 @@ class product_product(osv.osv):
def _product_code(self, cr, uid, ids, name, arg, context=None):
res = {}
- if not context:
+ if context is None:
context = {}
for p in self.browse(cr, uid, ids, context=context):
res[p.id] = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context=context)['code']
@@ -427,7 +405,7 @@ class product_product(osv.osv):
def _product_partner_ref(self, cr, uid, ids, name, arg, context=None):
res = {}
- if not context:
+ if context is None:
context = {}
for p in self.browse(cr, uid, ids, context=context):
data = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context=context)
@@ -481,8 +459,6 @@ class product_product(osv.osv):
return False
def _check_ean_key(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for partner in self.browse(cr, uid, ids, context=context):
if not partner.ean13:
continue
@@ -511,8 +487,6 @@ class product_product(osv.osv):
def name_get(self, cr, user, ids, context=None):
if not len(ids):
return []
- if not context:
- context = {}
def _name_get(d):
name = d.get('name','')
code = d.get('default_code',False)
@@ -527,8 +501,6 @@ class product_product(osv.osv):
def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
if not args:
args=[]
- if not context:
- context={}
if name:
ids = self.search(cr, user, [('default_code',operator,name)]+ args, limit=limit, context=context)
if not len(ids):
@@ -579,7 +551,7 @@ class product_product(osv.osv):
return res
def copy(self, cr, uid, id, default=None, context=None):
- if not context:
+ if context is None:
context={}
product = self.read(cr, uid, id, ['name'], context=context)
@@ -637,8 +609,6 @@ class product_packaging(osv.osv):
if not len(ids):
return []
res = []
- if not context:
- context = {}
for pckg in self.browse(cr, uid, ids,context=context):
p_name = pckg.ean and '[' + pckg.ean + '] ' or ''
p_name += pckg.ul.name
@@ -672,8 +642,6 @@ class product_supplierinfo(osv.osv):
_description = "Information about a product supplier"
def _calc_qty(self, cr, uid, ids, fields, arg, context=None):
result = {}
- if not context:
- context = {}
product_uom_pool = self.pool.get('product.uom')
for supplier_info in self.browse(cr, uid, ids, context=context):
for field in fields:
@@ -710,8 +678,6 @@ class product_supplierinfo(osv.osv):
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c)
}
def _check_uom(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for supplier_info in self.browse(cr, uid, ids, context=context):
if supplier_info.product_uom and supplier_info.product_uom.category_id.id <> supplier_info.product_id.uom_id.category_id.id:
return False
@@ -727,8 +693,6 @@ class product_supplierinfo(osv.osv):
@param product_id: Id of product.
@param product_qty: specify quantity to purchase.
"""
- if not context:
- context = {}
if type(supplier_ids) in (int,long,):
supplier_ids = [supplier_ids]
res = {}
@@ -779,8 +743,6 @@ pricelist_partnerinfo()
class res_users(osv.osv):
_inherit = 'res.users'
def _get_group(self, cr, uid, context=None):
- if not context:
- context = {}
result = super(res_users, self)._get_group(cr, uid, context=context)
dataobj = self.pool.get('ir.model.data')
try:
diff --git a/addons/product/wizard/product_price.py b/addons/product/wizard/product_price.py
index a2c24305e23..5a5327a3f6d 100644
--- a/addons/product/wizard/product_price.py
+++ b/addons/product/wizard/product_price.py
@@ -48,7 +48,7 @@ class product_price_list(osv.osv_memory):
To get the date and print the report
@return : return report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
diff --git a/addons/product_expiry/product_expiry.py b/addons/product_expiry/product_expiry.py
index ff6728204ee..01ce50dead8 100644
--- a/addons/product_expiry/product_expiry.py
+++ b/addons/product_expiry/product_expiry.py
@@ -54,8 +54,6 @@ class stock_production_lot(osv.osv):
}
# Assign dates according to products data
def create(self, cr, uid, vals, context=None):
- if not context:
- context = {}
newid = super(stock_production_lot, self).create(cr, uid, vals, context=context)
obj = self.browse(cr, uid, newid, context=context)
towrite = []
diff --git a/addons/product_margin/wizard/product_margin.py b/addons/product_margin/wizard/product_margin.py
index cdbe70b49bd..d5b502d0545 100644
--- a/addons/product_margin/wizard/product_margin.py
+++ b/addons/product_margin/wizard/product_margin.py
@@ -49,7 +49,7 @@ class product_margin(osv.osv_memory):
@return:
"""
- if not context:
+ if context is None:
context = {}
mod_obj = self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'product', 'product_search_form_view')
diff --git a/addons/project/project.py b/addons/project/project.py
index e432a58b87d..a0eae3022d1 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -52,8 +52,6 @@ class project(osv.osv):
_inherits = {'account.analytic.account': "analytic_account_id"}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- if not context:
- context = {}
if user == 1:
return super(project, self).search(cr, user, args, offset=offset, limit=limit, order=order, context=context, count=count)
if context and context.has_key('user_prefence') and context['user_prefence']:
@@ -67,8 +65,6 @@ class project(osv.osv):
def _complete_name(self, cr, uid, ids, name, args, context=None):
res = {}
- if not context:
- context = {}
for m in self.browse(cr, uid, ids, context=context):
res[m.id] = (m.parent_id and (m.parent_id.name + '/') or '') + m.name
return res
@@ -77,8 +73,6 @@ class project(osv.osv):
partner_obj = self.pool.get('res.partner')
if not part:
return {'value':{'contact_id': False, 'pricelist_id': False}}
- if not context:
- context = {}
addr = partner_obj.address_get(cr, uid, [part], ['contact'])
pricelist = partner_obj.read(cr, uid, part, ['property_product_pricelist'], context=context)
pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False
@@ -89,8 +83,6 @@ class project(osv.osv):
progress = {}
if not ids:
return res
- if not context:
- context = {}
cr.execute('''SELECT
project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours)
FROM
@@ -176,8 +168,6 @@ class project(osv.osv):
# TODO: Why not using a SQL contraints ?
def _check_dates(self, cr, uid, ids, context=None):
- if not context:
- context = {}
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']:
@@ -189,14 +179,10 @@ class project(osv.osv):
]
def set_template(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = self.setActive(cr, uid, ids, value=False, context=context)
return res
def set_done(self, cr, uid, ids, context=None):
- if not context:
- context = {}
task_obj = self.pool.get('project.task')
task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', 'not in', ('cancelled', 'done'))])
task_obj.write(cr, uid, task_ids, {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
@@ -207,8 +193,6 @@ class project(osv.osv):
return True
def set_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
task_obj = self.pool.get('project.task')
task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', '!=', 'done')])
task_obj.write(cr, uid, task_ids, {'state': 'cancelled', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
@@ -216,20 +200,14 @@ class project(osv.osv):
return True
def set_pending(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state':'pending'}, context=context)
return True
def set_open(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state':'open'}, context=context)
return True
def reset_project(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = self.setActive(cr, uid, ids, value=True, context=context)
for (id, name) in self.name_get(cr, uid, ids):
message = _("The project '%s' has been opened.") % name
@@ -329,8 +307,6 @@ class task(osv.osv):
_date_name = "date_start"
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- if not context:
- context = {}
obj_project = self.pool.get('project.project')
for domain in args:
if domain[0] == 'project_id' and (not isinstance(domain[2], str)):
@@ -349,8 +325,6 @@ class task(osv.osv):
def _hours_get(self, cr, uid, ids, field_names, args, context=None):
project_obj = self.pool.get('project.project')
res = {}
- if not context:
- context = {}
cr.execute("SELECT task_id, COALESCE(SUM(hours),0) FROM project_task_work WHERE task_id IN %s GROUP BY task_id",(tuple(ids),))
hours = dict(cr.fetchall())
for task in self.browse(cr, uid, ids, context=context):
@@ -381,8 +355,6 @@ class task(osv.osv):
def copy_data(self, cr, uid, id, default={}, context=None):
default = default or {}
- if not context:
- context = {}
default.update({'work_ids':[], 'date_start': False, 'date_end': False, 'date_deadline': False})
if not default.get('remaining_hours', False):
default['remaining_hours'] = float(self.read(cr, uid, id, ['planned_hours'])['planned_hours'])
@@ -393,8 +365,6 @@ class task(osv.osv):
return super(task, self).copy_data(cr, uid, id, default, context)
def _check_dates(self, cr, uid, ids, context=None):
- if not context:
- context = {}
task = self.read(cr, uid, ids[0], ['date_start', 'date_end'])
if task['date_start'] and task['date_end']:
if task['date_start'] > task['date_end']:
@@ -403,8 +373,6 @@ class task(osv.osv):
def _is_template(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
for task in self.browse(cr, uid, ids, context=context):
res[task.id] = True
if task.project_id:
@@ -483,8 +451,6 @@ class task(osv.osv):
_order = "sequence, priority, date_start, id"
def _check_recursion(self, cr, uid, ids, context=None):
- if not context:
- context = {}
obj_task = self.browse(cr, uid, ids[0], context=context)
parent_ids = [x.id for x in obj_task.parent_ids]
children_ids = [x.id for x in obj_task.child_ids]
@@ -517,8 +483,6 @@ class task(osv.osv):
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
users_obj = self.pool.get('res.users')
- if not context:
- context = {}
# read uom as admin to avoid access rights issues, e.g. for portal/share users,
# this should be safe (no context passed to avoid side-effects)
@@ -552,8 +516,6 @@ class task(osv.osv):
# This action open wizard to send email to partner or project manager after close task.
project_id = len(ids) and ids[0] or False
if not project_id: return False
- if not context:
- context = {}
task = self.browse(cr, uid, project_id, context=context)
project = task.project_id
res = self.do_close(cr, uid, [project_id], context=context)
@@ -753,8 +715,6 @@ class project_work(osv.osv):
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
if 'hours' in vals and (not vals['hours']):
vals['hours'] = 0.00
if 'hours' in vals:
diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py
index 8deed718793..ada89d35e69 100644
--- a/addons/project_caldav/project_caldav.py
+++ b/addons/project_caldav/project_caldav.py
@@ -57,9 +57,6 @@ class project_task(osv.osv):
@return: Dictionary value which open Project Task form.
"""
- if not context:
- context = {}
-
data_pool = self.pool.get('ir.model.data')
value = {}
task_form_id = data_pool.get_object(cr, uid, 'project', 'view_task_form2')
@@ -82,8 +79,6 @@ class project_task(osv.osv):
def import_cal(self, cr, uid, data, data_id=None, context=None):
- if not context:
- context = {}
todo_obj = self.pool.get('basic.calendar.todo')
vals = todo_obj.import_cal(cr, uid, data, context=context)
return self.check_import(cr, uid, vals, context=context)
diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py
index 17624502535..9e8c5aa7863 100644
--- a/addons/project_issue/project_issue.py
+++ b/addons/project_issue/project_issue.py
@@ -231,8 +231,6 @@ class project_issue(crm.crm_case, osv.osv):
}
def _get_project(self, cr, uid, context=None):
- if not context:
- context = {}
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.context_project_id:
return user.context_project_id.id
@@ -302,8 +300,6 @@ class project_issue(crm.crm_case, osv.osv):
def _convert(self, cr, uid, ids, xml_id, context=None):
- if not context:
- context = {}
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'project_issue', xml_id)
categ_id = False
@@ -314,13 +310,9 @@ class project_issue(crm.crm_case, osv.osv):
return True
def convert_to_feature(self, cr, uid, ids, context=None):
- if not context:
- context = {}
return self._convert(cr, uid, ids, 'feature_request_categ', context=context)
def convert_to_bug(self, cr, uid, ids, context=None):
- if not context:
- context = {}
return self._convert(cr, uid, ids, 'bug_categ', context=context)
def next_type(self, cr, uid, ids, *args):
@@ -386,8 +378,7 @@ class project_issue(crm.crm_case, osv.osv):
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks
"""
- if not context:
- context = {}
+ if context is None: context = {}
mailgate_pool = self.pool.get('email.server.tools')
subject = msg.get('subject') or _('No Title')
@@ -475,8 +466,6 @@ class project_issue(crm.crm_case, osv.osv):
return True
def copy(self, cr, uid, id, default=None, context=None):
- if not context:
- context={}
issue = self.read(cr, uid, id, ['name'], context=context)
if not default:
default = {}
@@ -496,8 +485,6 @@ class project(osv.osv):
}
def _check_escalation(self, cr, uid, ids, context=None):
- if not context:
- context = {}
project_obj = self.browse(cr, uid, ids[0], context=context)
if project_obj.project_escalation_id:
if project_obj.project_escalation_id.id == project_obj.id:
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 6d26f0dd009..7094eb80512 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -70,24 +70,18 @@ class project_phase(osv.osv):
return True
def _check_dates(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for phase in self.read(cr, uid, ids, ['date_start', 'date_end'], context=context):
if phase['date_start'] and phase['date_end'] and phase['date_start'] > phase['date_end']:
return False
return True
def _check_constraint_start(self, cr, uid, ids, context=None):
- if not context:
- context = {}
phase = self.read(cr, uid, ids[0], ['date_start', 'constraint_date_start'], context=context)
if phase['date_start'] and phase['constraint_date_start'] and phase['date_start'] < phase['constraint_date_start']:
return False
return True
def _check_constraint_end(self, cr, uid, ids, context=None):
- if not context:
- context = {}
phase = self.read(cr, uid, ids[0], ['date_end', 'constraint_date_end'], context=context)
if phase['date_end'] and phase['constraint_date_end'] and phase['date_end'] > phase['constraint_date_end']:
return False
@@ -102,8 +96,6 @@ class project_phase(osv.osv):
res = {}
if not ids:
return res
- if not context:
- context = {}
for phase in self.browse(cr, uid, ids, context=context):
tot = 0.0
for task in phase.task_ids:
@@ -145,8 +137,6 @@ class project_phase(osv.osv):
def onchange_project(self, cr, uid, ids, project, context=None):
result = {}
- if not context:
- context = {}
result['date_start'] = False
project_obj = self.pool.get('project.project')
if project:
@@ -156,8 +146,6 @@ class project_phase(osv.osv):
def onchange_days(self, cr, uid, ids, project, context=None):
result = {}
- if not context:
- context = {}
for id in ids:
project_id = self.browse(cr, uid, id, context=context)
newdate = datetime.strptime(project_id.date_start, '%Y-%m-%d') + relativedelta(days=project_id.duration or 0.0)
@@ -410,8 +398,6 @@ class project_resource_allocation(osv.osv):
def get_name(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
for allocation in self.browse(cr, uid, ids, context=context):
name = allocation.phase_id.name
name += ' (%s%%)' %(allocation.useability)
diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py
index f533a496810..ade1da5c9d9 100644
--- a/addons/project_long_term/wizard/project_compute_phases.py
+++ b/addons/project_long_term/wizard/project_compute_phases.py
@@ -37,8 +37,6 @@ class project_compute_phases(osv.osv_memory):
}
def check_selection(self, cr, uid, ids, context=None):
- if not context:
- context = {}
return self.compute_date(cr, uid, ids, context=context)
diff --git a/addons/project_mailgate/project_mailgate.py b/addons/project_mailgate/project_mailgate.py
index 8e41aca42aa..64bb8c2dc69 100644
--- a/addons/project_mailgate/project_mailgate.py
+++ b/addons/project_mailgate/project_mailgate.py
@@ -38,8 +38,6 @@ class project_tasks(osv.osv):
# @param cr: the current row, from the database cursor,
# @param uid: the current user’s ID for security checks
# """
- if not context:
- context = {}
mailgate_obj = self.pool.get('email.server.tools')
subject = msg.get('subject')
body = msg.get('body')
@@ -97,8 +95,6 @@ class project_tasks(osv.osv):
def message_followers(self, cr, uid, ids, context=None):
res = []
- if not context:
- context = {}
if isinstance(ids, (str, int, long)):
select = [ids]
else:
diff --git a/addons/project_messages/project_messages.py b/addons/project_messages/project_messages.py
index 9d1f162ef82..93f83d62f4a 100644
--- a/addons/project_messages/project_messages.py
+++ b/addons/project_messages/project_messages.py
@@ -41,8 +41,6 @@ class messages(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
# return messages by current user, for current user or for all users
# return all messages if current user is administrator
- if not context:
- context = {}
if uid != 1:
args.extend(['|',('from_id', 'in', [uid,]),('to_id', 'in', [uid, False])])
return super(messages, self).search(cr, uid, args, offset, limit,
diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py
index 1350573791d..cb2b2f8d6a0 100644
--- a/addons/project_mrp/project_procurement.py
+++ b/addons/project_mrp/project_procurement.py
@@ -30,8 +30,6 @@ class procurement_order(osv.osv):
'task_id': fields.many2one('project.task', 'Task')
}
def check_produce_service(self, cr, uid, procurement, context=None):
- if not context:
- context = {}
return True
def action_produce_assign_service(self, cr, uid, ids, context=None):
diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py
index b8a44ab1c05..aefceedd64b 100644
--- a/addons/project_planning/project_planning.py
+++ b/addons/project_planning/project_planning.py
@@ -30,8 +30,6 @@ import tools
class one2many_mod3(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if not context:
- context = context
res = {}
for obj in obj.browse(cr, user, ids, context=context):
res[obj.id] = []
@@ -82,8 +80,6 @@ class report_account_analytic_planning(osv.osv):
def _get_total_planned(self, cr, uid, ids, name, args, context=None):
result = {}
- if not context:
- context = {}
for plan in self.browse(cr, uid, ids, context=context):
plan_hrs=0.0
for p in plan.planning_user_ids:
@@ -95,8 +91,6 @@ class report_account_analytic_planning(osv.osv):
def _get_total_free(self, cr, uid, ids, name, args, context=None):
result = {}
- if not context:
- context = {}
for plan in self.browse(cr, uid, ids, context=context):
total_free = 0.0
for p in plan.planning_user_ids:
@@ -248,7 +242,7 @@ class project_task(osv.osv):
}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
- if not context:
+ if context is None:
context = {}
if not context.get('planning', False):
return super(project_task,self).search(cr, user, args, offset, limit, order, context)
diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py
index 451593e30f7..981add11800 100644
--- a/addons/project_scrum/project_scrum.py
+++ b/addons/project_scrum/project_scrum.py
@@ -159,8 +159,6 @@ class project_scrum_product_backlog(osv.osv):
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args=[]
- if not context:
- context={}
if name:
match = re.match('^S\(([0-9]+)\)$', name)
if match:
diff --git a/addons/project_scrum/wizard/project_scrum_email.py b/addons/project_scrum/wizard/project_scrum_email.py
index ee1edfd37e7..3fca16e555f 100644
--- a/addons/project_scrum/wizard/project_scrum_email.py
+++ b/addons/project_scrum/wizard/project_scrum_email.py
@@ -38,7 +38,7 @@ class project_scrum_email(osv.osv_memory):
@return : default values of fields.
"""
- if not context:
+ if context is None:
context = {}
meeting_pool = self.pool.get('project.scrum.meeting')
record_ids = context and context.get('active_ids', []) or []
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index a4e250861bc..101b7dbac8f 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -45,8 +45,6 @@ class purchase_order(osv.osv):
def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
cur_obj=self.pool.get('res.currency')
for order in self.browse(cr, uid, ids, context=context):
res[order.id] = {
@@ -67,8 +65,6 @@ class purchase_order(osv.osv):
def _set_minimum_planned_date(self, cr, uid, ids, name, value, arg, context=None):
if not value: return False
- if not context:
- context = {}
if type(ids)!=type([]):
ids=[ids]
for po in self.browse(cr, uid, ids, context=context):
@@ -81,8 +77,6 @@ class purchase_order(osv.osv):
def _minimum_planned_date(self, cr, uid, ids, field_name, arg, context=None):
res={}
- if not context:
- context = {}
purchase_obj=self.browse(cr, uid, ids, context=context)
for purchase in purchase_obj:
res[purchase.id] = time.strftime('%Y-%m-%d %H:%M:%S')
@@ -96,8 +90,6 @@ class purchase_order(osv.osv):
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None):
res = {}
- if not context:
- context = {}
for purchase in self.browse(cursor, user, ids, context=context):
tot = 0.0
if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'):
@@ -110,8 +102,6 @@ class purchase_order(osv.osv):
def _shipped_rate(self, cr, uid, ids, name, arg, context=None):
if not ids: return {}
- if not context:
- context = {}
res = {}
for id in ids:
res[id] = [0.0,0.0]
@@ -140,16 +130,12 @@ class purchase_order(osv.osv):
def _get_order(self, cr, uid, ids, context=None):
result = {}
- if not context:
- context = {}
for line in self.pool.get('purchase.order.line').browse(cr, uid, ids, context=context):
result[line.order_id.id] = True
return result.keys()
def _invoiced(self, cursor, user, ids, name, arg, context=None):
res = {}
- if not context:
- context = {}
for purchase in self.browse(cursor, user, ids, context=context):
if purchase.invoice_id.reconciled:
res[purchase.id] = purchase.invoice_id.reconciled
@@ -237,8 +223,6 @@ class purchase_order(osv.osv):
_order = "name desc"
def unlink(self, cr, uid, ids, context=None):
- if not context:
- context = {}
purchase_orders = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in purchase_orders:
@@ -288,8 +272,6 @@ class purchase_order(osv.osv):
#TODO: implement messages system
def wkf_confirm_order(self, cr, uid, ids, context=None):
todo = []
- if not context:
- context = {}
for po in self.browse(cr, uid, ids, context=context):
if not po.order_line:
raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.'))
@@ -405,8 +387,6 @@ class purchase_order(osv.osv):
return False
def action_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for purchase in self.browse(cr, uid, ids, context=context):
for pick in purchase.picking_ids:
if pick.state not in ('draft','cancel'):
@@ -513,8 +493,6 @@ class purchase_order(osv.osv):
@return: new purchase order id
"""
- if not context:
- context = {}
wf_service = netsvc.LocalService("workflow")
def make_key(br, fields):
list_key = []
@@ -608,8 +586,6 @@ purchase_order()
class purchase_order_line(osv.osv):
def _amount_line(self, cr, uid, ids, prop, arg, context=None):
res = {}
- if not context:
- context = {}
cur_obj=self.pool.get('res.currency')
tax_obj = self.pool.get('account.tax')
for line in self.browse(cr, uid, ids, context=context):
@@ -656,8 +632,6 @@ class purchase_order_line(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]})
return super(purchase_order_line, self).copy_data(cr, uid, id, default, context)
@@ -735,8 +709,6 @@ class purchase_order_line(osv.osv):
return res
def action_confirm(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'confirmed'}, context=context)
return True
@@ -752,8 +724,6 @@ class procurement_order(osv.osv):
""" This is action which call from workflow to assign purchase order to procurements
@return: True
"""
- if not context:
- context = {}
res = self.make_po(cr, uid, ids, context=context)
res = res.values()
return len(res) and res[0] or 0 #TO CHECK: why workflow is generated error if return not integer value
@@ -763,7 +733,7 @@ class procurement_order(osv.osv):
@return: New created Purchase Orders procurement wise
"""
res = {}
- if not context:
+ if context is None:
context = {}
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
partner_obj = self.pool.get('res.partner')
diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py
index ca53b3df762..6ed3839fe9e 100644
--- a/addons/purchase/stock.py
+++ b/addons/purchase/stock.py
@@ -35,8 +35,6 @@ class stock_move(osv.osv):
on the purchase order in case the valuation data was not directly specified during picking
confirmation.
"""
- if not context:
- context = {}
reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
if move.product_id.cost_method != 'average' or not move.price_unit:
# no average price costing or cost not specified during picking validation, we will
@@ -120,7 +118,7 @@ class stock_partial_picking(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
pick_obj = self.pool.get('stock.picking')
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
@@ -146,7 +144,7 @@ class stock_partial_move(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_partial_move, self).default_get(cr, uid, fields, context=context)
move_obj = self.pool.get('stock.move')
diff --git a/addons/purchase/wizard/purchase_order_group.py b/addons/purchase/wizard/purchase_order_group.py
index ce631ec3e8b..2496044a45e 100644
--- a/addons/purchase/wizard/purchase_order_group.py
+++ b/addons/purchase/wizard/purchase_order_group.py
@@ -40,7 +40,7 @@ class purchase_order_group(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
- if not context:
+ if context is None:
context={}
res = super(purchase_order_group, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if context.get('active_model','') == 'purchase.order' and len(context['active_ids']) < 2:
@@ -62,7 +62,7 @@ class purchase_order_group(osv.osv_memory):
"""
order_obj = self.pool.get('purchase.order')
mod_obj =self.pool.get('ir.model.data')
- if not context:
+ if context is None:
context = {}
result = mod_obj._get_id(cr, uid, 'purchase', 'view_purchase_order_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py
index 881e4819fcb..615312851fe 100644
--- a/addons/purchase_requisition/purchase_requisition.py
+++ b/addons/purchase_requisition/purchase_requisition.py
@@ -55,8 +55,6 @@ class purchase_requisition(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- if not context:
- context = {}
default.update({
'state':'draft',
'purchase_ids':[],
@@ -65,8 +63,6 @@ class purchase_requisition(osv.osv):
return super(purchase_requisition, self).copy(cr, uid, id, default, context)
def tender_cancel(self, cr, uid, ids, context=None):
purchase_order_obj = self.pool.get('purchase.order')
- if not context:
- context = {}
for purchase in self.browse(cr, uid, ids, context=context):
for purchase_id in purchase.purchase_ids:
if str(purchase_id.state) in('draft','wait'):
@@ -75,20 +71,14 @@ class purchase_requisition(osv.osv):
return True
def tender_in_progress(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state':'in_progress'} ,context=context)
return True
def tender_reset(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'draft'})
return True
def tender_done(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
return True
@@ -116,8 +106,6 @@ class purchase_requisition_line(osv.osv):
@return: Dictionary of changed values
"""
value = {'product_uom_id': ''}
- if not context:
- context = {}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, [product_id], context=context)[0]
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
@@ -134,8 +122,6 @@ class purchase_order(osv.osv):
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition')
}
def wkf_confirm_order(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context=context)
proc_obj=self.pool.get('procurement.order')
for po in self.browse(cr, uid, ids, context=context):
@@ -172,8 +158,6 @@ class procurement_order(osv.osv):
}
def make_po(self, cr, uid, ids, context=None):
sequence_obj = self.pool.get('ir.sequence')
- if not context:
- context = {}
res = super(procurement_order, self).make_po(cr, uid, ids, context=context)
for proc_id, po_id in res.items():
procurement = self.browse(cr, uid, proc_id, context=context)
diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py
index 33cac7891a7..d62aad1e695 100644
--- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py
+++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py
@@ -34,7 +34,7 @@ class purchase_requisition_partner(osv.osv_memory):
}
def view_init(self, cr, uid, fields_list, context=None):
- if not context:
+ if context is None:
context = {}
res = super(purchase_requisition_partner, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False) or False
@@ -62,7 +62,7 @@ class purchase_requisition_partner(osv.osv_memory):
@return: {}
"""
- if not context:
+ if context is None:
context = {}
record_ids = context and context.get('active_ids', False)
if record_ids:
diff --git a/addons/report_webkit/ir_report.py b/addons/report_webkit/ir_report.py
index cffd3d89659..b3155b25430 100644
--- a/addons/report_webkit/ir_report.py
+++ b/addons/report_webkit/ir_report.py
@@ -59,8 +59,6 @@ class ReportXML(osv.osv):
def unlink(self, cursor, user, ids, context=None):
"""Delete report and unregister it"""
- if not context:
- context = {}
trans_obj = self.pool.get('ir.translation')
trans_ids = trans_obj.search(
cursor,
@@ -83,8 +81,6 @@ class ReportXML(osv.osv):
def create(self, cursor, user, vals, context=None):
"Create report and register it"
- if not context:
- context = {}
res = super(ReportXML, self).create(cursor, user, vals, context)
if vals.get('report_type','') == 'webkit':
# I really look forward to virtual functions :S
@@ -99,8 +95,6 @@ class ReportXML(osv.osv):
"Edit report and manage it registration"
if isinstance(ids, (int, long)):
ids = [ids,]
- if not context:
- context = {}
for rep in self.browse(cr, uid, ids, context=context):
if rep.report_type != 'webkit':
continue
diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py
index 48b0fb4b26b..c95a9ce5e2e 100644
--- a/addons/report_webkit/webkit_report.py
+++ b/addons/report_webkit/webkit_report.py
@@ -320,8 +320,6 @@ class WebKitParser(report_sxw):
def create(self, cursor, uid, ids, data, context=None):
"""We override the create function in order to handle generator
Code taken from report openoffice. Thanks guys :) """
- if not context:
- context = {}
pool = pooler.get_pool(cursor.dbname)
ir_obj = pool.get('ir.actions.report.xml')
report_xml_ids = ir_obj.search(cursor, uid,
diff --git a/addons/resource/resource.py b/addons/resource/resource.py
index 0e8ebc692bf..2221c4279c8 100644
--- a/addons/resource/resource.py
+++ b/addons/resource/resource.py
@@ -242,8 +242,6 @@ class resource_resource(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
- if not context:
- context = {}
if not default.get('name', False):
default['name'] = self.browse(cr, uid, id, context=context).name + _(' (copy)')
return super(resource_resource, self).copy(cr, uid, id, default, context)
@@ -367,8 +365,6 @@ class resource_calendar_leaves(osv.osv):
}
def check_dates(self, cr, uid, ids, context=None):
- if not context:
- context = {}
leave = self.read(cr, uid, ids[0], ['date_from', 'date_to'])
if leave['date_from'] and leave['date_to']:
if leave['date_from'] > leave['date_to']:
@@ -381,8 +377,6 @@ class resource_calendar_leaves(osv.osv):
def onchange_resource(self,cr, uid, ids, resource, context=None):
result = {}
- if not context:
- context = {}
if resource:
resource_pool = self.pool.get('resource.resource')
result['calendar_id'] = resource_pool.browse(cr, uid, resource, context=context).calendar_id.id
diff --git a/addons/sale/stock.py b/addons/sale/stock.py
index 90e01a8dc50..7f3160c4fa7 100644
--- a/addons/sale/stock.py
+++ b/addons/sale/stock.py
@@ -28,8 +28,6 @@ class stock_move(osv.osv):
}
def _create_chained_picking(self, cr, uid, pick_name, picking, ptype, move, context=None):
- if not context:
- context = {}
res = super(stock_move, self)._create_chained_picking(cr, uid, pick_name, picking, ptype, move, context=context)
if picking.sale_id:
self.pool.get('stock.picking').write(cr, uid, [res], {'sale_id': picking.sale_id.id})
@@ -184,8 +182,6 @@ class stock_picking(osv.osv):
return result
def action_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = super(stock_picking, self).action_cancel(cr, uid, ids, context=context)
for pick in self.browse(cr, uid, ids, context=context):
call_ship_end = True
diff --git a/addons/sale/wizard/sale_make_invoice.py b/addons/sale/wizard/sale_make_invoice.py
index 7527499859d..f414c2475d5 100644
--- a/addons/sale/wizard/sale_make_invoice.py
+++ b/addons/sale/wizard/sale_make_invoice.py
@@ -46,7 +46,7 @@ class sale_make_invoice(osv.osv_memory):
order_obj = self.pool.get('sale.order')
mod_obj = self.pool.get('ir.model.data')
newinv = []
- if not context:
+ if context is None:
context = {}
data = self.read(cr, uid, ids)[0]
order_obj.action_invoice_create(cr, uid, context.get(('active_ids'), []), data['grouped'], date_inv = data['invoice_date'])
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
index 3d4c801379e..29e87259903 100644
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -51,7 +51,7 @@ class sale_advance_payment_inv(osv.osv_memory):
obj_sale = self.pool.get('sale.order')
obj_lines = self.pool.get('account.invoice.line')
inv_obj = self.pool.get('account.invoice')
- if not context:
+ if context is None:
context = {}
for sale_adv_obj in self.browse(cr, uid, ids, context=context):
diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py
index 0c72c3205cd..7ee996dfd75 100644
--- a/addons/sale_crm/wizard/crm_make_sale.py
+++ b/addons/sale_crm/wizard/crm_make_sale.py
@@ -39,7 +39,7 @@ class crm_make_sale(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return: default value of partner_id field.
"""
- if not context:
+ if context is None:
context = {}
lead_obj = self.pool.get('crm.lead')
@@ -65,7 +65,7 @@ class crm_make_sale(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return: Dictionary value of created sale order.
"""
- if not context:
+ if context is None:
context = {}
case_obj = self.pool.get('crm.lead')
diff --git a/addons/sale_layout/sale_layout.py b/addons/sale_layout/sale_layout.py
index fc6ca6be1a6..cd396fc785b 100755
--- a/addons/sale_layout/sale_layout.py
+++ b/addons/sale_layout/sale_layout.py
@@ -36,8 +36,6 @@ class sale_order_line(osv.osv):
def invoice_line_create(self, cr, uid, ids, context=None):
new_ids = []
list_seq = []
- if not context:
- context = {}
for line in self.browse(cr, uid, ids, context=context):
if line.layout_type == 'article':
new_ids.append(line.id)
@@ -80,8 +78,6 @@ class sale_order_line(osv.osv):
return {}
def create(self, cr, user, vals, context=None):
- if not context:
- context = {}
if vals.has_key('layout_type'):
if vals['layout_type'] == 'line':
vals['name'] = ' '
@@ -92,8 +88,6 @@ class sale_order_line(osv.osv):
return super(sale_order_line, self).create(cr, user, vals, context)
def write(self, cr, user, ids, vals, context=None):
- if not context:
- context = {}
if vals.has_key('layout_type'):
if vals['layout_type'] == 'line':
vals['name'] = ' '
@@ -102,8 +96,6 @@ class sale_order_line(osv.osv):
return super(sale_order_line, self).write(cr, user, ids, vals, context)
def copy(self, cr, uid, id, default=None, context=None):
- if not context:
- context = {}
if default is None:
default = {}
default['layout_type'] = self.browse(cr, uid, id, context=context).layout_type
@@ -135,8 +127,6 @@ sale_order_line()
class one2many_mod2(fields.one2many):
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
- if not context:
- context = {}
if not values:
values = {}
res = {}
diff --git a/addons/sale_margin/sale_margin.py b/addons/sale_margin/sale_margin.py
index 527c388ec26..fdf7eaf69e4 100644
--- a/addons/sale_margin/sale_margin.py
+++ b/addons/sale_margin/sale_margin.py
@@ -36,8 +36,6 @@ class sale_order_line(osv.osv):
def _product_margin(self, cr, uid, ids, field_name, arg, context=None):
res = {}
- if not context:
- context = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = 0
if line.product_id:
@@ -59,8 +57,6 @@ class sale_order(osv.osv):
def _product_margin(self, cr, uid, ids, field_name, arg, context=None):
result = {}
- if not context:
- context = {}
for sale in self.browse(cr, uid, ids, context=context):
result[sale.id] = 0.0
for line in sale.order_line:
@@ -99,16 +95,12 @@ class account_invoice_line(osv.osv):
'cost_price': fields.float('Cost Price', digits=(16, 2)),
}
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
if vals.get('product_id', False):
res = self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
vals['cost_price'] = res[0]['standard_price']
return super(account_invoice_line, self).write(cr, uid, ids, vals, context)
def create(self, cr, uid, vals, context=None):
- if not context:
- context = {}
if vals.get('product_id',False):
res = self.pool.get('product.product').read(cr, uid, [vals['product_id']], ['standard_price'])
vals['cost_price'] = res[0]['standard_price']
diff --git a/addons/sale_order_dates/sale_order_dates.py b/addons/sale_order_dates/sale_order_dates.py
index a13186a8469..d5d3eeca405 100644
--- a/addons/sale_order_dates/sale_order_dates.py
+++ b/addons/sale_order_dates/sale_order_dates.py
@@ -30,8 +30,6 @@ class sale_order_dates(osv.osv):
def _get_effective_date(self, cr, uid, ids, name, arg, context=None):
res = {}
dates_list = []
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
dates_list = []
for pick in order.picking_ids:
@@ -45,8 +43,6 @@ class sale_order_dates(osv.osv):
def _get_commitment_date(self, cr, uid, ids, name, arg, context=None):
res = {}
dates_list = []
- if not context:
- context = {}
for order in self.browse(cr, uid, ids, context=context):
dates_list = []
for line in order.order_line:
diff --git a/addons/stock/product.py b/addons/stock/product.py
index df47ca29d16..0b6cb381fb7 100644
--- a/addons/stock/product.py
+++ b/addons/stock/product.py
@@ -63,7 +63,7 @@ class product_product(osv.osv):
location_obj = self.pool.get('stock.location')
move_obj = self.pool.get('account.move')
move_line_obj = self.pool.get('account.move.line')
- if not context:
+ if context is None:
context = {}
new_price = datas.get('new_price', 0.0)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index fd12bc133de..0935af68a92 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -487,8 +487,6 @@ class stock_tracking(osv.osv):
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
if not args:
args = []
- if not context:
- context = {}
ids = self.search(cr, user, [('serial', '=', name)]+ args, limit=limit, context=context)
ids += self.search(cr, user, [('name', operator, name)]+ args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
@@ -534,8 +532,6 @@ class stock_picking(osv.osv):
return False
if isinstance(ids, (int, long)):
ids = [ids]
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
sql_str = """update stock_move set
date='%s'
@@ -558,8 +554,6 @@ class stock_picking(osv.osv):
return False
if isinstance(ids, (int, long)):
ids = [ids]
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
sql_str = """update stock_move set
date='%s'
@@ -595,8 +589,6 @@ class stock_picking(osv.osv):
return res
def create(self, cr, user, vals, context=None):
- if not context:
- context = {}
if ('name' not in vals) or (vals.get('name')=='/'):
seq_obj_name = 'stock.picking.' + vals['type']
vals['name'] = self.pool.get('ir.sequence').get(cr, user, seq_obj_name)
@@ -656,8 +648,6 @@ class stock_picking(osv.osv):
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
}
def action_process(self, cr, uid, ids, context=None):
- if not context:
- context = {}
return {
'name':_("Products to Process"),
'view_mode': 'form',
@@ -678,8 +668,6 @@ class stock_picking(osv.osv):
if default is None:
default = {}
default = default.copy()
- if not context:
- context = {}
picking_obj = self.browse(cr, uid, [id], context=context)[0]
move_obj=self.pool.get('stock.move')
if ('name' not in default) or (picking_obj.name=='/'):
@@ -706,8 +694,6 @@ class stock_picking(osv.osv):
"""
self.write(cr, uid, ids, {'state': 'confirmed'})
todo = []
- if not context:
- context = {}
for picking in self.browse(cr, uid, ids, context=context):
for r in picking.move_lines:
if r.state == 'draft':
@@ -796,8 +782,6 @@ class stock_picking(osv.osv):
""" Changes picking state to assigned.
@return: True
"""
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'assigned'})
self.log_picking(cr, uid, ids, context=context)
return True
@@ -834,8 +818,6 @@ class stock_picking(osv.osv):
""" Changes picking state to cancel.
@return: True
"""
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
ids2 = [move.id for move in pick.move_lines]
self.pool.get('stock.move').action_cancel(cr, uid, ids2, context)
@@ -1084,8 +1066,6 @@ class stock_picking(osv.osv):
@return: True or False
"""
ok = False
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
if not pick.move_lines:
return True
@@ -1100,8 +1080,6 @@ class stock_picking(osv.osv):
""" Test whether the move lines are canceled or not.
@return: True or False
"""
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
for move in pick.move_lines:
if move.state not in ('cancel',):
@@ -1109,8 +1087,6 @@ class stock_picking(osv.osv):
return True
def allow_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
if not pick.move_lines:
return True
@@ -1284,8 +1260,6 @@ class stock_picking(osv.osv):
@param ids: List of Picking Ids
@param context: A standard dictionary for contextual values
"""
- if not context:
- context = {}
for pick in self.browse(cr, uid, ids, context=context):
msg=''
if pick.auto_picking:
@@ -1335,7 +1309,7 @@ class stock_production_lot(osv.osv):
""" Gets stock of products for locations
@return: Dictionary of values
"""
- if not context:
+ if context is None:
context = {}
if 'location_id' not in context:
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')], context=context)
@@ -1362,8 +1336,6 @@ class stock_production_lot(osv.osv):
""" Searches Ids of products
@return: Ids of locations
"""
- if not context:
- context = {}
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')])
cr.execute('''select
prodlot_id,
@@ -1407,8 +1379,6 @@ class stock_production_lot(osv.osv):
@param context: A standard dictionary
@return: A dictionary of values
"""
- if not context:
- context = {}
value=self.pool.get('action.traceability').action_traceability(cr,uid,ids,context)
return value
stock_production_lot()
@@ -1455,8 +1425,6 @@ class stock_move(osv.osv):
def name_get(self, cr, uid, ids, context=None):
res = []
- if not context:
- context = {}
for line in self.browse(cr, uid, ids, context=context):
res.append((line.id, (line.product_id.code or '/')+': '+line.location_id.name+' > '+line.location_dest_id.name))
return res
@@ -1539,7 +1507,7 @@ class stock_move(osv.osv):
""" Gets default address of partner for destination location
@return: Address id or False
"""
- if not context:
+ if context is None:
context = {}
if context.get('move_line', []):
if context['move_line'][0]:
@@ -1557,7 +1525,7 @@ class stock_move(osv.osv):
""" Gets default address of partner for source location
@return: Address id or False
"""
- if not context:
+ if context is None:
context = {}
if context.get('move_line', []):
try:
@@ -1581,8 +1549,6 @@ class stock_move(osv.osv):
}
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
if uid != 1:
frozen_fields = set(['product_qty', 'product_uom', 'product_uos_qty', 'product_uos', 'location_id', 'location_dest_id', 'product_id'])
for move in self.browse(cr, uid, ids, context=context):
@@ -1596,13 +1562,9 @@ class stock_move(osv.osv):
if default is None:
default = {}
default = default.copy()
- if not context:
- context = {}
return super(stock_move, self).copy(cr, uid, id, default, context=context)
def _auto_init(self, cursor, context=None):
- if not context:
- context = {}
res = super(stock_move, self)._auto_init(cursor, context=context)
cursor.execute('SELECT indexname \
FROM pg_indexes \
@@ -1701,8 +1663,6 @@ class stock_move(osv.osv):
@return: Dictionary containing destination location with chained location type.
"""
result = {}
- if not context:
- context = {}
for m in moves:
dest = self.pool.get('stock.location').chained_location_get(
cr,
@@ -1735,8 +1695,6 @@ class stock_move(osv.osv):
def _create_chained_picking(self, cr, uid, pick_name,picking,ptype,move, context=None):
res_obj = self.pool.get('res.company')
picking_obj = self.pool.get('stock.picking')
- if not context:
- context = {}
pick_id= picking_obj.create(cr, uid, {
'name': pick_name,
'origin': str(picking.origin or ''),
@@ -1755,8 +1713,6 @@ class stock_move(osv.osv):
""" Confirms stock move.
@return: List of ids.
"""
- if not context:
- context = {}
moves = self.browse(cr, uid, ids, context=context)
self.write(cr, uid, ids, {'state': 'confirmed'})
res_obj = self.pool.get('res.company')
@@ -1814,8 +1770,6 @@ class stock_move(osv.osv):
""" Changes the state to assigned.
@return: True
"""
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'assigned'})
return True
@@ -1823,8 +1777,6 @@ class stock_move(osv.osv):
""" Changes the state to confirmed.
@return: True
"""
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'confirmed'})
return True
@@ -1927,8 +1879,6 @@ class stock_move(osv.osv):
:param context: context dictionary that can explicitly mention the company to consider via the 'force_company' key
:raise: osv.except_osv() is any mandatory account or journal is not defined.
"""
- if not context:
- context = {}
product_obj=self.pool.get('product.product')
accounts = product_obj.get_product_accounts(cr, uid, move.product_id.id, context)
acc_src = accounts['stock_account_input']
@@ -2150,8 +2100,6 @@ class stock_move(osv.osv):
if quantity <= 0:
raise osv.except_osv(_('Warning!'), _('Please provide a positive quantity to scrap!'))
res = []
- if not context:
- context = {}
for move in self.browse(cr, uid, ids, context=context):
move_qty = move.product_qty
uos_qty = quantity / move_qty * move.product_uos_qty
@@ -2507,8 +2455,6 @@ class stock_inventory(osv.osv):
""" Cancels the stock move and change inventory state to draft.
@return: True
"""
- if not context:
- context = {}
for inv in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context)
self.write(cr, uid, [inv.id], {'state': 'draft'})
@@ -2518,8 +2464,6 @@ class stock_inventory(osv.osv):
""" Cancels both stock move and inventory
@return: True
"""
- if not context:
- context = {}
for inv in self.browse(cr, uid, ids, context=context):
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in inv.move_ids], context)
self.write(cr, uid, [inv.id], {'state':'cancel'})
diff --git a/addons/stock/wizard/stock_change_standard_price.py b/addons/stock/wizard/stock_change_standard_price.py
index 1910dd75410..198b067ac79 100644
--- a/addons/stock/wizard/stock_change_standard_price.py
+++ b/addons/stock/wizard/stock_change_standard_price.py
@@ -46,7 +46,7 @@ class change_standard_price(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
product_pool = self.pool.get('product.product')
product_obj = product_pool.browse(cr, uid, context.get('active_id', False))
@@ -80,7 +80,7 @@ class change_standard_price(osv.osv_memory):
@param context: A standard dictionary
@return: Dictionary of values
"""
- if not context:
+ if context is None:
context = {}
product_obj = self.pool.get('product.product').browse(cr, uid, context.get('active_id', False), context=context)
price = product_obj.standard_price
@@ -100,7 +100,7 @@ class change_standard_price(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
rec_id = context and context.get('active_id', False)
assert rec_id, _('Active ID is not set in Context')
diff --git a/addons/stock/wizard/stock_fill_inventory.py b/addons/stock/wizard/stock_fill_inventory.py
index c0d3f24281d..fe736e249cd 100644
--- a/addons/stock/wizard/stock_fill_inventory.py
+++ b/addons/stock/wizard/stock_fill_inventory.py
@@ -57,8 +57,8 @@ class stock_fill_inventory(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if context==None:
- context={}
+ if context is None:
+ context = {}
inventory_line_obj = self.pool.get('stock.inventory.line')
location_obj = self.pool.get('stock.location')
product_obj = self.pool.get('product.product')
diff --git a/addons/stock/wizard/stock_inventory_line_split.py b/addons/stock/wizard/stock_inventory_line_split.py
index 13804542d66..11a6a2da323 100644
--- a/addons/stock/wizard/stock_inventory_line_split.py
+++ b/addons/stock/wizard/stock_inventory_line_split.py
@@ -39,7 +39,7 @@ class stock_inventory_line_split(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
record_id = context and context.get('active_id',False)
res = {}
@@ -66,8 +66,6 @@ class stock_inventory_line_split(osv.osv_memory):
ir_sequence_obj = self.pool.get('ir.sequence')
line_obj = self.pool.get('stock.inventory.line')
new_line = []
- if not context:
- context = {}
for data in self.browse(cr, uid, ids, context=context):
for inv_line in line_obj.browse(cr, uid, line_ids, context=context):
line_qty = inv_line.product_qty
diff --git a/addons/stock/wizard/stock_inventory_merge.py b/addons/stock/wizard/stock_inventory_merge.py
index 02e4d73580e..f5ca234d66f 100644
--- a/addons/stock/wizard/stock_inventory_merge.py
+++ b/addons/stock/wizard/stock_inventory_merge.py
@@ -36,7 +36,7 @@ class stock_inventory_merge(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view.
"""
- if not context:
+ if context is None:
context={}
res = super(stock_inventory_merge, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
if context.get('active_model','') == 'stock.inventory' and len(context['active_ids']) < 2:
@@ -56,7 +56,7 @@ class stock_inventory_merge(osv.osv_memory):
invent_obj = self.pool.get('stock.inventory')
invent_line_obj = self.pool.get('stock.inventory.line')
invent_lines = {}
- if not context:
+ if context is None:
context = {}
for inventory in invent_obj.browse(cr, uid, context['active_ids'], context=context):
if inventory.state == "done":
diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index 910164af3bd..038878a6330 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -70,7 +70,7 @@ class stock_move_consume(osv.osv_memory):
@param context: A standard dictionary
@return: default values of fields
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
@@ -94,7 +94,7 @@ class stock_move_consume(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
@@ -125,7 +125,7 @@ class stock_move_scrap(osv.osv_memory):
@param context: A standard dictionary
@return: default values of fields
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
@@ -155,7 +155,7 @@ class stock_move_scrap(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
@@ -181,7 +181,7 @@ class split_in_production_lot(osv.osv_memory):
@param context: A standard dictionary
@return: Default values of fields
"""
- if not context:
+ if context is None:
context = {}
res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context)
@@ -215,7 +215,7 @@ class split_in_production_lot(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
self.split(cr, uid, ids, context.get('active_ids'), context=context)
return {}
@@ -233,8 +233,6 @@ class split_in_production_lot(osv.osv_memory):
prodlot_obj = self.pool.get('stock.production.lot')
move_obj = self.pool.get('stock.move')
new_move = []
- if not context:
- context = {}
for data in self.browse(cr, uid, ids, context=context):
for move in move_obj.browse(cr, uid, move_ids, context=context):
move_qty = move.product_qty
diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py
index 5df0de48ddf..edd079315f3 100644
--- a/addons/stock/wizard/stock_partial_move.py
+++ b/addons/stock/wizard/stock_partial_move.py
@@ -51,7 +51,7 @@ class stock_partial_move(osv.osv_memory):
res = super(stock_partial_move, self).view_init(cr, uid, fields_list, context=context)
move_obj = self.pool.get('stock.move')
- if not context:
+ if context is None:
context = {}
for move in move_obj.browse(cr, uid, context.get('active_ids', []), context=context):
if move.state in ('done', 'cancel'):
@@ -77,7 +77,7 @@ class stock_partial_move(osv.osv_memory):
def __get_active_stock_moves(self, cr, uid, context=None):
move_obj = self.pool.get('stock.move')
- if not context:
+ if context is None:
context = {}
res = []
@@ -151,7 +151,7 @@ class stock_partial_move(osv.osv_memory):
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
move_obj = self.pool.get('stock.move')
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index a7d444f95b2..60e2750db08 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -33,7 +33,7 @@ class stock_partial_picking(osv.osv_memory):
def view_init(self, cr, uid, fields_list, context=None):
res = super(stock_partial_picking, self).view_init(cr, uid, fields_list, context=context)
pick_obj = self.pool.get('stock.picking')
- if not context:
+ if context is None:
context={}
for pick in pick_obj.browse(cr, uid, context.get('active_ids', []), context=context):
need_product_cost = (pick.type == 'in')
@@ -157,11 +157,9 @@ class stock_partial_picking(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
- context = {}
res = super(stock_partial_picking, self).default_get(cr, uid, fields, context=context)
pick_obj = self.pool.get('stock.picking')
- if not context:
+ if context is None:
context={}
if 'date' in fields:
res.update({'date': time.strftime('%Y-%m-%d %H:%M:%S')})
diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py
index 14f5bab76ee..85f3d0ba9ad 100644
--- a/addons/stock/wizard/stock_return_picking.py
+++ b/addons/stock/wizard/stock_return_picking.py
@@ -39,7 +39,7 @@ class stock_return_picking(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary with default values for all field in ``fields``
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
@@ -66,7 +66,7 @@ class stock_return_picking(osv.osv_memory):
@param context: A standard dictionary
@return: New arch of view with new columns.
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context)
record_id = context and context.get('active_id', False)
@@ -142,7 +142,7 @@ class stock_return_picking(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
record_id = context and context.get('active_id', False) or False
move_obj = self.pool.get('stock.move')
diff --git a/addons/stock/wizard/stock_split_move.py b/addons/stock/wizard/stock_split_move.py
index a54b8bfba17..fb024b6f6a0 100644
--- a/addons/stock/wizard/stock_split_move.py
+++ b/addons/stock/wizard/stock_split_move.py
@@ -34,7 +34,7 @@ class stock_split_move_line(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
res = super(stock_split_move_line, self).default_get(cr, uid, fields, context=context)
record_id = context and context.get('active_id', False) or False
@@ -101,7 +101,7 @@ class stock_split_move_line(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
- if not context:
+ if context is None:
context = {}
move_obj = self.pool.get('stock.move')
record_id = context and context.get('active_id', False) or False
diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py
index e2ce82110c5..3782df00f16 100644
--- a/addons/stock/wizard/stock_splitinto.py
+++ b/addons/stock/wizard/stock_splitinto.py
@@ -34,7 +34,7 @@ class stock_split_into(osv.osv_memory):
}
def split(self, cr, uid, data, context=None):
- if not context:
+ if context is None:
context = {}
rec_id = context and context.get('active_ids', False)
move_obj = self.pool.get('stock.move')
diff --git a/addons/stock/wizard/stock_traceability.py b/addons/stock/wizard/stock_traceability.py
index 99bc2676667..44026c22679 100644
--- a/addons/stock/wizard/stock_traceability.py
+++ b/addons/stock/wizard/stock_traceability.py
@@ -38,7 +38,7 @@ class action_traceability(osv.osv_memory):
@param context: A standard dictionary
@return: A dictionary of values
"""
- if not context:
+ if context is None:
context = {}
type1 = context['type'] or 'move_history_ids2'
field = context['field'] or 'tracking_id'
diff --git a/addons/stock_invoice_directly/wizard/stock_invoice.py b/addons/stock_invoice_directly/wizard/stock_invoice.py
index 59a8512c5f3..def35742b99 100644
--- a/addons/stock_invoice_directly/wizard/stock_invoice.py
+++ b/addons/stock_invoice_directly/wizard/stock_invoice.py
@@ -33,7 +33,7 @@ class invoice_directly(osv.osv_memory):
@param context: A standard dictionary
@return:
"""
- if not context:
+ if context is None:
context = {}
result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
pick_obj = self.pool.get('stock.picking')
diff --git a/addons/stock_location/procurement_pull.py b/addons/stock_location/procurement_pull.py
index 4d47ee21dfa..7122e5ccd12 100644
--- a/addons/stock_location/procurement_pull.py
+++ b/addons/stock_location/procurement_pull.py
@@ -25,8 +25,6 @@ from tools.translate import _
class procurement_order(osv.osv):
_inherit = 'procurement.order'
def check_buy(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
@@ -34,8 +32,6 @@ class procurement_order(osv.osv):
return super(procurement_order, self).check_buy(cr, uid, ids)
def check_produce(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
@@ -43,8 +39,6 @@ class procurement_order(osv.osv):
return super(procurement_order, self).check_produce(cr, uid, ids)
def check_move(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for procurement in self.browse(cr, uid, ids, context=context):
for line in procurement.product_id.flow_pull_ids:
if line.location_id==procurement.location_id:
@@ -56,8 +50,6 @@ class procurement_order(osv.osv):
move_obj = self.pool.get('stock.move')
picking_obj=self.pool.get('stock.picking')
wf_service = netsvc.LocalService("workflow")
- if not context:
- context = {}
for proc in proc_obj.browse(cr, uid, ids, context=context):
line = None
for line in proc.product_id.flow_pull_ids:
diff --git a/addons/stock_location/stock_location.py b/addons/stock_location/stock_location.py
index b937920fd70..26507e74e7e 100644
--- a/addons/stock_location/stock_location.py
+++ b/addons/stock_location/stock_location.py
@@ -107,8 +107,6 @@ class stock_move(osv.osv):
'cancel_cascade': fields.boolean('Cancel Cascade', help='If checked, when this move is cancelled, cancel the linked move too')
}
def action_cancel(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for m in self.browse(cr, uid, ids, context=context):
if m.cancel_cascade and m.move_dest_id:
self.action_cancel(cr, uid, [m.move_dest_id.id], context=context)
@@ -119,8 +117,6 @@ stock_move()
class stock_location(osv.osv):
_inherit = 'stock.location'
def chained_location_get(self, cr, uid, location, partner=None, product=None, context=None):
- if not context:
- context = {}
if product:
for path in product.path_ids:
if path.location_from_id.id == location.id:
diff --git a/addons/stock_planning/stock_planning.py b/addons/stock_planning/stock_planning.py
index 227add4cfb9..d9a6eb6e84c 100644
--- a/addons/stock_planning/stock_planning.py
+++ b/addons/stock_planning/stock_planning.py
@@ -48,14 +48,10 @@ class stock_period(osv.osv):
}
def button_open(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'open'})
return True
def button_close(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state': 'close'})
return True
@@ -196,8 +192,6 @@ class stock_sale_forecast(osv.osv):
def _to_default_uom_factor(self, cr, uid, product_id, uom_id, context=None):
uom_obj = self.pool.get('product.uom')
product_obj = self.pool.get('product.product')
- if not context:
- context = {}
product = product_obj.browse(cr, uid, product_id, context=context)
uom = uom_obj.browse(cr, uid, uom_id, context=context)
coef = uom.factor
@@ -208,8 +202,6 @@ class stock_sale_forecast(osv.osv):
def _from_default_uom_factor(self, cr, uid, product_id, uom_id, context=None):
uom_obj = self.pool.get('product.uom')
product_obj = self.pool.get('product.product')
- if not context:
- context = {}
product = product_obj.browse(cr, uid, product_id, context=context)
uom = uom_obj.browse(cr, uid, uom_id, context=context)
res = uom.factor
@@ -310,7 +302,7 @@ class stock_planning(osv.osv):
_name = "stock.planning"
def _get_in_out(self, cr, uid, val, date_start, date_stop, direction, done, context=None):
- if not context:
+ if context is None:
context = {}
product_obj = self.pool.get('product.product')
mapping = {'in': {
@@ -356,8 +348,6 @@ class stock_planning(osv.osv):
def _to_planning_uom(self, cr, uid, val, qtys, context=None):
res_qty = 0
- if not context:
- context = {}
if qtys:
uom_obj = self.pool.get('product.uom')
for qty, prod_uom in qtys:
@@ -370,8 +360,6 @@ class stock_planning(osv.osv):
def _get_forecast(self, cr, uid, ids, field_names, arg, context=None):
res = {}
- if not context:
- context = {}
for val in self.browse(cr, uid, ids, context=context):
res[val.id] = {}
valid_part = val.confirmed_forecasts_only and " AND state = 'validated'" or ""
@@ -394,7 +382,7 @@ class stock_planning(osv.osv):
return res
def _get_stock_start(self, cr, uid, val, date, context=None):
- if not context:
+ if context is None:
context = {}
context['from_date'] = None
context['to_date'] = date
@@ -409,8 +397,6 @@ class stock_planning(osv.osv):
def _get_past_future(self, cr, uid, ids, field_names, arg, context=None):
res = {}
- if not context:
- context = {}
for val in self.browse(cr, uid, ids, context=context):
if val.period_id.date_stop < time.strftime('%Y-%m-%d'):
res[val.id] = 'Past'
@@ -420,8 +406,6 @@ class stock_planning(osv.osv):
def _get_op(self, cr, uid, ids, field_names, arg, context=None): # op = OrderPoint
res = {}
- if not context:
- context = {}
for val in self.browse(cr, uid, ids, context=context):
res[val.id]={}
cr.execute("SELECT product_min_qty, product_max_qty, product_uom \
@@ -537,8 +521,6 @@ class stock_planning(osv.osv):
def _to_default_uom_factor(self, cr, uid, product_id, uom_id, context=None):
uom_obj = self.pool.get('product.uom')
product_obj = self.pool.get('product.product')
- if not context:
- context = {}
product = product_obj.browse(cr, uid, product_id, context=context)
uom = uom_obj.browse(cr, uid, uom_id, context=context)
coef = uom.factor
@@ -615,8 +597,6 @@ class stock_planning(osv.osv):
def _qty_to_standard(self, cr, uid, val, context=None):
uos = False
uos_qty = 0.0
- if not context:
- context = {}
if val.product_uom.category_id.id == val.product_id.uom_id.category_id.id:
uom_qty = val.incoming_left
uom = val.product_uom.id
diff --git a/addons/stock_planning/wizard/stock_planning_create_periods.py b/addons/stock_planning/wizard/stock_planning_create_periods.py
index e24382b2405..13a822ed3fe 100644
--- a/addons/stock_planning/wizard/stock_planning_create_periods.py
+++ b/addons/stock_planning/wizard/stock_planning_create_periods.py
@@ -31,8 +31,6 @@ class stock_period_createlines(osv.osv_memory):
_name = "stock.period.createlines"
def _get_new_period_start(self, cr, uid, context=None):
- if not context:
- context = {}
cr.execute("select max(date_stop) from stock_period")
result = cr.fetchone()
last_date = result and result[0] or False
@@ -55,7 +53,7 @@ class stock_period_createlines(osv.osv_memory):
}
def create_stock_periods(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
interval = context.get('interval',0)
name = context.get('name','Daily')
diff --git a/addons/stock_planning/wizard/stock_planning_forecast.py b/addons/stock_planning/wizard/stock_planning_forecast.py
index c88794d4d42..d38173a665d 100644
--- a/addons/stock_planning/wizard/stock_planning_forecast.py
+++ b/addons/stock_planning/wizard/stock_planning_forecast.py
@@ -50,8 +50,6 @@ class stock_sale_forecast_createlines(osv.osv_memory):
prod_categ_obj = self.pool.get('product.category')
template_obj = self.pool.get('product.template')
forecast_lines = []
- if not context:
- context = {}
for f in self.browse(cr, uid, ids, context=context):
categ_ids = f.product_categ_id.id and [f.product_categ_id.id] or []
prod_categ_ids = prod_categ_obj.search(cr, uid, [('parent_id','child_of', categ_ids)])
diff --git a/addons/subscription/subscription.py b/addons/subscription/subscription.py
index 6852cdbfe89..c015f599e7d 100644
--- a/addons/subscription/subscription.py
+++ b/addons/subscription/subscription.py
@@ -40,8 +40,6 @@ class subscription_document(osv.osv):
}
def write(self, cr, uid, ids, vals, context=None):
- if not context:
- context = {}
if 'model' in vals:
raise osv.except_osv(_('Error !'),_('You cannot modify the Object linked to the Document Type!\nCreate another Document instead !'))
return super(subscription_document, self).write(cr, uid, ids, vals, context=context)
@@ -94,8 +92,6 @@ class subscription_subscription(osv.osv):
}
def set_process(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for row in self.read(cr, uid, ids):
mapping = {'name':'name','interval_number':'interval_number','interval_type':'interval_type','exec_init':'numbercall','date_init':'nextcall'}
res = {'model':'subscription.subscription', 'args': repr([[row['id']]]), 'function':'model_copy', 'priority':6, 'user_id':row['user_id'] and row['user_id'][0]}
@@ -106,8 +102,6 @@ class subscription_subscription(osv.osv):
return True
def model_copy(self, cr, uid, ids, context=None):
- if not context:
- context = {}
for row in self.read(cr, uid, ids):
if not row.get('cron_id',False):
continue
@@ -143,8 +137,6 @@ class subscription_subscription(osv.osv):
return True
def set_done(self, cr, uid, ids, context=None):
- if not context:
- context = {}
res = self.read(cr,uid, ids, ['cron_id'])
ids2 = [x['cron_id'][0] for x in res if x['id']]
self.pool.get('ir.cron').write(cr, uid, ids2, {'active':False})
@@ -152,8 +144,6 @@ class subscription_subscription(osv.osv):
return True
def set_draft(self, cr, uid, ids, context=None):
- if not context:
- context = {}
self.write(cr, uid, ids, {'state':'draft'})
return True
subscription_subscription()
diff --git a/addons/survey/survey.py b/addons/survey/survey.py
index 08466d39a06..85477b3c221 100644
--- a/addons/survey/survey.py
+++ b/addons/survey/survey.py
@@ -47,8 +47,6 @@ class survey(osv.osv):
_rec_name = 'title'
def default_get(self, cr, uid, fields, context=None):
- if not context:
- context = {}
data = super(survey, self).default_get(cr, uid, fields, context)
return data
@@ -97,8 +95,6 @@ class survey(osv.osv):
return True
def copy(self, cr, uid, id, default=None,context=None):
- if not context:
- context = {}
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
def action_print_survey(self, cr, uid, ids, context=None):
@@ -111,7 +107,7 @@ class survey(osv.osv):
@param context: A standard dictionary for contextual values
@return : Dictionary value for print survey form.
"""
- if not context:
+ if context is None:
context = {}
datas = {}
if 'response_id' in context:
@@ -178,7 +174,7 @@ class survey_page(osv.osv):
}
def default_get(self, cr, uid, fields, context=None):
- if not context:
+ if context is None:
context = {}
data = super(survey_page, self).default_get(cr, uid, fields, context)
if context.get('line_order',False):
@@ -189,7 +185,7 @@ class survey_page(osv.osv):
return data
def survey_save(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
search_obj = self.pool.get('ir.ui.view')
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
@@ -206,8 +202,6 @@ class survey_page(osv.osv):
}
def copy(self, cr, uid, id, default=None, context=None):
- if not context:
- context = {}
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
survey_page()
@@ -222,8 +216,6 @@ class survey_question(osv.osv):
if len(ids) == 0:
return {}
val = {}
- if not context:
- context = {}
cr.execute("select question_id, count(id) as Total_response from \
survey_response_line where state='done' and question_id IN %s\
group by question_id" ,(tuple(ids),))
@@ -454,8 +446,6 @@ class survey_question(osv.osv):
def create(self, cr, uid, vals, context=None):
minimum_ans = 0
maximum_ans = 0
- if not context:
- context = {}
if vals.has_key('answer_choice_ids') and not len(vals['answer_choice_ids']):
if vals.has_key('type') and vals['type'] not in ['descriptive_text', 'single_textbox', 'comment','table']:
raise osv.except_osv(_('Warning !'),_("You must enter one or more answer."))
@@ -490,7 +480,7 @@ class survey_question(osv.osv):
return res
def survey_save(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
search_obj = self.pool.get('ir.ui.view')
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
@@ -507,7 +497,7 @@ class survey_question(osv.osv):
}
def default_get(self, cr, uid, fields, context=None):
- if not context:
+ if context is None:
context = {}
data = super(survey_question, self).default_get(cr, uid, fields, context)
if context.get('line_order',False):
@@ -527,13 +517,13 @@ class survey_question_column_heading(osv.osv):
_rec_name = 'title'
def _get_in_visible_rating_weight(self,cr, uid, context=None):
- if not context:
+ if context is None:
context = {}
if context.get('in_visible_rating_weight', False):
return context['in_visible_rating_weight']
return False
def _get_in_visible_menu_choice(self,cr, uid, context=None):
- if not context:
+ if context is None:
context = {}
if context.get('in_visible_menu_choice', False):
return context['in_visible_menu_choice']
@@ -561,8 +551,6 @@ class survey_answer(osv.osv):
def _calc_response_avg(self, cr, uid, ids, field_name, arg, context=None):
val = {}
- if not context:
- context = {}
for rec in self.browse(cr, uid, ids, context=context):
cr.execute("select count(question_id) ,(select count(answer_id) \
from survey_response_answer sra, survey_response_line sa \
@@ -582,7 +570,7 @@ class survey_answer(osv.osv):
return val
def _get_in_visible_answer_type(self,cr, uid, context=None):
- if not context:
+ if context is None:
context = {}
return context.get('in_visible_answer_type', False)
@@ -605,7 +593,7 @@ class survey_answer(osv.osv):
}
def default_get(self, cr, uid, fields, context=None):
- if not context:
+ if context is None:
context = {}
data = super(survey_answer, self).default_get(cr, uid, fields, context)
if context.get('line_order', False):
@@ -644,8 +632,6 @@ class survey_response(osv.osv):
return res
def copy(self, cr, uid, id, default=None,context=None):
- if not context:
- context = {}
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
survey_response()
@@ -744,8 +730,6 @@ class survey_request(osv.osv):
return True
def on_change_user(self, cr, uid, ids, user_id, context=None):
- if not context:
- context = {}
if user_id:
user_obj = self.pool.get('res.users')
user = user_obj.browse(cr, uid, user_id, context=context)
diff --git a/addons/survey/wizard/survey_answer.py b/addons/survey/wizard/survey_answer.py
index f1bccdd0225..90d702f13ed 100644
--- a/addons/survey/wizard/survey_answer.py
+++ b/addons/survey/wizard/survey_answer.py
@@ -479,7 +479,7 @@ class survey_question_wiz(osv.osv_memory):
@return : Dictionary value for fields list with value.
"""
value = {}
- if not context:
+ if context is None:
context = {}
for field in fields_list:
if field.split('_')[0] == 'progress':
@@ -560,6 +560,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : True.
"""
+ if context is None: context = {}
if context.has_key('active') and context.get('active',False):
return True
@@ -1019,7 +1020,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open new survey.Qestion form.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1047,7 +1048,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open new survey.page form.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1075,7 +1076,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Edit survey.page form.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1104,7 +1105,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open next survey.page form, but delete the selected page.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1137,7 +1138,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Edit survey.question form.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1166,7 +1167,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open same survey.page form, but delete the selected survey.question in current survey.page.
"""
- if not context:
+ if context is None:
context = {}
for key,val in context.items():
if type(key) == type(True):
@@ -1200,7 +1201,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Previous Answer form.
"""
- if not context:
+ if context is None:
context = {}
search_obj = self.pool.get('ir.ui.view')
surv_name_wiz = self.pool.get('survey.name.wiz')
@@ -1232,7 +1233,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Next Answer form.
"""
- if not context:
+ if context is None:
context = {}
search_obj = self.pool.get('ir.ui.view')
surv_name_wiz = self.pool.get('survey.name.wiz')
@@ -1264,7 +1265,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Next survey.page form.
"""
- if not context:
+ if context is None:
context = {}
surv_name_wiz = self.pool.get('survey.name.wiz')
search_obj = self.pool.get('ir.ui.view')
@@ -1291,7 +1292,7 @@ class survey_question_wiz(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for Open Previous survey.page form.
"""
- if not context:
+ if context is None:
context = {}
surv_name_wiz = self.pool.get('survey.name.wiz')
search_obj = self.pool.get('ir.ui.view')
diff --git a/addons/survey/wizard/survey_browse_answer.py b/addons/survey/wizard/survey_browse_answer.py
index c8979ee3a6f..81afc061429 100644
--- a/addons/survey/wizard/survey_browse_answer.py
+++ b/addons/survey/wizard/survey_browse_answer.py
@@ -61,6 +61,7 @@ class survey_browse_answer(osv.osv_memory):
@param context: A standard dictionary for contextual values,
@return : Dictionary value for Open the browse answer wizard.
"""
+ if context is None: context = {}
record = self.read(cr, uid, ids, [])
record = record and record[0] or {}
if record['response_id']:
diff --git a/addons/survey/wizard/survey_print.py b/addons/survey/wizard/survey_print.py
index 325c1ac3598..095caeccc5a 100644
--- a/addons/survey/wizard/survey_print.py
+++ b/addons/survey/wizard/survey_print.py
@@ -56,8 +56,6 @@ class survey_print(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for print survey form.
"""
- if not context:
- context = {}
datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']}
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\
diff --git a/addons/survey/wizard/survey_print_answer.py b/addons/survey/wizard/survey_print_answer.py
index 8e3ae95bdca..68ebd399871 100644
--- a/addons/survey/wizard/survey_print_answer.py
+++ b/addons/survey/wizard/survey_print_answer.py
@@ -56,7 +56,7 @@ class survey_print_answer(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return : Dictionary value for created survey answer report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\
diff --git a/addons/survey/wizard/survey_print_statistics.py b/addons/survey/wizard/survey_print_statistics.py
index 4ffe13dd25d..6899b1dbf25 100644
--- a/addons/survey/wizard/survey_print_statistics.py
+++ b/addons/survey/wizard/survey_print_statistics.py
@@ -42,7 +42,7 @@ class survey_print_statistics(osv.osv_memory):
@param context: A standard dictionary for contextual values
@return: Dictionary value for created survey statistics report
"""
- if not context:
+ if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['survey_ids'], context)
diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py
index 2ef83d38fcf..123867fed80 100644
--- a/addons/survey/wizard/survey_selection.py
+++ b/addons/survey/wizard/survey_selection.py
@@ -121,6 +121,7 @@ class survey_name_wiz(osv.osv_memory):
"""
survey_obj = self.pool.get('survey')
search_obj = self.pool.get('ir.ui.view')
+ if context is None: context = {}
sur_id = self.read(cr, uid, ids, [])[0]
survey_id = sur_id['survey_id']
diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py
index 9702b4d2de9..361f7388f6f 100644
--- a/addons/survey/wizard/survey_send_invitation.py
+++ b/addons/survey/wizard/survey_send_invitation.py
@@ -60,7 +60,7 @@ class survey_send_invitation(osv.osv_memory):
return ''.join([choice(chars) for i in range(6)])
def default_get(self, cr, uid, fields_list, context=None):
- if not context:
+ if context is None:
context = {}
data = super(survey_send_invitation, self).default_get(cr, uid, fields_list, context)
survey_obj = self.pool.get('survey')
@@ -94,7 +94,7 @@ class survey_send_invitation(osv.osv_memory):
def action_send(self, cr, uid, ids, context=None):
- if not context:
+ if context is None:
context = {}
record = self.read(cr, uid, ids, [])
survey_ids = context.get('active_ids', [])
@@ -224,7 +224,7 @@ class survey_send_invitation_log(osv.osv_memory):
}
def default_get(self, cr, uid, fields_list, context=None):
- if not context:
+ if context is None:
context = {}
data = super(survey_send_invitation_log, self).default_get(cr, uid, fields_list, context)
data['note'] = context.get('note', '')
diff --git a/addons/thunderbird/installer.py b/addons/thunderbird/installer.py
index 08298e9e52f..e145501fee2 100644
--- a/addons/thunderbird/installer.py
+++ b/addons/thunderbird/installer.py
@@ -32,8 +32,6 @@ class thunderbird_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def default_get(self, cr, uid, fields, context=None):
- if not context:
- context = {}
data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
data['pdf_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_thunderbird.html'
file = open(addons.get_module_resource('thunderbird','plugin', 'openerp_plugin.xpi'),'rb')
diff --git a/addons/wiki/wiki.py b/addons/wiki/wiki.py
index f6a2f71fd4c..f3503936c78 100644
--- a/addons/wiki/wiki.py
+++ b/addons/wiki/wiki.py
@@ -62,8 +62,6 @@ class wiki_group(osv.osv):
@param ids: List of open wiki group’s IDs
@return: dictionay of open wiki window on give group id
"""
- if not context:
- context = {}
if type(ids) in (int,long,):
ids = [ids]
group_id = False
@@ -140,8 +138,6 @@ class wiki_wiki2(osv.osv):
if (not group_id) or content:
return {}
- if not context:
- context = {}
grp = self.pool.get('wiki.groups').browse(cr, uid, group_id, context=context)
section = '0'
for page in grp.page_ids:
@@ -166,8 +162,6 @@ class wiki_wiki2(osv.osv):
@param uid: the current user’s ID for security checks,
@param id: Give wiki page's ID """
- if not context:
- context = {}
return super(wiki_wiki2, self).copy_data(cr, uid, id, {'wiki_id': False}, context)
def create_history(self, cr, uid, ids, vals, context=None):
diff --git a/addons/wiki/wizard/wiki_create_menu.py b/addons/wiki/wizard/wiki_create_menu.py
index fdb952bb52e..f95c1e2dffd 100644
--- a/addons/wiki/wizard/wiki_create_menu.py
+++ b/addons/wiki/wizard/wiki_create_menu.py
@@ -39,7 +39,7 @@ class wiki_create_menu(osv.osv_memory):
@param ids: List of create menu’s IDs
"""
- if not context:
+ if context is None:
context = {}
obj_wiki_group = self.pool.get('wiki.groups')
obj_view = self.pool.get('ir.ui.view')
diff --git a/addons/wiki/wizard/wiki_make_index.py b/addons/wiki/wizard/wiki_make_index.py
index 83324166dbd..6b159b7ac30 100644
--- a/addons/wiki/wizard/wiki_make_index.py
+++ b/addons/wiki/wizard/wiki_make_index.py
@@ -35,7 +35,7 @@ class wiki_make_index(osv.osv_memory):
@param ids: list of wiki index’s IDs
"""
- if not context:
+ if context is None:
context = {}
data = context and context.get('active_ids', []) or []
diff --git a/addons/wiki/wizard/wiki_show_diff.py b/addons/wiki/wizard/wiki_show_diff.py
index f807a5c733c..278c91064df 100644
--- a/addons/wiki/wizard/wiki_show_diff.py
+++ b/addons/wiki/wizard/wiki_show_diff.py
@@ -33,7 +33,7 @@ class showdiff(osv.osv_memory):
""" @param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
"""
- if not context:
+ if context is None:
context = {}
history = self.pool.get('wiki.wiki.history')
ids = context.get('active_ids', [])
diff --git a/addons/wiki/wizard/wiki_wiki_page_open.py b/addons/wiki/wizard/wiki_wiki_page_open.py
index ce71a116bd9..1fe4f8acc49 100644
--- a/addons/wiki/wizard/wiki_wiki_page_open.py
+++ b/addons/wiki/wizard/wiki_wiki_page_open.py
@@ -35,7 +35,7 @@ class wiki_wiki_page_open(osv.osv_memory):
@param ids: List of open wiki page’s IDs
@return: dictionay of open wiki window on give group id
"""
- if not context:
+ if context is None:
context = {}
group_ids = context.get('active_ids', [])
for group in self.pool.get('wiki.groups').browse(cr, uid, group_ids, context=context):