Merge lp:~openerp-dev/openobject-addons/trunk-addons-context into lp:openobject-addons

Proposed by Ujjvala Collins
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-addons-context
Merge into: lp:openobject-addons
Diff against target: 14785 lines (+1795/-1984)
304 files modified
account/account.py (+92/-93)
account/account_analytic_line.py (+9/-7)
account/account_bank_statement.py (+14/-10)
account/account_cash_statement.py (+13/-13)
account/account_move_line.py (+60/-44)
account/installer.py (+1/-1)
account/invoice.py (+24/-21)
account/partner.py (+4/-4)
account/project/wizard/project_account_analytic_line.py (+1/-1)
account/report/account_report.py (+3/-3)
account/wizard/account_automatic_reconcile.py (+7/-3)
account/wizard/account_change_currency.py (+1/-1)
account/wizard/account_invoice_refund.py (+1/-1)
account/wizard/account_move_bank_reconcile.py (+3/-1)
account/wizard/account_move_journal.py (+4/-4)
account/wizard/account_move_line_reconcile_select.py (+1/-1)
account/wizard/account_move_line_select.py (+1/-1)
account/wizard/account_move_line_unreconcile_select.py (+1/-1)
account/wizard/account_open_closed_fiscalyear.py (+3/-3)
account/wizard/account_reconcile_partner_process.py (+2/-0)
account/wizard/account_report_balance_sheet.py (+1/-1)
account/wizard/account_report_common_account.py (+1/-1)
account/wizard/account_report_common_journal.py (+1/-1)
account/wizard/account_report_common_partner.py (+1/-1)
account/wizard/account_report_print_journal.py (+1/-1)
account/wizard/account_subscription_generate.py (+1/-1)
account/wizard/account_unreconcile.py (+3/-3)
account/wizard/account_use_model.py (+2/-2)
account/wizard/account_validate_account_move.py (+2/-2)
account_analytic_analysis/account_analytic_analysis.py (+8/-8)
account_analytic_plans/account_analytic_plans.py (+13/-5)
account_analytic_plans/wizard/analytic_plan_create_model.py (+2/-0)
account_anglo_saxon/invoice.py (+3/-3)
account_anglo_saxon/stock.py (+1/-1)
account_budget/account_budget.py (+14/-10)
account_budget/wizard/account_budget_analytic.py (+1/-1)
account_budget/wizard/account_budget_crossovered_report.py (+1/-1)
account_budget/wizard/account_budget_crossovered_summary_report.py (+1/-1)
account_budget/wizard/account_budget_report.py (+1/-1)
account_coda/account_coda.py (+2/-0)
account_coda/wizard/account_coda_import.py (+4/-4)
account_followup/report/account_followup_print.py (+1/-1)
account_followup/wizard/account_followup_print.py (+8/-8)
account_invoice_layout/account_invoice_layout.py (+3/-4)
account_invoice_layout/wizard/account_invoice_special_message.py (+1/-1)
account_payment/account_move_line.py (+2/-2)
account_payment/account_payment.py (+6/-6)
account_payment/wizard/account_payment_order.py (+1/-1)
account_payment/wizard/account_payment_pay.py (+2/-0)
account_payment/wizard/account_payment_populate_statement.py (+1/-1)
account_sequence/account_sequence.py (+1/-1)
account_sequence/account_sequence_installer.py (+2/-2)
account_voucher/account_voucher.py (+52/-39)
account_voucher/wizard/account_statement_from_invoice.py (+4/-2)
account_voucher/wizard/account_voucher_unreconcile.py (+1/-1)
analytic/analytic.py (+1/-1)
auction/auction.py (+9/-37)
auction/report/huissier.py (+2/-2)
auction/report/report_auction.py (+0/-2)
auction/report/total.py (+1/-1)
auction/wizard/auction_aie_send.py (+12/-6)
auction/wizard/auction_aie_send_result.py (+10/-4)
auction/wizard/auction_catalog_flagey_report.py (+8/-4)
auction/wizard/auction_lots_able.py (+4/-2)
auction/wizard/auction_lots_auction_move.py (+2/-2)
auction/wizard/auction_lots_buyer_map.py (+13/-13)
auction/wizard/auction_lots_cancel.py (+2/-2)
auction/wizard/auction_lots_enable.py (+4/-2)
auction/wizard/auction_lots_invoice.py (+7/-3)
auction/wizard/auction_lots_make_invoice.py (+4/-4)
auction/wizard/auction_lots_make_invoice_buyer.py (+5/-5)
auction/wizard/auction_lots_numerotate.py (+9/-8)
auction/wizard/auction_lots_sms_send.py (+5/-5)
auction/wizard/auction_pay_buy.py (+6/-5)
auction/wizard/auction_pay_sel.py (+5/-3)
auction/wizard/auction_payer_sel.py (+7/-3)
auction/wizard/auction_taken.py (+2/-2)
auction/wizard/auction_transfer_unsold_object.py (+7/-6)
audittrail/wizard/audittrail_view_log.py (+3/-5)
base_action_rule/base_action_rule.py (+10/-10)
base_calendar/base_calendar.py (+6/-8)
base_calendar/wizard/base_calendar_invite_attendee.py (+2/-2)
base_calendar/wizard/base_calendar_set_exrule.py (+6/-2)
base_calendar/wizard/calendar_event_edit_all.py (+3/-3)
base_contact/base_contact.py (+7/-5)
base_contact/base_contact_installer.py (+1/-1)
base_iban/base_iban.py (+8/-8)
base_module_doc_rst/base_module_doc_rst.py (+3/-2)
base_module_doc_rst/report/report_proximity_graph.py (+1/-1)
base_module_doc_rst/wizard/generate_relation_graph.py (+1/-1)
base_module_doc_rst/wizard/wizard_tech_guide_rst.py (+1/-1)
base_module_quality/wizard/module_quality_check.py (+1/-1)
base_module_quality/wizard/quality_save_report.py (+1/-1)
base_report_creator/base_report_creator.py (+11/-12)
base_report_creator/wizard/report_menu_create.py (+2/-2)
base_report_designer/base_report_designer.py (+3/-3)
base_report_designer/installer.py (+2/-2)
base_report_designer/wizard/base_report_designer_modify.py (+12/-13)
base_setup/__init__.py (+2/-2)
base_setup/todo.py (+1/-1)
base_synchro/base_synchro_obj.py (+111/-111)
base_synchro/wizard/base_synchro.py (+10/-10)
base_vat/base_vat.py (+3/-3)
board/board.py (+9/-15)
board/wizard/board_menu_create.py (+3/-3)
caldav/calendar.py (+14/-14)
caldav/calendar_collection.py (+0/-2)
caldav/wizard/calendar_event_import.py (+1/-1)
caldav/wizard/calendar_event_subscribe.py (+1/-1)
crm/crm.py (+26/-28)
crm/crm_action_rule.py (+5/-5)
crm/crm_lead.py (+8/-10)
crm/crm_meeting.py (+3/-8)
crm/crm_opportunity.py (+4/-4)
crm/crm_phonecall.py (+1/-1)
crm/report/report_businessopp.py (+1/-1)
crm/wizard/crm_add_note.py (+1/-1)
crm/wizard/crm_lead_to_opportunity.py (+12/-4)
crm/wizard/crm_lead_to_partner.py (+6/-6)
crm/wizard/crm_partner_to_opportunity.py (+2/-2)
crm/wizard/crm_phonecall_to_meeting.py (+1/-1)
crm/wizard/crm_phonecall_to_partner.py (+5/-9)
crm/wizard/crm_send_email.py (+4/-4)
crm/wizard/wizard_history_event.py (+2/-2)
crm_caldav/crm_caldav.py (+2/-5)
crm_partner_assign/partner_geo_assign.py (+1/-1)
crm_partner_assign/wizard/crm_forward_to_partner.py (+2/-1)
crm_profiling/crm_profiling.py (+4/-6)
delivery/delivery.py (+16/-12)
delivery/stock.py (+3/-3)
delivery/wizard/delivery_sale_order.py (+12/-8)
document/directory_content.py (+2/-2)
document/directory_report.py (+2/-2)
document/document.py (+7/-5)
document/document_directory.py (+4/-6)
document/document_storage.py (+3/-7)
document/wizard/document_configuration.py (+1/-1)
document_ftp/wizard/ftp_browse.py (+2/-2)
document_ftp/wizard/ftp_configuration.py (+1/-1)
document_ics/document_ics.py (+0/-1)
document_ics/document_ics_config_wizard.py (+1/-1)
document_webdav/document_webdav.py (+1/-1)
email_template/email_template.py (+12/-10)
email_template/email_template_account.py (+4/-4)
email_template/email_template_mailbox.py (+1/-3)
email_template/wizard/email_template_send_wizard.py (+1/-1)
event/event.py (+9/-16)
event/wizard/partner_event_registration.py (+1/-3)
event_project/event_project.py (+0/-2)
event_project/wizard/event_project_retro.py (+4/-4)
fetchmail/fetchmail.py (+14/-10)
google_map/wizard/google_map_launch.py (+2/-2)
hr/hr.py (+7/-7)
hr/hr_department.py (+0/-4)
hr_attendance/hr_attendance.py (+1/-11)
hr_attendance/wizard/hr_attendance_bymonth.py (+0/-2)
hr_attendance/wizard/hr_attendance_byweek.py (+0/-2)
hr_attendance/wizard/hr_attendance_error.py (+0/-2)
hr_attendance/wizard/hr_attendance_sign_in_out.py (+0/-16)
hr_evaluation/hr_evaluation.py (+2/-30)
hr_evaluation/wizard/hr_evaluation_mail.py (+0/-2)
hr_expense/hr_expense.py (+1/-9)
hr_holidays/hr_holidays.py (+1/-19)
hr_holidays/wizard/hr_holidays_summary_department.py (+0/-2)
hr_holidays/wizard/hr_holidays_summary_employees.py (+0/-2)
hr_payroll/hr_payroll.py (+10/-52)
hr_payroll_account/hr_payroll_account.py (+8/-18)
hr_recruitment/hr_recruitment.py (+2/-16)
hr_recruitment/wizard/hr_recruitment_phonecall.py (+4/-4)
hr_timesheet/hr_timesheet.py (+0/-4)
hr_timesheet/wizard/hr_timesheet_print_employee.py (+0/-4)
hr_timesheet/wizard/hr_timesheet_print_users.py (+0/-2)
hr_timesheet/wizard/hr_timesheet_sign_in_out.py (+0/-18)
hr_timesheet_invoice/hr_timesheet_invoice.py (+0/-10)
hr_timesheet_invoice/wizard/hr_timesheet_analytic_profit.py (+0/-2)
hr_timesheet_sheet/hr_timesheet_sheet.py (+4/-34)
idea/idea.py (+11/-12)
idea/wizard/idea_post_vote.py (+9/-5)
l10n_be/wizard/l10_be_partner_vat_listing.py (+4/-4)
l10n_ch/invoice.py (+4/-4)
l10n_ch/wizard/create_dta.py (+1/-1)
lunch/lunch.py (+6/-6)
lunch/wizard/lunch_cashbox_clean.py (+3/-1)
lunch/wizard/lunch_order_cancel.py (+3/-1)
lunch/wizard/lunch_order_confirm.py (+3/-1)
mail_gateway/mail_gateway.py (+7/-9)
marketing_campaign/marketing_campaign.py (+11/-17)
marketing_campaign/report/campaign_analysis.py (+2/-2)
membership/membership.py (+3/-9)
membership/wizard/membership_invoice.py (+1/-1)
mrp/mrp.py (+17/-16)
mrp/procurement.py (+3/-3)
mrp/product.py (+7/-5)
mrp/report/price.py (+1/-1)
mrp/report/workcenter_load.py (+1/-1)
mrp/stock.py (+4/-4)
mrp/wizard/change_production_qty.py (+7/-5)
mrp/wizard/mrp_change_standard_price.py (+4/-2)
mrp/wizard/mrp_price.py (+2/-0)
mrp/wizard/mrp_product_produce.py (+8/-4)
mrp/wizard/mrp_track_prod.py (+9/-5)
mrp/wizard/mrp_workcenter_load.py (+2/-0)
mrp_operations/mrp_operations.py (+17/-16)
mrp_repair/mrp_repair.py (+17/-17)
mrp_repair/wizard/cancel_repair.py (+7/-3)
mrp_repair/wizard/make_invoice.py (+4/-2)
mrp_subproduct/mrp_subproduct.py (+2/-2)
outlook/installer.py (+2/-2)
point_of_sale/account_bank_statement.py (+0/-6)
point_of_sale/point_of_sale.py (+5/-5)
point_of_sale/wizard/all_closed_cashbox_of_the_day.py (+2/-0)
point_of_sale/wizard/pos_discount.py (+2/-0)
point_of_sale/wizard/pos_open_statement.py (+2/-0)
point_of_sale/wizard/pos_payment.py (+15/-9)
point_of_sale/wizard/pos_receipt.py (+2/-0)
point_of_sale/wizard/pos_return.py (+21/-14)
point_of_sale/wizard/pos_sales_user.py (+4/-2)
point_of_sale/wizard/pos_sales_user_current_user.py (+4/-2)
point_of_sale/wizard/pos_sales_user_today.py (+4/-2)
point_of_sale/wizard/pos_scan_product.py (+3/-2)
process/process.py (+17/-17)
procurement/procurement.py (+37/-39)
procurement/schedulers.py (+6/-6)
procurement/wizard/make_procurement_product.py (+5/-3)
procurement/wizard/mrp_procurement.py (+2/-2)
procurement/wizard/orderpoint_procurement.py (+3/-3)
procurement/wizard/schedulers_all.py (+3/-3)
product/pricelist.py (+13/-12)
product/product.py (+55/-47)
product/wizard/product_price.py (+3/-1)
product_expiry/product_expiry.py (+2/-1)
product_margin/wizard/product_margin.py (+2/-2)
product_visible_discount/product_visible_discount.py (+2/-2)
project/project.py (+11/-23)
project/wizard/project_task_delegate.py (+1/-1)
project_caldav/project_caldav.py (+1/-4)
project_gtd/wizard/project_gtd_fill.py (+1/-5)
project_issue/project_issue.py (+8/-19)
project_long_term/project_long_term.py (+1/-18)
project_long_term/wizard/project_compute_phases.py (+0/-2)
project_long_term/wizard/project_schedule_tasks.py (+0/-2)
project_mailgate/project_mailgate.py (+2/-2)
project_mrp/project_procurement.py (+2/-4)
project_planning/project_planning.py (+20/-52)
project_scrum/project_scrum.py (+3/-37)
project_scrum/wizard/project_scrum_backlog_create_task.py (+0/-2)
project_scrum/wizard/project_scrum_email.py (+3/-1)
project_scrum/wizard/project_scrum_postpone.py (+1/-1)
project_timesheet/project_timesheet.py (+3/-3)
purchase/purchase.py (+22/-20)
purchase/stock.py (+6/-2)
purchase/wizard/purchase_order_group.py (+4/-2)
purchase_requisition/purchase_requisition.py (+7/-7)
purchase_requisition/wizard/purchase_requisition_partner.py (+8/-4)
report_webkit/wizard/report_webkit_actions.py (+5/-3)
resource/resource.py (+2/-8)
sale/sale.py (+5/-48)
sale/stock.py (+2/-4)
sale/wizard/sale_line_invoice.py (+3/-3)
sale/wizard/sale_make_invoice.py (+5/-3)
sale/wizard/sale_make_invoice_advance.py (+6/-4)
sale_analytic_plans/sale_analytic_plans.py (+1/-1)
sale_crm/wizard/crm_make_sale.py (+2/-6)
sale_layout/sale_layout.py (+3/-6)
sale_margin/sale_margin.py (+1/-1)
sale_mrp/sale_mrp.py (+0/-2)
sale_order_dates/sale_order_dates.py (+2/-2)
share/wizard/share_wizard.py (+1/-1)
stock/product.py (+5/-3)
stock/stock.py (+36/-32)
stock/wizard/stock_change_standard_price.py (+11/-5)
stock/wizard/stock_fill_inventory.py (+4/-4)
stock/wizard/stock_inventory_line_split.py (+6/-4)
stock/wizard/stock_inventory_merge.py (+4/-2)
stock/wizard/stock_invoice_onshipping.py (+1/-1)
stock/wizard/stock_location_product.py (+1/-1)
stock/wizard/stock_move.py (+16/-4)
stock/wizard/stock_partial_move.py (+9/-8)
stock/wizard/stock_partial_picking.py (+7/-8)
stock/wizard/stock_replacement.py (+2/-2)
stock/wizard/stock_return_picking.py (+12/-6)
stock/wizard/stock_split_move.py (+6/-2)
stock/wizard/stock_splitinto.py (+2/-2)
stock/wizard/stock_traceability.py (+3/-2)
stock/wizard/stock_ups.py (+4/-4)
stock_invoice_directly/wizard/stock_invoice.py (+4/-2)
stock_location/procurement_pull.py (+3/-3)
stock_location/stock_location.py (+2/-2)
stock_planning/stock_planning.py (+18/-16)
stock_planning/wizard/stock_planning_create_periods.py (+2/-0)
subscription/subscription.py (+7/-7)
survey/survey.py (+35/-19)
survey/wizard/survey_answer.py (+36/-13)
survey/wizard/survey_browse_answer.py (+1/-0)
survey/wizard/survey_print_answer.py (+2/-0)
survey/wizard/survey_print_statistics.py (+2/-0)
survey/wizard/survey_selection.py (+1/-0)
survey/wizard/survey_send_invitation.py (+7/-1)
thunderbird/installer.py (+1/-1)
wiki/wiki.py (+3/-5)
wiki/wizard/wiki_create_menu.py (+3/-1)
wiki/wizard/wiki_make_index.py (+4/-2)
wiki/wizard/wiki_show_diff.py (+2/-0)
wiki/wizard/wiki_wiki_page_open.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-addons-context
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) (more small improvements) Needs Fixing
Harry (OpenERP) (community) Approve
Review via email: mp+41682@code.launchpad.net

This proposal has been superseded by a proposal from 2010-12-13.

Description of the change

* Added context=None on methods used for _constraints and replaced context={} with context=None in all methods.
* Replaced the condition 'if not context:' with 'if context is None:'.

To post a comment you must log in.
Revision history for this message
Harry (OpenERP) (hmo-tinyerp) wrote :

yes. it seem ok

review: Approve
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello,

This looks great, and will be a very nice improvement!

I see two little remaining things to fix to make it perfect :-)

1. I noticed a few _constraints in addons that still do not have a context in this merge prop:
- account.account.template check_cycle
- account.tax.code check_cycle
- account.tax.code.template check_cycle
(These 3 could be replaced by the generic osv.osv._check_recursion I think!)

- stock.move _check_product_lot
- stock.move _check_tracking

(Note: I've also fixed the _constraints remaining in the server, just pushed it)

2. We should only test the value of the context within a method that actually reads/writes the context. Everywhere else the context should just be passed around, e.g.:

   def method(self, cr, uid, ids, context=None):
      self.read(cr, uid, ids, context=context)

No need to test the context value, it's okay to forward a None value. If down in the stack another function needs to actually read/write the context, then it will do the check for None.

Thus there are many similar blocks that can be removed, to make the code smaller (which is always good). In the current state of the merge proposal I see many cases, for example:

  - account/wizard/account_subscription_generate.py
  - account_analytic_analysis/account_analytic_analysis.py (only needed in _read_flat)
  - etc.

Thanks a lot for the good work!

review: Needs Fixing ((more small improvements))
Revision history for this message
Numérigraphe (numerigraphe) wrote :

Thanks for this bold refactoring, all the more as v6.0 is near.
The script I wrote some time ago may hint you to places where context is unused:
https://bugs.launchpad.net/openobject-addons/+bug/525808/+attachment/1191481/+files/fix_default_values.py
It's not working 100% but you can compare its results with your own patch.
Lionel.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2010-11-26 16:13:59 +0000
3+++ account/account.py 2010-12-13 07:44:48 +0000
4@@ -30,7 +30,7 @@
5 import decimal_precision as dp
6 from tools.translate import _
7
8-def check_cycle(self, cr, uid, ids):
9+def check_cycle(self, cr, uid, ids, context=None):
10 """ climbs the ``self._table.parent_id`` chains for 100 levels or
11 until it can't find any more parent(s)
12
13@@ -116,7 +116,7 @@
14 _order = "sequence"
15
16 def _check_percent(self, cr, uid, ids, context=None):
17- obj = self.browse(cr, uid, ids[0])
18+ obj = self.browse(cr, uid, ids[0], context=context)
19 if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0):
20 return False
21 return True
22@@ -194,7 +194,7 @@
23 if not args[pos][2]:
24 del args[pos]
25 continue
26- jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2])
27+ jour = self.pool.get('account.journal').browse(cr, uid, args[pos][2], context=context)
28 if (not (jour.account_control_ids or jour.type_control_ids)) or not args[pos][2]:
29 args[pos] = ('type','not in',('consolidation','view'))
30 continue
31@@ -207,7 +207,7 @@
32 if context and context.has_key('consolidate_childs'): #add consolidated childs of accounts
33 ids = super(account_account, self).search(cr, uid, args, offset, limit,
34 order, context=context, count=count)
35- for consolidate_child in self.browse(cr, uid, context['account_id']).child_consol_ids:
36+ for consolidate_child in self.browse(cr, uid, context['account_id'], context=context).child_consol_ids:
37 ids.append(consolidate_child.id)
38 return ids
39
40@@ -215,8 +215,6 @@
41 order, context=context, count=count)
42
43 def _get_children_and_consol(self, cr, uid, ids, context=None):
44- if context is None:
45- context = {}
46 #this function search for all the children and all consolidated children (recursively) of the given account ids
47 ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)
48 ids3 = []
49@@ -309,15 +307,15 @@
50 res[id] = sums.get(id, null_result)
51 return res
52
53- def _get_company_currency(self, cr, uid, ids, field_name, arg, context={}):
54+ def _get_company_currency(self, cr, uid, ids, field_name, arg, context=None):
55 result = {}
56- for rec in self.browse(cr, uid, ids, context):
57+ for rec in self.browse(cr, uid, ids, context=context):
58 result[rec.id] = (rec.company_id.currency_id.id,rec.company_id.currency_id.symbol)
59 return result
60
61- def _get_child_ids(self, cr, uid, ids, field_name, arg, context={}):
62+ def _get_child_ids(self, cr, uid, ids, field_name, arg, context=None):
63 result = {}
64- for record in self.browse(cr, uid, ids, context):
65+ for record in self.browse(cr, uid, ids, context=context):
66 if record.child_parent_ids:
67 result[record.id] = [x.id for x in record.child_parent_ids]
68 else:
69@@ -330,9 +328,9 @@
70
71 return result
72
73- def _get_level(self, cr, uid, ids, field_name, arg, context={}):
74+ def _get_level(self, cr, uid, ids, field_name, arg, context=None):
75 res={}
76- accounts = self.browse(cr, uid, ids)
77+ accounts = self.browse(cr, uid, ids, context=context)
78 for account in accounts:
79 level = 0
80 if account.parent_id:
81@@ -396,8 +394,8 @@
82 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
83 }
84
85- def _check_recursion(self, cr, uid, ids):
86- obj_self = self.browse(cr, uid, ids[0])
87+ def _check_recursion(self, cr, uid, ids, context=None):
88+ obj_self = self.browse(cr, uid, ids[0], context=context)
89 p_id = obj_self.parent_id and obj_self.parent_id.id
90 if (obj_self in obj_self.child_consol_ids) or (p_id and (p_id is obj_self.id)):
91 return False
92@@ -426,14 +424,12 @@
93 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
94 if not args:
95 args = []
96- if not context:
97- context = {}
98 args = args[:]
99 ids = []
100 try:
101 if name and str(name).startswith('partner:'):
102 part_id = int(name.split(':')[1])
103- part = self.pool.get('res.partner').browse(cr, user, part_id, context)
104+ part = self.pool.get('res.partner').browse(cr, user, part_id, context=context)
105 args += [('id', 'in', (part.property_account_payable.id, part.property_account_receivable.id))]
106 name = False
107 if name and str(name).startswith('type:'):
108@@ -685,7 +681,7 @@
109
110 @return: Returns a list of tupples containing id, name
111 """
112- result = self.browse(cr, user, ids, context)
113+ result = self.browse(cr, user, ids, context=context)
114 res = []
115 for rs in result:
116 name = rs.name
117@@ -733,7 +729,7 @@
118 view_id = 'account_journal_bank_view_multi'
119
120 data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)])
121- data = obj_data.browse(cr, uid, data_id[0])
122+ data = obj_data.browse(cr, uid, data_id[0], context=context)
123
124 res.update({
125 'centralisation':type == 'situation',
126@@ -778,8 +774,8 @@
127 return False
128 return True
129
130- def _check_duration(self,cr,uid,ids):
131- obj_fy = self.browse(cr,uid,ids[0])
132+ def _check_duration(self, cr, uid, ids, context=None):
133+ obj_fy = self.browse(cr, uid, ids[0], context=context)
134 if obj_fy.date_stop < obj_fy.date_start:
135 return False
136 return True
137@@ -789,11 +785,11 @@
138 (_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop'])
139 ]
140
141- def create_period3(self,cr, uid, ids, context={}):
142+ def create_period3(self,cr, uid, ids, context=None):
143 return self.create_period(cr, uid, ids, context, 3)
144
145- def create_period(self,cr, uid, ids, context={}, interval=1):
146- for fy in self.browse(cr, uid, ids, context):
147+ def create_period(self,cr, uid, ids, context=None, interval=1):
148+ for fy in self.browse(cr, uid, ids, context=context):
149 ds = datetime.strptime(fy.date_start, '%Y-%m-%d')
150 while ds.strftime('%Y-%m-%d')<fy.date_stop:
151 de = ds + relativedelta(months=interval, days=-1)
152@@ -811,7 +807,7 @@
153 ds = ds + relativedelta(months=interval)
154 return True
155
156- def find(self, cr, uid, dt=None, exception=True, context={}):
157+ def find(self, cr, uid, dt=None, exception=True, context=None):
158 if not dt:
159 dt = time.strftime('%Y-%m-%d')
160 ids = self.search(cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)])
161@@ -856,14 +852,14 @@
162 }
163 _order = "date_start"
164
165- def _check_duration(self,cr,uid,ids,context={}):
166- obj_period=self.browse(cr,uid,ids[0])
167+ def _check_duration(self,cr,uid,ids,context=None):
168+ obj_period = self.browse(cr, uid, ids[0], context=context)
169 if obj_period.date_stop < obj_period.date_start:
170 return False
171 return True
172
173- def _check_year_limit(self,cr,uid,ids,context={}):
174- for obj_period in self.browse(cr,uid,ids):
175+ def _check_year_limit(self,cr,uid,ids,context=None):
176+ for obj_period in self.browse(cr, uid, ids, context=context):
177 if obj_period.special:
178 continue
179
180@@ -884,13 +880,13 @@
181 (_check_year_limit, 'Invalid period ! Some periods overlap or the date period is not in the scope of the fiscal year. ', ['date_stop'])
182 ]
183
184- def next(self, cr, uid, period, step, context={}):
185+ def next(self, cr, uid, period, step, context=None):
186 ids = self.search(cr, uid, [('date_start','>',period.date_start)])
187 if len(ids)>=step:
188 return ids[step-1]
189 return False
190
191- def find(self, cr, uid, dt=None, context={}):
192+ def find(self, cr, uid, dt=None, context=None):
193 if not dt:
194 dt = time.strftime('%Y-%m-%d')
195 #CHECKME: shouldn't we check the state of the period?
196@@ -906,7 +902,7 @@
197 cr.execute('update account_period set state=%s where id=%s', (mode, id))
198 return True
199
200- def name_search(self, cr, user, name, args=None, operator='ilike', context={}, limit=80):
201+ def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
202 if args is None:
203 args = []
204 if context is None:
205@@ -918,7 +914,7 @@
206 ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit)
207 return self.name_get(cr, user, ids, context=context)
208
209- def write(self, cr, uid, ids, vals, context={}):
210+ def write(self, cr, uid, ids, vals, context=None):
211 if 'company_id' in vals:
212 move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)])
213 if move_lines:
214@@ -944,7 +940,7 @@
215 _name = "account.journal.period"
216 _description = "Journal Period"
217
218- def _icon_get(self, cr, uid, ids, field_name, arg=None, context={}):
219+ def _icon_get(self, cr, uid, ids, field_name, arg=None, context=None):
220 result = {}.fromkeys(ids, 'STOCK_NEW')
221 for r in self.read(cr, uid, ids, ['state']):
222 result[r['id']] = {
223@@ -966,28 +962,28 @@
224 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company')
225 }
226
227- def _check(self, cr, uid, ids, context={}):
228- for obj in self.browse(cr, uid, ids, context):
229+ def _check(self, cr, uid, ids, context=None):
230+ for obj in self.browse(cr, uid, ids, context=context):
231 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))
232 res = cr.fetchall()
233 if res:
234 raise osv.except_osv(_('Error !'), _('You can not modify/delete a journal with entries for this period !'))
235 return True
236
237- def write(self, cr, uid, ids, vals, context={}):
238- self._check(cr, uid, ids, context)
239- return super(account_journal_period, self).write(cr, uid, ids, vals, context)
240+ def write(self, cr, uid, ids, vals, context=None):
241+ self._check(cr, uid, ids, context=context)
242+ return super(account_journal_period, self).write(cr, uid, ids, vals, context=context)
243
244- def create(self, cr, uid, vals, context={}):
245+ def create(self, cr, uid, vals, context=None):
246 period_id=vals.get('period_id',False)
247 if period_id:
248- period = self.pool.get('account.period').browse(cr, uid,period_id)
249+ period = self.pool.get('account.period').browse(cr, uid, period_id, context=context)
250 vals['state']=period.state
251 return super(account_journal_period, self).create(cr, uid, vals, context)
252
253- def unlink(self, cr, uid, ids, context={}):
254- self._check(cr, uid, ids, context)
255- return super(account_journal_period, self).unlink(cr, uid, ids, context)
256+ def unlink(self, cr, uid, ids, context=None):
257+ self._check(cr, uid, ids, context=context)
258+ return super(account_journal_period, self).unlink(cr, uid, ids, context=context)
259
260 _defaults = {
261 'state': 'draft',
262@@ -1038,8 +1034,6 @@
263
264 if not args:
265 args = []
266- if not context:
267- context = {}
268 ids = []
269 if name:
270 ids += self.search(cr, user, [('name','ilike',name)]+args, limit=limit, context=context)
271@@ -1058,7 +1052,7 @@
272 if not ids:
273 return []
274 res = []
275- data_move = self.pool.get('account.move').browse(cursor,user,ids)
276+ data_move = self.pool.get('account.move').browse(cursor, user, ids, context=context)
277 for move in data_move:
278 if move.state=='draft':
279 name = '*' + str(move.id)
280@@ -1067,7 +1061,7 @@
281 res.append((move.id, name))
282 return res
283
284- def _get_period(self, cr, uid, context):
285+ def _get_period(self, cr, uid, context=None):
286 periods = self.pool.get('account.period').find(cr, uid)
287 if periods:
288 return periods[0]
289@@ -1128,8 +1122,8 @@
290 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
291 }
292
293- def _check_centralisation(self, cursor, user, ids):
294- for move in self.browse(cursor, user, ids):
295+ def _check_centralisation(self, cursor, user, ids, context=None):
296+ for move in self.browse(cursor, user, ids, context=context):
297 if move.journal_id.centralisation:
298 move_ids = self.search(cursor, user, [
299 ('period_id', '=', move.period_id.id),
300@@ -1139,8 +1133,8 @@
301 return False
302 return True
303
304- def _check_period_journal(self, cursor, user, ids):
305- for move in self.browse(cursor, user, ids):
306+ def _check_period_journal(self, cursor, user, ids, context=None):
307+ for move in self.browse(cursor, user, ids, context=context):
308 for line in move.line_id:
309 if line.period_id.id != move.period_id.id:
310 return False
311@@ -1166,7 +1160,7 @@
312 if not valid_moves:
313 raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !'))
314 obj_sequence = self.pool.get('ir.sequence')
315- for move in self.browse(cr, uid, valid_moves):
316+ for move in self.browse(cr, uid, valid_moves, context=context):
317 if move.name =='/':
318 new_name = False
319 journal = move.journal_id
320@@ -1191,7 +1185,7 @@
321 return True
322
323 def button_validate(self, cursor, user, ids, context=None):
324- for move in self.browse(cursor, user, ids):
325+ for move in self.browse(cursor, user, ids, context=context):
326 top = None
327 for line in move.line_id:
328 account = line.account_id
329@@ -1204,8 +1198,8 @@
330 raise osv.except_osv(_('Error !'), _('You cannot validate a Journal Entry unless all journal items are in same chart of accounts !'))
331 return self.post(cursor, user, ids, context=context)
332
333- def button_cancel(self, cr, uid, ids, context={}):
334- for line in self.browse(cr, uid, ids, context):
335+ def button_cancel(self, cr, uid, ids, context=None):
336+ for line in self.browse(cr, uid, ids, context=context):
337 if not line.journal_id.update_posted:
338 raise osv.except_osv(_('Error !'), _('You can not modify a posted entry of this journal !\nYou should set the journal to allow cancelling entries if you want to do that.'))
339 if ids:
340@@ -1214,18 +1208,21 @@
341 'WHERE id IN %s', ('draft', tuple(ids),))
342 return True
343
344- def write(self, cr, uid, ids, vals, context={}):
345+ def write(self, cr, uid, ids, vals, context=None):
346+ if context is None:
347+ context = {}
348 c = context.copy()
349 c['novalidate'] = True
350 result = super(osv.osv, self).write(cr, uid, ids, vals, c)
351- self.validate(cr, uid, ids, context)
352+ self.validate(cr, uid, ids, context=context)
353 return result
354
355 #
356 # TODO: Check if period is closed !
357 #
358 def create(self, cr, uid, vals, context=None):
359- context = context or {}
360+ if context is None:
361+ context = {}
362 if 'line_id' in vals and context.get('copy'):
363 for l in vals['line_id']:
364 if not l[0]:
365@@ -1265,8 +1262,9 @@
366 result = super(account_move, self).create(cr, uid, vals, context)
367 return result
368
369- def copy(self, cr, uid, id, default={}, context={}):
370- context = context or {}
371+ def copy(self, cr, uid, id, default={}, context=None):
372+ if context is None:
373+ context = {}
374 default.update({
375 'state':'draft',
376 'name':'/',
377@@ -1277,10 +1275,9 @@
378 return super(account_move, self).copy(cr, uid, id, default, context)
379
380 def unlink(self, cr, uid, ids, context=None, check=True):
381- context = context or {}
382 toremove = []
383 obj_move_line = self.pool.get('account.move.line')
384- for move in self.browse(cr, uid, ids, context):
385+ for move in self.browse(cr, uid, ids, context=context):
386 if move['state'] != 'draft':
387 raise osv.except_osv(_('UserError'),
388 _('You can not delete posted movement: "%s"!') % \
389@@ -1294,8 +1291,8 @@
390 result = super(account_move, self).unlink(cr, uid, toremove, context)
391 return result
392
393- def _compute_balance(self, cr, uid, id, context={}):
394- move = self.browse(cr, uid, [id])[0]
395+ def _compute_balance(self, cr, uid, id, context=None):
396+ move = self.browse(cr, uid, id, context=context)
397 amount = 0
398 for line in move.line_id:
399 amount+= (line.debit - line.credit)
400@@ -1358,7 +1355,7 @@
401 #
402 # Validate a balanced move. If it is a centralised journal, create a move.
403 #
404- def validate(self, cr, uid, ids, context={}):
405+ def validate(self, cr, uid, ids, context=None):
406 if context and ('__last_update' in context):
407 del context['__last_update']
408
409@@ -1472,9 +1469,9 @@
410 _defaults = {
411 'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
412 }
413- def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}):
414+ def reconcile_partial_check(self, cr, uid, ids, type='auto', context=None):
415 total = 0.0
416- for rec in self.browse(cr, uid, ids, context):
417+ for rec in self.browse(cr, uid, ids, context=context):
418 for line in rec.line_partial_ids:
419 total += (line.debit or 0.0) - (line.credit or 0.0)
420 if not total:
421@@ -1488,7 +1485,7 @@
422 if not ids:
423 return []
424 result = []
425- for r in self.browse(cr, uid, ids, context):
426+ for r in self.browse(cr, uid, ids, context=context):
427 total = reduce(lambda y,t: (t.debit or 0.0) - (t.credit or 0.0) + y, r.line_partial_ids, 0.0)
428 if total:
429 name = '%s (%.2f)' % (r.name, total)
430@@ -1537,7 +1534,7 @@
431 (parent_ids,) + where_params)
432 res=dict(cr.fetchall())
433 obj_precision = self.pool.get('decimal.precision')
434- for record in self.browse(cr, uid, ids, context):
435+ for record in self.browse(cr, uid, ids, context=context):
436 def _rec_get(record):
437 amount = res.get(record.id, 0.0)
438 for rec in record.child_ids:
439@@ -1619,7 +1616,7 @@
440 return [(x['id'], (x['code'] and (x['code'] + ' - ') or '') + x['name']) \
441 for x in reads]
442
443- def _default_company(self, cr, uid, context={}):
444+ def _default_company(self, cr, uid, context=None):
445 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
446 if user.company_id:
447 return user.company_id.id
448@@ -1723,7 +1720,7 @@
449 """
450 if not args:
451 args = []
452- if not context:
453+ if context is None:
454 context = {}
455 ids = []
456 if name:
457@@ -2062,7 +2059,7 @@
458 raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
459 period_id = period_id[0]
460
461- for model in self.browse(cr, uid, ids, context):
462+ for model in self.browse(cr, uid, ids, context=context):
463 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')}
464 move_id = account_move_obj.create(cr, uid, {
465 'ref': entry['name'],
466@@ -2168,13 +2165,13 @@
467 'period_nbr': 1,
468 'state': 'draft',
469 }
470- def state_draft(self, cr, uid, ids, context={}):
471+ def state_draft(self, cr, uid, ids, context=None):
472 self.write(cr, uid, ids, {'state':'draft'})
473 return False
474
475- def check(self, cr, uid, ids, context={}):
476+ def check(self, cr, uid, ids, context=None):
477 todone = []
478- for sub in self.browse(cr, uid, ids, context):
479+ for sub in self.browse(cr, uid, ids, context=context):
480 ok = True
481 for line in sub.lines_id:
482 if not line.move_id.id:
483@@ -2186,9 +2183,9 @@
484 self.write(cr, uid, todone, {'state':'done'})
485 return False
486
487- def remove_line(self, cr, uid, ids, context={}):
488+ def remove_line(self, cr, uid, ids, context=None):
489 toremove = []
490- for sub in self.browse(cr, uid, ids, context):
491+ for sub in self.browse(cr, uid, ids, context=context):
492 for line in sub.lines_id:
493 if not line.move_id.id:
494 toremove.append(line.id)
495@@ -2197,8 +2194,8 @@
496 self.write(cr, uid, ids, {'state':'draft'})
497 return False
498
499- def compute(self, cr, uid, ids, context={}):
500- for sub in self.browse(cr, uid, ids, context):
501+ def compute(self, cr, uid, ids, context=None):
502+ for sub in self.browse(cr, uid, ids, context=context):
503 ds = sub.date_start
504 for i in range(sub.period_total):
505 self.pool.get('account.subscription.line').create(cr, uid, {
506@@ -2296,10 +2293,10 @@
507 ]
508
509
510- def name_get(self, cr, uid, ids, context={}):
511+ def name_get(self, cr, uid, ids, context=None):
512 if not ids:
513 return []
514- reads = self.read(cr, uid, ids, ['name','code'], context)
515+ reads = self.read(cr, uid, ids, ['name','code'], context=context)
516 res = []
517 for record in reads:
518 name = record['name']
519@@ -2316,7 +2313,7 @@
520 With the 'nocreate' option, some accounts may not be created. Use this to add them later."""
521 _name = 'account.addtmpl.wizard'
522
523- def _get_def_cparent(self, cr, uid, context):
524+ def _get_def_cparent(self, cr, uid, context=None):
525 acc_obj=self.pool.get('account.account')
526 tmpl_obj=self.pool.get('account.account.template')
527 tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
528@@ -2338,6 +2335,8 @@
529 }
530
531 def action_create(self,cr,uid,ids,context=None):
532+ if context is None:
533+ context = {}
534 acc_obj = self.pool.get('account.account')
535 tmpl_obj = self.pool.get('account.account.template')
536 data = self.read(cr, uid, ids)
537@@ -2463,16 +2462,16 @@
538 'price_include': fields.boolean('Tax Included in Price', help="Check this if the price you use on the product and invoices includes this tax."),
539 }
540
541- def name_get(self, cr, uid, ids, context={}):
542+ def name_get(self, cr, uid, ids, context=None):
543 if not ids:
544 return []
545 res = []
546- for record in self.read(cr, uid, ids, ['description','name'], context):
547+ for record in self.read(cr, uid, ids, ['description','name'], context=context):
548 name = record['description'] and record['description'] or record['name']
549 res.append((record['id'],name ))
550 return res
551
552- def _default_company(self, cr, uid, context={}):
553+ def _default_company(self, cr, uid, context=None):
554 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
555 if user.company_id:
556 return user.company_id.id
557@@ -2579,7 +2578,7 @@
558 res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False
559 return res
560
561- def _get_chart(self, cr, uid, context={}):
562+ def _get_chart(self, cr, uid, context=None):
563 ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context)
564 if ids:
565 return ids[0]
566@@ -2625,7 +2624,7 @@
567 #create all the tax code
568 children_tax_code_template = self.pool.get('account.tax.code.template').search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
569 children_tax_code_template.sort()
570- for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template):
571+ for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template, context=context):
572 vals={
573 'name': (tax_code_root_id == tax_code_template.id) and obj_multi.company_id.name or tax_code_template.name,
574 'code': tax_code_template.code,
575@@ -2682,7 +2681,7 @@
576
577 children_acc_template = obj_acc_template.search(cr, uid, [('parent_id','child_of',[obj_acc_root.id]),('nocreate','!=',True)])
578 children_acc_template.sort()
579- for account_template in obj_acc_template.browse(cr, uid, children_acc_template):
580+ for account_template in obj_acc_template.browse(cr, uid, children_acc_template,context=context):
581 tax_ids = []
582 for tax in account_template.tax_ids:
583 tax_ids.append(tax_template_ref[tax.id])
584@@ -2722,7 +2721,7 @@
585 # Creating Journals Sales and Purchase
586 vals_journal={}
587 data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
588- data = obj_data.browse(cr, uid, data_id[0])
589+ data = obj_data.browse(cr, uid, data_id[0], context=context)
590 view_id = data.res_id
591
592 seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0]
593@@ -2835,11 +2834,11 @@
594
595 # Bank Journals
596 data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
597- data = obj_data.browse(cr, uid, data_id[0])
598+ data = obj_data.browse(cr, uid, data_id[0], context=context)
599 view_id_cash = data.res_id
600
601 data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')])
602- data = obj_data.browse(cr, uid, data_id[0])
603+ data = obj_data.browse(cr, uid, data_id[0], context=context)
604 view_id_cur = data.res_id
605 ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
606
607@@ -2932,7 +2931,7 @@
608 obj_tax_fp = self.pool.get('account.fiscal.position.tax')
609 obj_ac_fp = self.pool.get('account.fiscal.position.account')
610
611- for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
612+ for position in obj_fiscal_position_template.browse(cr, uid, fp_ids, context=context):
613
614 vals_fp = {
615 'company_id': company_id,
616
617=== modified file 'account/account_analytic_line.py'
618--- account/account_analytic_line.py 2010-11-10 11:46:09 +0000
619+++ account/account_analytic_line.py 2010-12-13 07:44:48 +0000
620@@ -58,8 +58,8 @@
621 return super(account_analytic_line, self).search(cr, uid, args, offset, limit,
622 order, context=context, count=count)
623
624- def _check_company(self, cr, uid, ids):
625- lines = self.browse(cr, uid, ids)
626+ def _check_company(self, cr, uid, ids, context=None):
627+ lines = self.browse(cr, uid, ids, context=context)
628 for l in lines:
629 if l.move_id and not l.account_id.company_id.id == l.move_id.account_id.company_id.id:
630 return False
631@@ -80,7 +80,7 @@
632 analytic_journal_obj =self.pool.get('account.analytic.journal')
633 product_price_type_obj = self.pool.get('product.price.type')
634 j_id = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
635- prod = product_obj.browse(cr, uid, prod_id)
636+ prod = product_obj.browse(cr, uid, prod_id, context=context)
637 result = 0.0
638
639 if j_id.type <> 'sale':
640@@ -105,13 +105,13 @@
641 flag = False
642 # Compute based on pricetype
643 product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','standard_price')], context=context)
644- pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0]
645+ pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
646 if journal_id:
647- journal = analytic_journal_obj.browse(cr, uid, journal_id)
648+ journal = analytic_journal_obj.browse(cr, uid, journal_id, context=context)
649 if journal.type == 'sale':
650 product_price_type_ids = product_price_type_obj.search(cr, uid, [('field','=','list_price')], context)
651 if product_price_type_ids:
652- pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context)[0]
653+ pricetype = product_price_type_obj.browse(cr, uid, product_price_type_ids, context=context)[0]
654 # Take the company currency as the reference one
655 if pricetype.field == 'list_price':
656 flag = True
657@@ -133,7 +133,9 @@
658 }
659 }
660
661- def view_header_get(self, cr, user, view_id, view_type, context):
662+ def view_header_get(self, cr, user, view_id, view_type, context=None):
663+ if context is None:
664+ context = {}
665 if context.get('account_id', False):
666 # account_id in context may also be pointing to an account.account.id
667 cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],))
668
669=== modified file 'account/account_bank_statement.py'
670--- account/account_bank_statement.py 2010-11-26 15:14:46 +0000
671+++ account/account_bank_statement.py 2010-12-13 07:44:48 +0000
672@@ -46,7 +46,9 @@
673 account_bank_statement_line_obj.write(cr, uid, [line.id], {'sequence': seq}, context=context)
674 return res
675
676- def _default_journal_id(self, cr, uid, context={}):
677+ def _default_journal_id(self, cr, uid, context=None):
678+ if context is None:
679+ context = {}
680 journal_pool = self.pool.get('account.journal')
681 journal_type = context.get('journal_type', False)
682 journal_id = False
683@@ -56,11 +58,11 @@
684 journal_id = ids[0]
685 return journal_id
686
687- def _default_balance_start(self, cr, uid, context={}):
688+ def _default_balance_start(self, cr, uid, context=None):
689 cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
690 res = cr.fetchone()
691 if res:
692- return self.browse(cr, uid, [res[0]], context)[0].balance_end
693+ return self.browse(cr, uid, res[0], context=context).balance_end
694 return 0.0
695
696 def _end_balance(self, cursor, user, ids, name, attr, context=None):
697@@ -95,7 +97,7 @@
698 res[r] = round(res[r], 2)
699 return res
700
701- def _get_period(self, cr, uid, context={}):
702+ def _get_period(self, cr, uid, context=None):
703 periods = self.pool.get('account.period').find(cr, uid)
704 if periods:
705 return periods[0]
706@@ -195,11 +197,13 @@
707 return self.write(cr, uid, ids, {}, context=context)
708
709 def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
710+ if context is None:
711+ context = {}
712 res_currency_obj = self.pool.get('res.currency')
713 account_move_obj = self.pool.get('account.move')
714 account_move_line_obj = self.pool.get('account.move.line')
715 account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
716- st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context)
717+ st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context=context)
718 st = st_line.statement_id
719
720 context.update({'date': st_line.date})
721@@ -299,7 +303,7 @@
722 return st_number + '/' + str(st_line.sequence)
723
724 def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
725- st = self.browse(cr, uid, st_id, context)
726+ st = self.browse(cr, uid, st_id, context=context)
727 if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
728 raise osv.except_osv(_('Error !'),
729 _('The statement balance is incorrect !\n') +
730@@ -318,7 +322,7 @@
731 if context is None:
732 context = {}
733
734- for st in self.browse(cr, uid, ids, context):
735+ for st in self.browse(cr, uid, ids, context=context):
736 j_type = st.journal_id.type
737 company_currency_id = st.journal_id.company_id.currency_id.id
738 if not self.check_status_condition(cr, uid, st.state, journal_type=j_type):
739@@ -360,7 +364,7 @@
740 def button_cancel(self, cr, uid, ids, context=None):
741 done = []
742 account_move_obj = self.pool.get('account.move')
743- for st in self.browse(cr, uid, ids, context):
744+ for st in self.browse(cr, uid, ids, context=context):
745 if st.state=='draft':
746 continue
747 ids = []
748@@ -381,7 +385,7 @@
749 return {'value': {'balance_start': balance_start, 'account_id': account_id}}
750
751 def unlink(self, cr, uid, ids, context=None):
752- stat = self.read(cr, uid, ids, ['state'])
753+ stat = self.read(cr, uid, ids, ['state'], context=context)
754 unlink_ids = []
755 for t in stat:
756 if t['state'] in ('draft'):
757@@ -412,7 +416,7 @@
758 if not partner_id:
759 return res
760 account_id = False
761- line = self.browse(cr, uid, line_id)
762+ line = self.browse(cr, uid, line_id, context=context)
763 if not line or (line and not line[0].account_id):
764 part = obj_partner.browse(cr, uid, partner_id, context=context)
765 if type == 'supplier':
766
767=== modified file 'account/account_cash_statement.py'
768--- account/account_cash_statement.py 2010-11-22 11:03:34 +0000
769+++ account/account_cash_statement.py 2010-12-13 07:44:48 +0000
770@@ -41,7 +41,7 @@
771 @return: Dictionary of values.
772 """
773 res = {}
774- for obj in self.browse(cr, uid, ids):
775+ for obj in self.browse(cr, uid, ids, context=context):
776 res[obj.id] = obj.pieces * obj.number
777 return res
778
779@@ -76,7 +76,7 @@
780 @return: Dictionary of values.
781 """
782 res = {}
783- for statement in self.browse(cr, uid, ids):
784+ for statement in self.browse(cr, uid, ids, context=context):
785 amount_total = 0.0
786
787 if statement.journal_id.type not in('cash'):
788@@ -96,7 +96,7 @@
789 @return: Dictionary of values.
790 """
791 res = {}
792- for statement in self.browse(cr, uid, ids):
793+ for statement in self.browse(cr, uid, ids, context=context):
794 amount_total = 0.0
795 for line in statement.ending_details_ids:
796 amount_total += line.pieces * line.number
797@@ -111,7 +111,7 @@
798 @return: Dictionary of values.
799 """
800 res2 = {}
801- for statement in self.browse(cr, uid, ids):
802+ for statement in self.browse(cr, uid, ids, context=context):
803 encoding_total=0.0
804 for line in statement.line_ids:
805 encoding_total += line.amount
806@@ -160,7 +160,7 @@
807 company_id = company_pool.search(cr, uid, [])
808 return company_id and company_id[0] or False
809
810- def _get_cash_open_box_lines(self, cr, uid, context={}):
811+ def _get_cash_open_box_lines(self, cr, uid, context=None):
812 res = []
813 curr = [1, 2, 5, 10, 20, 50, 100, 500]
814 for rs in curr:
815@@ -173,14 +173,14 @@
816 if journal_ids:
817 results = self.search(cr, uid, [('journal_id', 'in', journal_ids),('state', '=', 'confirm')], context=context)
818 if results:
819- cash_st = self.browse(cr, uid, results, context)[0]
820+ cash_st = self.browse(cr, uid, results, context=context)[0]
821 for cash_line in cash_st.ending_details_ids:
822 for r in res:
823 if cash_line.pieces == r['pieces']:
824 r['number'] = cash_line.number
825 return res
826
827- def _get_default_cash_close_box_lines(self, cr, uid, context={}):
828+ def _get_default_cash_close_box_lines(self, cr, uid, context=None):
829 res = []
830 curr = [1, 2, 5, 10, 20, 50, 100, 500]
831 for rs in curr:
832@@ -191,7 +191,7 @@
833 res.append(dct)
834 return res
835
836- def _get_cash_close_box_lines(self, cr, uid, context={}):
837+ def _get_cash_close_box_lines(self, cr, uid, context=None):
838 res = []
839 curr = [1, 2, 5, 10, 20, 50, 100, 500]
840 for rs in curr:
841@@ -202,11 +202,11 @@
842 res.append((0, 0, dct))
843 return res
844
845- def _get_cash_open_close_box_lines(self, cr, uid, context={}):
846+ def _get_cash_open_close_box_lines(self, cr, uid, context=None):
847 res = {}
848 start_l = []
849 end_l = []
850- starting_details = self._get_cash_open_box_lines(cr, uid, context)
851+ starting_details = self._get_cash_open_box_lines(cr, uid, context=context)
852 ending_details = self._get_default_cash_close_box_lines(cr, uid, context)
853 for start in starting_details:
854 start_l.append((0, 0, start))
855@@ -248,7 +248,7 @@
856 if open_jrnl:
857 raise osv.except_osv(_('Error'), _('You can not have two open register for the same journal'))
858
859- if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
860+ if self.pool.get('account.journal').browse(cr, uid, vals['journal_id'], context=context).type == 'cash':
861 open_close = self._get_cash_open_close_box_lines(cr, uid, context)
862 if vals.get('starting_details_ids', False):
863 for start in vals.get('starting_details_ids'):
864@@ -283,7 +283,7 @@
865 @return: True on success, False otherwise
866 """
867
868- super(account_cash_statement, self).write(cr, uid, ids, vals)
869+ super(account_cash_statement, self).write(cr, uid, ids, vals, context=context)
870 res = self._get_starting_balance(cr, uid, ids)
871 for rs in res:
872 super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs))
873@@ -338,7 +338,7 @@
874 'state': 'open',
875
876 })
877- self.write(cr, uid, [statement.id], vals)
878+ self.write(cr, uid, [statement.id], vals, context=context)
879 return True
880
881 def balance_check(self, cr, uid, cash_id, journal_type='bank', context=None):
882
883=== modified file 'account/account_move_line.py'
884--- account/account_move_line.py 2010-11-27 20:14:29 +0000
885+++ account/account_move_line.py 2010-12-13 07:44:48 +0000
886@@ -107,9 +107,9 @@
887 del data[f]
888 return data
889
890- def create_analytic_lines(self, cr, uid, ids, context={}):
891+ def create_analytic_lines(self, cr, uid, ids, context=None):
892 acc_ana_line_obj = self.pool.get('account.analytic.line')
893- for obj_line in self.browse(cr, uid, ids, context):
894+ for obj_line in self.browse(cr, uid, ids, context=context):
895 if obj_line.analytic_account_id:
896 if not obj_line.journal_id.analytic_journal_id:
897 raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, ))
898@@ -139,7 +139,9 @@
899 del(data['account_tax_id'])
900 return data
901
902- def convert_to_period(self, cr, uid, context={}):
903+ def convert_to_period(self, cr, uid, context=None):
904+ if context is None:
905+ context = {}
906 period_obj = self.pool.get('account.period')
907 #check if the period_id changed in the context from client side
908 if context.get('period_id', False):
909@@ -151,7 +153,9 @@
910 })
911 return context
912
913- def _default_get(self, cr, uid, fields, context={}):
914+ def _default_get(self, cr, uid, fields, context=None):
915+ if context is None:
916+ context = {}
917 if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
918 context['journal_id'] = context.get('search_default_journal_id')
919 account_obj = self.pool.get('account.account')
920@@ -164,7 +168,7 @@
921 currency_obj = self.pool.get('res.currency')
922 context = self.convert_to_period(cr, uid, context)
923 # Compute simple values
924- data = super(account_move_line, self).default_get(cr, uid, fields, context)
925+ data = super(account_move_line, self).default_get(cr, uid, fields, context=context)
926 # Starts: Manual entry from account.move form
927 if context.get('lines',[]):
928 total_new = 0.00
929@@ -174,7 +178,7 @@
930 for item in i[2]:
931 data[item] = i[2][item]
932 if context['journal']:
933- journal_data = journal_obj.browse(cr, uid, context['journal'])
934+ journal_data = journal_obj.browse(cr, uid, context['journal'], context=context)
935 if journal_data.type == 'purchase':
936 if total_new > 0:
937 account = journal_data.default_credit_account_id
938@@ -186,9 +190,9 @@
939 else:
940 account = journal_data.default_debit_account_id
941 if account and ((not fields) or ('debit' in fields) or ('credit' in fields)) and 'partner_id' in data and (data['partner_id']):
942- part = partner_obj.browse(cr, uid, data['partner_id'])
943+ part = partner_obj.browse(cr, uid, data['partner_id'], context=context)
944 account = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, account.id)
945- account = account_obj.browse(cr, uid, account)
946+ account = account_obj.browse(cr, uid, account, context=context)
947 data['account_id'] = account.id
948
949 s = -total_new
950@@ -236,7 +240,7 @@
951 return data
952 total = 0
953 ref_id = False
954- move = move_obj.browse(cr, uid, move_id, context)
955+ move = move_obj.browse(cr, uid, move_id, context=context)
956 if 'name' in fields:
957 data.setdefault('name', move.line_id[-1].name)
958 acc1 = False
959@@ -265,7 +269,7 @@
960 # part = False is acceptable for fiscal position.
961 account = fiscal_pos_obj.map_account(cr, uid, part and part.property_account_position or False, account.id)
962 if account:
963- account = account_obj.browse(cr, uid, account)
964+ account = account_obj.browse(cr, uid, account, context=context)
965
966 if account and ((not fields) or ('debit' in fields) or ('credit' in fields)):
967 data['account_id'] = account.id
968@@ -289,10 +293,10 @@
969 data['amount_currency'] = v
970 return data
971
972- def on_create_write(self, cr, uid, id, context={}):
973+ def on_create_write(self, cr, uid, id, context=None):
974 if not id:
975 return []
976- ml = self.browse(cr, uid, id, context)
977+ ml = self.browse(cr, uid, id, context=context)
978 return map(lambda x: x.id, ml.move_id.line_id)
979
980 def _balance(self, cr, uid, ids, name, arg, context=None):
981@@ -334,11 +338,11 @@
982 res[line_id] = (invoice_id, invoice_names[invoice_id])
983 return res
984
985- def name_get(self, cr, uid, ids, context={}):
986+ def name_get(self, cr, uid, ids, context=None):
987 if not ids:
988 return []
989 result = []
990- for line in self.browse(cr, uid, ids, context):
991+ for line in self.browse(cr, uid, ids, context=context):
992 if line.ref:
993 result.append((line.id, (line.move_id.name or '')+' ('+line.ref+')'))
994 else:
995@@ -454,6 +458,8 @@
996 }
997
998 def _get_date(self, cr, uid, context=None):
999+ if context is None:
1000+ context or {}
1001 period_obj = self.pool.get('account.period')
1002 dt = time.strftime('%Y-%m-%d')
1003 if ('journal_id' in context) and ('period_id' in context):
1004@@ -495,35 +501,35 @@
1005 ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in accounting entry !'),
1006 ]
1007
1008- def _auto_init(self, cr, context={}):
1009- super(account_move_line, self)._auto_init(cr, context)
1010+ def _auto_init(self, cr, context=None):
1011+ super(account_move_line, self)._auto_init(cr, context=context)
1012 cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
1013 if not cr.fetchone():
1014 cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
1015
1016- def _check_no_view(self, cr, uid, ids):
1017- lines = self.browse(cr, uid, ids)
1018+ def _check_no_view(self, cr, uid, ids, context=None):
1019+ lines = self.browse(cr, uid, ids, context=context)
1020 for l in lines:
1021 if l.account_id.type == 'view':
1022 return False
1023 return True
1024
1025- def _check_no_closed(self, cr, uid, ids):
1026- lines = self.browse(cr, uid, ids)
1027+ def _check_no_closed(self, cr, uid, ids, context=None):
1028+ lines = self.browse(cr, uid, ids, context=context)
1029 for l in lines:
1030 if l.account_id.type == 'closed':
1031 return False
1032 return True
1033
1034- def _check_company_id(self, cr, uid, ids):
1035- lines = self.browse(cr, uid, ids)
1036+ def _check_company_id(self, cr, uid, ids, context=None):
1037+ lines = self.browse(cr, uid, ids, context=context)
1038 for l in lines:
1039 if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:
1040 return False
1041 return True
1042
1043- def _check_partner_id(self, cr, uid, ids):
1044- lines = self.browse(cr, uid, ids)
1045+ def _check_partner_id(self, cr, uid, ids, context=None):
1046+ lines = self.browse(cr, uid, ids, context=context)
1047 for l in lines:
1048 if l.account_id.type in ('receivable', 'payable') and not l.partner_id:
1049 return False
1050@@ -546,7 +552,7 @@
1051 if (not currency_id) or (not account_id):
1052 return {}
1053 result = {}
1054- acc = account_obj.browse(cr, uid, account_id)
1055+ acc = account_obj.browse(cr, uid, account_id, context=context)
1056 if (amount>0) and journal:
1057 x = journal_obj.browse(cr, uid, journal).default_credit_account_id
1058 if x: acc = x
1059@@ -662,7 +668,7 @@
1060 raise osv.except_osv(_('Warning !'), _('To reconcile the entries company should be the same for all entries'))
1061 company_list.append(line.company_id.id)
1062
1063- for line in self.browse(cr, uid, ids, context):
1064+ for line in self.browse(cr, uid, ids, context=context):
1065 if line.reconcile_id:
1066 raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
1067 if line.reconcile_partial_id:
1068@@ -808,8 +814,10 @@
1069 partner_obj.write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
1070 return r_id
1071
1072- def view_header_get(self, cr, user, view_id, view_type, context):
1073- context = self.convert_to_period(cr, user, context)
1074+ def view_header_get(self, cr, user, view_id, view_type, context=None):
1075+ if context is None:
1076+ context = {}
1077+ context = self.convert_to_period(cr, user, context=context)
1078 if context.get('account_id', False):
1079 cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], ))
1080 res = cr.fetchone()
1081@@ -825,7 +833,7 @@
1082 return j+(p and (':'+p) or '')
1083 return False
1084
1085- def onchange_date(self, cr, user, ids, date, context={}):
1086+ def onchange_date(self, cr, user, ids, date, context=None):
1087 """
1088 Returns a dict that contains new values and context
1089 @param cr: A database cursor
1090@@ -836,6 +844,8 @@
1091 @return: Returns a dict which contains new values, and context
1092 """
1093 res = {}
1094+ if context is None:
1095+ context = {}
1096 period_pool = self.pool.get('account.period')
1097 pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
1098 if pids:
1099@@ -850,9 +860,11 @@
1100 'context':context,
1101 }
1102
1103- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
1104+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
1105 journal_pool = self.pool.get('account.journal')
1106- result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
1107+ if context is None:
1108+ context = {}
1109+ result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
1110 if view_type != 'tree':
1111 #Remove the toolbar from the form view
1112 if view_type == 'form':
1113@@ -871,7 +883,7 @@
1114 xml = '''<?xml version="1.0"?>\n<tree string="%s" editable="top" refresh="5" on_write="on_create_write" colors="red:state==\'draft\';black:state==\'valid\'">\n\t''' % (title)
1115
1116 ids = journal_pool.search(cr, uid, [])
1117- journals = journal_pool.browse(cr, uid, ids)
1118+ journals = journal_pool.browse(cr, uid, ids, context=context)
1119 all_journal = [None]
1120 common_fields = {}
1121 total = len(journals)
1122@@ -952,8 +964,10 @@
1123 result['fields'] = self.fields_get(cr, uid, flds, context)
1124 return result
1125
1126- def _check_moves(self, cr, uid, context):
1127+ def _check_moves(self, cr, uid, context=None):
1128 # use the first move ever created for this journal and period
1129+ if context is None:
1130+ context = {}
1131 cr.execute('SELECT id, state, name FROM account_move WHERE journal_id = %s AND period_id = %s ORDER BY id limit 1', (context['journal_id'],context['period_id']))
1132 res = cr.fetchone()
1133 if res:
1134@@ -981,11 +995,13 @@
1135 obj_move_rec.unlink(cr, uid, unlink_ids)
1136 return True
1137
1138- def unlink(self, cr, uid, ids, context={}, check=True):
1139+ def unlink(self, cr, uid, ids, context=None, check=True):
1140+ if context is None:
1141+ context = {}
1142 move_obj = self.pool.get('account.move')
1143 self._update_check(cr, uid, ids, context)
1144 result = False
1145- for line in self.browse(cr, uid, ids, context):
1146+ for line in self.browse(cr, uid, ids, context=context):
1147 context['journal_id'] = line.journal_id.id
1148 context['period_id'] = line.period_id.id
1149 result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
1150@@ -1014,9 +1030,9 @@
1151 journal_id = context.get('journal_id', False)
1152 period_id = context.get('period_id', False)
1153 if journal_id:
1154- journal = journal_obj.browse(cr, uid, [journal_id])[0]
1155+ journal = journal_obj.browse(cr, uid, journal_id, context=context)
1156 if journal.allow_date and period_id:
1157- period = period_obj.browse(cr, uid, [period_id])[0]
1158+ period = period_obj.browse(cr, uid, period_id, context=context)
1159 if not time.strptime(vals['date'][:10],'%Y-%m-%d') >= time.strptime(period.date_start, '%Y-%m-%d') or not time.strptime(vals['date'][:10], '%Y-%m-%d') <= time.strptime(period.date_stop, '%Y-%m-%d'):
1160 raise osv.except_osv(_('Error'),_('The date of your Journal Entry is not in the defined period!'))
1161 else:
1162@@ -1069,7 +1085,7 @@
1163 move_obj.write(cr, uid, [line.move_id.id], {'date': todo_date}, context=context)
1164 return result
1165
1166- def _update_journal_check(self, cr, uid, journal_id, period_id, context={}):
1167+ def _update_journal_check(self, cr, uid, journal_id, period_id, context=None):
1168 journal_obj = self.pool.get('account.journal')
1169 period_obj = self.pool.get('account.period')
1170 jour_period_obj = self.pool.get('account.journal.period')
1171@@ -1079,8 +1095,8 @@
1172 if state == 'done':
1173 raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed journal.'))
1174 if not result:
1175- journal = journal_obj.browse(cr, uid, journal_id, context)
1176- period = period_obj.browse(cr, uid, period_id, context)
1177+ journal = journal_obj.browse(cr, uid, journal_id, context=context)
1178+ period = period_obj.browse(cr, uid, period_id, context=context)
1179 jour_period_obj.create(cr, uid, {
1180 'name': (journal.code or journal.name)+':'+(period.name or ''),
1181 'journal_id': journal.id,
1182@@ -1088,9 +1104,9 @@
1183 })
1184 return True
1185
1186- def _update_check(self, cr, uid, ids, context={}):
1187+ def _update_check(self, cr, uid, ids, context=None):
1188 done = {}
1189- for line in self.browse(cr, uid, ids, context):
1190+ for line in self.browse(cr, uid, ids, context=context):
1191 if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
1192 raise osv.except_osv(_('Error !'), _('You can not do this modification on a confirmed entry ! Please note that you can just change some non important fields !'))
1193 if line.reconcile_id:
1194@@ -1127,7 +1143,7 @@
1195
1196 self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
1197 move_id = vals.get('move_id', False)
1198- journal = journal_obj.browse(cr, uid, context['journal_id'])
1199+ journal = journal_obj.browse(cr, uid, context['journal_id'], context=context)
1200 if not move_id:
1201 if journal.centralisation:
1202 #Check for centralisation
1203@@ -1150,7 +1166,7 @@
1204 raise osv.except_osv(_('No piece number !'), _('Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
1205 ok = not (journal.type_control_ids or journal.account_control_ids)
1206 if ('account_id' in vals):
1207- account = account_obj.browse(cr, uid, vals['account_id'])
1208+ account = account_obj.browse(cr, uid, vals['account_id'], context=context)
1209 if journal.type_control_ids:
1210 type = account.user_type
1211 for t in journal.type_control_ids:
1212
1213=== modified file 'account/installer.py'
1214--- account/installer.py 2010-11-16 08:00:18 +0000
1215+++ account/installer.py 2010-12-13 07:44:48 +0000
1216@@ -45,7 +45,7 @@
1217 ids = modules.search(cr, uid, [('category_id', '=', 'Account Charts')], context=context)
1218 charts = list(
1219 sorted(((m.name, m.shortdesc)
1220- for m in modules.browse(cr, uid, ids)),
1221+ for m in modules.browse(cr, uid, ids, context=context)),
1222 key=itemgetter(1)))
1223 charts.insert(0, ('configurable', 'Generic Chart Of Account'))
1224 return charts
1225
1226=== modified file 'account/invoice.py'
1227--- account/invoice.py 2010-11-27 20:16:05 +0000
1228+++ account/invoice.py 2010-12-13 07:44:48 +0000
1229@@ -60,7 +60,7 @@
1230 return res and res[0] or False
1231
1232 def _get_currency(self, cr, uid, context=None):
1233- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
1234+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid], context=context)[0]
1235 if user.company_id:
1236 return user.company_id.currency_id.id
1237 return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=', 1.0)])[0]
1238@@ -89,11 +89,11 @@
1239
1240 def _amount_residual(self, cr, uid, ids, name, args, context=None):
1241 res = {}
1242- cur_obj = self.pool.get('res.currency')
1243- data_inv = self.browse(cr, uid, ids)
1244 if context is None:
1245 context = {}
1246
1247+ cur_obj = self.pool.get('res.currency')
1248+ data_inv = self.browse(cr, uid, ids, context=context)
1249 for inv in data_inv:
1250 debit = credit = 0.0
1251 context.update({'date':inv.date_invoice})
1252@@ -168,7 +168,7 @@
1253
1254 def _compute_lines(self, cr, uid, ids, name, args, context=None):
1255 result = {}
1256- for invoice in self.browse(cr, uid, ids, context):
1257+ for invoice in self.browse(cr, uid, ids, context=context):
1258 src = []
1259 lines = []
1260 if invoice.move_id:
1261@@ -187,7 +187,7 @@
1262
1263 def _get_invoice_from_line(self, cr, uid, ids, context=None):
1264 move = {}
1265- for line in self.pool.get('account.move.line').browse(cr, uid, ids):
1266+ for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
1267 if line.reconcile_partial_id:
1268 for line2 in line.reconcile_partial_id.line_partial_ids:
1269 move[line2.move_id.id] = True
1270@@ -201,7 +201,7 @@
1271
1272 def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
1273 move = {}
1274- for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids):
1275+ for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
1276 for line in r.line_partial_ids:
1277 move[line.move_id.id] = True
1278 for line in r.line_id:
1279@@ -328,6 +328,7 @@
1280 journal_obj = self.pool.get('account.journal')
1281 if context is None:
1282 context = {}
1283+
1284 if context.get('active_model', '') in ['res.partner'] and context.get('active_ids', False) and context['active_ids']:
1285 partner = self.pool.get(context['active_model']).read(cr, uid, context['active_ids'], ['supplier','customer'])[0]
1286 if not view_type:
1287@@ -395,7 +396,7 @@
1288 return True
1289
1290 def unlink(self, cr, uid, ids, context=None):
1291- invoices = self.read(cr, uid, ids, ['state'])
1292+ invoices = self.read(cr, uid, ids, ['state'], context=context)
1293 unlink_ids = []
1294 for t in invoices:
1295 if t['state'] in ('draft', 'cancel'):
1296@@ -675,7 +676,7 @@
1297
1298 def button_compute(self, cr, uid, ids, context=None, set_total=False):
1299 self.button_reset_taxes(cr, uid, ids, context)
1300- for inv in self.browse(cr, uid, ids):
1301+ for inv in self.browse(cr, uid, ids, context=context):
1302 if set_total:
1303 self.pool.get('account.invoice').write(cr, uid, [inv.id], {'check_total': inv.amount_total})
1304 return True
1305@@ -987,7 +988,7 @@
1306 #TODO: not correct fix but required a frech values before reading it.
1307 self.write(cr, uid, ids, {})
1308
1309- for obj_inv in self.browse(cr, uid, ids):
1310+ for obj_inv in self.browse(cr, uid, ids, context=context):
1311 id = obj_inv.id
1312 invtype = obj_inv.type
1313 number = obj_inv.number
1314@@ -1155,7 +1156,7 @@
1315 context = {}
1316 #TODO check if we can use different period for payment and the writeoff line
1317 assert len(ids)==1, "Can only pay one invoice at a time"
1318- invoice = self.browse(cr, uid, ids[0])
1319+ invoice = self.browse(cr, uid, ids[0], context=context)
1320 src_account_id = invoice.account_id.id
1321 # Take the seq as name for move
1322 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
1323@@ -1319,9 +1320,9 @@
1324 return {'value': {'categ_id': False}, 'domain':{'product_uom':[]}}
1325 else:
1326 return {'value': {'price_unit': 0.0, 'categ_id': False}, 'domain':{'product_uom':[]}}
1327- part = self.pool.get('res.partner').browse(cr, uid, partner_id)
1328+ part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
1329 fpos_obj = self.pool.get('account.fiscal.position')
1330- fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id) or False
1331+ fpos = fposition_id and fpos_obj.browse(cr, uid, fposition_id, context=context) or False
1332
1333 if part.lang:
1334 context.update({'lang': part.lang})
1335@@ -1351,7 +1352,7 @@
1336 # Parse the value_reference field to get the ID of the account.account record
1337 account_id = int (my_value[0]["value_reference"].split(",")[1])
1338 # Use the ID of the account.account record in the browse for the account.account record
1339- app_acc_in = account_obj.browse(cr, uid, [account_id])[0]
1340+ app_acc_in = account_obj.browse(cr, uid, account_id, context=context)
1341 if not exp_pro_id:
1342 ex_acc = res.product_tmpl_id.property_account_expense
1343 ex_acc_cate = res.categ_id.property_account_expense_categ
1344@@ -1360,7 +1361,7 @@
1345 else:
1346 app_acc_exp = ex_acc_cate
1347 else:
1348- app_acc_exp = account_obj.browse(cr, uid, exp_pro_id)[0]
1349+ app_acc_exp = account_obj.browse(cr, uid, exp_pro_id, context=context)[0]
1350 if not in_pro_id and not exp_pro_id:
1351 in_acc = res.product_tmpl_id.property_account_income
1352 in_acc_cate = res.categ_id.property_account_income_categ
1353@@ -1378,8 +1379,8 @@
1354 if not in_res_id and not exp_res_id:
1355 raise osv.except_osv(_('Configuration Error !'),
1356 _('Can not find account chart for this company, Please Create account.'))
1357- in_obj_acc = account_obj.browse(cr, uid, in_res_id)
1358- exp_obj_acc = account_obj.browse(cr, uid, exp_res_id)
1359+ in_obj_acc = account_obj.browse(cr, uid, in_res_id, context=context)
1360+ exp_obj_acc = account_obj.browse(cr, uid, exp_res_id, context=context)
1361 if in_acc or ex_acc:
1362 res.product_tmpl_id.property_account_income = in_obj_acc[0]
1363 res.product_tmpl_id.property_account_expense = exp_obj_acc[0]
1364@@ -1427,8 +1428,8 @@
1365 if not company_id or not currency_id:
1366 return res_final
1367
1368- company = self.pool.get('res.company').browse(cr, uid, company_id)
1369- currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
1370+ company = self.pool.get('res.company').browse(cr, uid, company_id, context=context)
1371+ currency = self.pool.get('res.currency').browse(cr, uid, currency_id, context=context)
1372
1373 if company.currency_id.id != currency.id:
1374 new_price = res_final['value']['price_unit'] * currency.rate
1375@@ -1453,7 +1454,9 @@
1376 res = []
1377 tax_obj = self.pool.get('account.tax')
1378 cur_obj = self.pool.get('res.currency')
1379- inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
1380+ if context is None:
1381+ context = {}
1382+ inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
1383 company_currency = inv.company_id.currency_id.id
1384
1385 for line in inv.invoice_line:
1386@@ -1584,11 +1587,11 @@
1387 'base_amount': 0.0,
1388 'tax_amount': 0.0,
1389 }
1390- def compute(self, cr, uid, invoice_id, context={}):
1391+ def compute(self, cr, uid, invoice_id, context=None):
1392 tax_grouped = {}
1393 tax_obj = self.pool.get('account.tax')
1394 cur_obj = self.pool.get('res.currency')
1395- inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context)
1396+ inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
1397 cur = inv.currency_id
1398 company_currency = inv.company_id.currency_id.id
1399
1400
1401=== modified file 'account/partner.py'
1402--- account/partner.py 2010-10-15 07:14:33 +0000
1403+++ account/partner.py 2010-12-13 07:44:48 +0000
1404@@ -34,7 +34,7 @@
1405 'note': fields.text('Notes', translate=True),
1406 }
1407
1408- def map_tax(self, cr, uid, fposition_id, taxes, context={}):
1409+ def map_tax(self, cr, uid, fposition_id, taxes, context=None):
1410 if not taxes:
1411 return []
1412 if not fposition_id:
1413@@ -51,7 +51,7 @@
1414 result.append(t.id)
1415 return result
1416
1417- def map_account(self, cr, uid, fposition_id, account_id, context={}):
1418+ def map_account(self, cr, uid, fposition_id, account_id, context=None):
1419 if not fposition_id:
1420 return account_id
1421 for pos in fposition_id.account_ids:
1422@@ -134,10 +134,10 @@
1423 return [('id','=','0')]
1424 return [('id','in',map(itemgetter(0), res))]
1425
1426- def _credit_search(self, cr, uid, obj, name, args, context):
1427+ def _credit_search(self, cr, uid, obj, name, args, context=None):
1428 return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context)
1429
1430- def _debit_search(self, cr, uid, obj, name, args, context):
1431+ def _debit_search(self, cr, uid, obj, name, args, context=None):
1432 return self._asset_difference_search(cr, uid, obj, name, 'payable', args, context=context)
1433
1434 _columns = {
1435
1436=== modified file 'account/project/wizard/project_account_analytic_line.py'
1437--- account/project/wizard/project_account_analytic_line.py 2010-10-28 08:35:00 +0000
1438+++ account/project/wizard/project_account_analytic_line.py 2010-12-13 07:44:48 +0000
1439@@ -29,7 +29,7 @@
1440 'to_date': fields.date('To'),
1441 }
1442
1443- def action_open_window(self, cr, uid, ids, context={}):
1444+ def action_open_window(self, cr, uid, ids, context=None):
1445 mod_obj =self.pool.get('ir.model.data')
1446 domain = []
1447 data = self.read(cr, uid, ids, [])[0]
1448
1449=== modified file 'account/report/account_report.py'
1450--- account/report/account_report.py 2010-10-15 07:19:39 +0000
1451+++ account/report/account_report.py 2010-12-13 07:44:48 +0000
1452@@ -27,7 +27,7 @@
1453 import tools
1454 from osv import fields,osv
1455
1456-def _code_get(self, cr, uid, context={}):
1457+def _code_get(self, cr, uid, context=None):
1458 acc_type_obj = self.pool.get('account.account.type')
1459 ids = acc_type_obj.search(cr, uid, [])
1460 res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
1461@@ -98,9 +98,9 @@
1462 res = super(report_aged_receivable, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
1463 return res
1464
1465- def _calc_bal(self, cr, uid, ids, name, args, context):
1466+ def _calc_bal(self, cr, uid, ids, name, args, context=None):
1467 res = {}
1468- for period in self.read(cr,uid,ids,['name']):
1469+ for period in self.read(cr, uid, ids, ['name'], context=context):
1470 date1,date2 = period['name'].split(' to ')
1471 cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
1472 WHERE (line.account_id=ac.id) AND ac.type='receivable' \
1473
1474=== modified file 'account/wizard/account_automatic_reconcile.py'
1475--- account/wizard/account_automatic_reconcile.py 2010-11-04 12:42:42 +0000
1476+++ account/wizard/account_automatic_reconcile.py 2010-12-13 07:44:48 +0000
1477@@ -42,10 +42,14 @@
1478 'allow_write_off': fields.boolean('Allow write off')
1479 }
1480
1481- def _get_reconciled(self, cr, uid, context={}):
1482+ def _get_reconciled(self, cr, uid, context=None):
1483+ if context is None:
1484+ context = {}
1485 return context.get('reconciled', 0)
1486
1487- def _get_unreconciled(self, cr, uid, context={}):
1488+ def _get_unreconciled(self, cr, uid, context=None):
1489+ if context is None:
1490+ context = {}
1491 return context.get('unreconciled', 0)
1492
1493 _defaults = {
1494@@ -175,7 +179,7 @@
1495 if allow_write_off:
1496 move_line_obj.reconcile(cr, uid, line_ids, 'auto', form['writeoff_acc_id'], form['period_id'], form['journal_id'], context)
1497 else:
1498- move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context={})
1499+ move_line_obj.reconcile_partial(cr, uid, line_ids, 'manual', context=context)
1500
1501 # get the list of partners who have more than one unreconciled transaction
1502 cr.execute(
1503
1504=== modified file 'account/wizard/account_change_currency.py'
1505--- account/wizard/account_change_currency.py 2010-10-18 06:49:23 +0000
1506+++ account/wizard/account_change_currency.py 2010-12-13 07:44:48 +0000
1507@@ -51,7 +51,7 @@
1508 invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
1509 if invoice.currency_id.id == new_currency:
1510 return {}
1511- rate = obj_currency.browse(cr, uid, new_currency).rate
1512+ rate = obj_currency.browse(cr, uid, new_currency, context=context).rate
1513 for line in invoice.invoice_line:
1514 new_price = 0
1515 if invoice.company_id.currency_id.id == invoice.currency_id.id:
1516
1517=== modified file 'account/wizard/account_invoice_refund.py'
1518--- account/wizard/account_invoice_refund.py 2010-11-04 12:42:42 +0000
1519+++ account/wizard/account_invoice_refund.py 2010-12-13 07:44:48 +0000
1520@@ -93,7 +93,7 @@
1521 date = False
1522 period = False
1523 description = False
1524- company = res_users_obj.browse(cr, uid, uid).company_id
1525+ company = res_users_obj.browse(cr, uid, uid, context=context).company_id
1526 journal_id = form.get('journal_id', False)
1527 for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
1528 if inv.state in ['draft', 'proforma2', 'cancel']:
1529
1530=== modified file 'account/wizard/account_move_bank_reconcile.py'
1531--- account/wizard/account_move_bank_reconcile.py 2010-10-18 06:49:23 +0000
1532+++ account/wizard/account_move_bank_reconcile.py 2010-12-13 07:44:48 +0000
1533@@ -32,13 +32,15 @@
1534 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
1535 }
1536
1537- def action_open_window(self, cr, uid, ids, context={}):
1538+ def action_open_window(self, cr, uid, ids, context=None):
1539 """
1540 @param cr: the current row, from the database cursor,
1541 @param uid: the current user’s ID for security checks,
1542 @param ids: account move bank reconcile’s ID or list of IDs
1543 @return: dictionary of Open account move line on given journal_id.
1544 """
1545+ if context is None:
1546+ context = {}
1547 data = self.read(cr, uid, ids, context=context)[0]
1548 cr.execute('select default_credit_account_id \
1549 from account_journal where id=%s', (data['journal_id'],))
1550
1551=== modified file 'account/wizard/account_move_journal.py'
1552--- account/wizard/account_move_journal.py 2010-11-15 18:46:17 +0000
1553+++ account/wizard/account_move_journal.py 2010-12-13 07:44:48 +0000
1554@@ -29,7 +29,7 @@
1555 _name = "account.move.journal"
1556 _description = "Move journal"
1557
1558- def _get_period(self, cr, uid, context={}):
1559+ def _get_period(self, cr, uid, context=None):
1560 """
1561 Return default account period value
1562 """
1563@@ -40,7 +40,7 @@
1564 period_id = ids[0]
1565 return period_id
1566
1567- def _get_journal(self, cr, uid, context={}):
1568+ def _get_journal(self, cr, uid, context=None):
1569 """
1570 Return journal based on the journal type
1571 """
1572@@ -138,8 +138,8 @@
1573 ids = period_pool.search(cr, uid, [('journal_id', '=', journal_id), ('period_id', '=', period_id)], context=context)
1574
1575 if not ids:
1576- journal = journal_pool.browse(cr, uid, journal_id)
1577- period = account_period_obj.browse(cr, uid, period_id)
1578+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
1579+ period = account_period_obj.browse(cr, uid, period_id, context=context)
1580
1581 name = journal.name
1582 state = period.state
1583
1584=== modified file 'account/wizard/account_move_line_reconcile_select.py'
1585--- account/wizard/account_move_line_reconcile_select.py 2010-10-15 13:35:22 +0000
1586+++ account/wizard/account_move_line_reconcile_select.py 2010-12-13 07:44:48 +0000
1587@@ -30,7 +30,7 @@
1588 domain = [('reconcile', '=', 1)], required=True),
1589 }
1590
1591- def action_open_window(self, cr, uid, ids, context={}):
1592+ def action_open_window(self, cr, uid, ids, context=None):
1593 """
1594 This function Open account move line window for reconcile on given account id
1595 @param cr: the current row, from the database cursor,
1596
1597=== modified file 'account/wizard/account_move_line_select.py'
1598--- account/wizard/account_move_line_select.py 2010-10-28 08:35:00 +0000
1599+++ account/wizard/account_move_line_select.py 2010-12-13 07:44:48 +0000
1600@@ -42,7 +42,7 @@
1601 else:
1602 fiscalyear_ids = [context['fiscalyear']]
1603
1604- fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
1605+ fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids, context=context)
1606
1607 period_ids = []
1608 if fiscalyears:
1609
1610=== modified file 'account/wizard/account_move_line_unreconcile_select.py'
1611--- account/wizard/account_move_line_unreconcile_select.py 2010-10-21 05:47:10 +0000
1612+++ account/wizard/account_move_line_unreconcile_select.py 2010-12-13 07:44:48 +0000
1613@@ -27,7 +27,7 @@
1614 _columns ={
1615 'account_id': fields.many2one('account.account','Account',required=True),
1616 }
1617- def action_open_window(self, cr, uid, ids, context={}):
1618+ def action_open_window(self, cr, uid, ids, context=None):
1619 data = self.read(cr, uid, ids, context=context)[0]
1620 return {
1621 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'],
1622
1623=== modified file 'account/wizard/account_open_closed_fiscalyear.py'
1624--- account/wizard/account_open_closed_fiscalyear.py 2010-10-15 13:35:22 +0000
1625+++ account/wizard/account_open_closed_fiscalyear.py 2010-12-13 07:44:48 +0000
1626@@ -30,12 +30,12 @@
1627 'Fiscal Year to Open', required=True, help='Select Fiscal Year which you want to remove entries for its End of year entries journal'),
1628 }
1629
1630- def remove_entries(self, cr, uid, ids, context={}):
1631+ def remove_entries(self, cr, uid, ids, context=None):
1632 fy_obj = self.pool.get('account.fiscalyear')
1633 move_obj = self.pool.get('account.move')
1634
1635- data = self.read(cr, uid, ids, [])[0]
1636- data_fyear = fy_obj.browse(cr, uid, data['fyear_id'])
1637+ data = self.read(cr, uid, ids, [], context=context)[0]
1638+ data_fyear = fy_obj.browse(cr, uid, data['fyear_id'], context=context)
1639 if not data_fyear.end_journal_period_id:
1640 raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year'))
1641 period_journal = data_fyear.end_journal_period_id
1642
1643=== modified file 'account/wizard/account_reconcile_partner_process.py'
1644--- account/wizard/account_reconcile_partner_process.py 2010-10-18 06:49:23 +0000
1645+++ account/wizard/account_reconcile_partner_process.py 2010-12-13 07:44:48 +0000
1646@@ -73,6 +73,8 @@
1647 return res
1648
1649 def next_partner(self, cr, uid, ids, context=None):
1650+ if context is None:
1651+ context = {}
1652 move_line_obj = self.pool.get('account.move.line')
1653 res_partner_obj = self.pool.get('res.partner')
1654
1655
1656=== modified file 'account/wizard/account_report_balance_sheet.py'
1657--- account/wizard/account_report_balance_sheet.py 2010-10-15 06:33:48 +0000
1658+++ account/wizard/account_report_balance_sheet.py 2010-12-13 07:44:48 +0000
1659@@ -57,7 +57,7 @@
1660 if context is None:
1661 context = {}
1662 data = self.pre_print_report(cr, uid, ids, data, context=context)
1663- account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'])
1664+ account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'], context=context)
1665 if not account.company_id.property_reserve_and_surplus_account:
1666 raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
1667 data['form']['reserve_account_id'] = account.company_id.property_reserve_and_surplus_account.id
1668
1669=== modified file 'account/wizard/account_report_common_account.py'
1670--- account/wizard/account_report_common_account.py 2010-10-01 11:39:52 +0000
1671+++ account/wizard/account_report_common_account.py 2010-12-13 07:44:48 +0000
1672@@ -38,7 +38,7 @@
1673 def pre_print_report(self, cr, uid, ids, data, context=None):
1674 if context is None:
1675 context = {}
1676- data['form'].update(self.read(cr, uid, ids, ['display_account'])[0])
1677+ data['form'].update(self.read(cr, uid, ids, ['display_account'], context=context)[0])
1678 return data
1679
1680 account_common_account_report()
1681
1682=== modified file 'account/wizard/account_report_common_journal.py'
1683--- account/wizard/account_report_common_journal.py 2010-10-01 11:22:06 +0000
1684+++ account/wizard/account_report_common_journal.py 2010-12-13 07:44:48 +0000
1685@@ -41,7 +41,7 @@
1686 def pre_print_report(self, cr, uid, ids, data, context=None):
1687 if context is None:
1688 context = {}
1689- data['form'].update(self.read(cr, uid, ids, ['amount_currency'])[0])
1690+ data['form'].update(self.read(cr, uid, ids, ['amount_currency'], context=context)[0])
1691 fy_ids = data['form']['fiscalyear_id'] and [data['form']['fiscalyear_id']] or self.pool.get('account.fiscalyear').search(cr, uid, [('state', '=', 'draft')], context=context)
1692 period_list = data['form']['periods'] or self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', fy_ids)], context=context)
1693 data['form']['active_ids'] = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', data['form']['journal_ids']), ('period_id', 'in', period_list)], context=context)
1694
1695=== modified file 'account/wizard/account_report_common_partner.py'
1696--- account/wizard/account_report_common_partner.py 2010-10-13 09:45:27 +0000
1697+++ account/wizard/account_report_common_partner.py 2010-12-13 07:44:48 +0000
1698@@ -39,7 +39,7 @@
1699 def pre_print_report(self, cr, uid, ids, data, context=None):
1700 if context is None:
1701 context = {}
1702- data['form'].update(self.read(cr, uid, ids, ['result_selection'])[0])
1703+ data['form'].update(self.read(cr, uid, ids, ['result_selection'], context=context)[0])
1704 return data
1705
1706 account_common_partner_report()
1707
1708=== modified file 'account/wizard/account_report_print_journal.py'
1709--- account/wizard/account_report_print_journal.py 2010-10-04 10:05:21 +0000
1710+++ account/wizard/account_report_print_journal.py 2010-12-13 07:44:48 +0000
1711@@ -39,7 +39,7 @@
1712 if context is None:
1713 context = {}
1714 data = self.pre_print_report(cr, uid, ids, data, context=context)
1715- data['form'].update(self.read(cr, uid, ids, ['sort_selection'])[0])
1716+ data['form'].update(self.read(cr, uid, ids, ['sort_selection'], context=context)[0])
1717 return {'type': 'ir.actions.report.xml', 'report_name': 'account.journal.period.print', 'datas': data}
1718
1719 account_print_journal()
1720
1721=== modified file 'account/wizard/account_subscription_generate.py'
1722--- account/wizard/account_subscription_generate.py 2010-10-28 08:35:00 +0000
1723+++ account/wizard/account_subscription_generate.py 2010-12-13 07:44:48 +0000
1724@@ -33,7 +33,7 @@
1725 _defaults = {
1726 'date': lambda *a: time.strftime('%Y-%m-%d'),
1727 }
1728- def action_generate(self, cr, uid, ids, context={}):
1729+ def action_generate(self, cr, uid, ids, context=None):
1730 mod_obj = self.pool.get('ir.model.data')
1731 act_obj = self.pool.get('ir.actions.act_window')
1732 moves_created=[]
1733
1734=== modified file 'account/wizard/account_unreconcile.py'
1735--- account/wizard/account_unreconcile.py 2010-10-21 05:47:10 +0000
1736+++ account/wizard/account_unreconcile.py 2010-12-13 07:44:48 +0000
1737@@ -41,11 +41,11 @@
1738
1739 def trans_unrec_reconcile(self, cr, uid, ids, context=None):
1740 obj_move_reconcile = self.pool.get('account.move.reconcile')
1741+ if context is None:
1742+ context = {}
1743 rec_ids = context['active_ids']
1744- if context is None:
1745- context = {}
1746 if rec_ids:
1747- obj_move_reconcile.unlink(cr, uid, rec_ids)
1748+ obj_move_reconcile.unlink(cr, uid, rec_ids, context=context)
1749 return {}
1750
1751 account_unreconcile_reconcile()
1752
1753=== modified file 'account/wizard/account_use_model.py'
1754--- account/wizard/account_use_model.py 2010-11-15 18:46:17 +0000
1755+++ account/wizard/account_use_model.py 2010-12-13 07:44:48 +0000
1756@@ -59,9 +59,9 @@
1757 data = self.read(cr, uid, ids, context=context)[0]
1758 record_id = context and context.get('model_line', False) or False
1759 if record_id:
1760- data_model = account_model_obj.browse(cr, uid, data['model'])
1761+ data_model = account_model_obj.browse(cr, uid, data['model'], context=context)
1762 else:
1763- data_model = account_model_obj.browse(cr, uid, context['active_ids'])
1764+ data_model = account_model_obj.browse(cr, uid, context['active_ids'], context=context)
1765 for model in data_model:
1766 entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%d')}
1767 period_id = account_period_obj.find(cr, uid, context=context)
1768
1769=== modified file 'account/wizard/account_validate_account_move.py'
1770--- account/wizard/account_validate_account_move.py 2010-10-21 05:50:17 +0000
1771+++ account/wizard/account_validate_account_move.py 2010-12-13 07:44:48 +0000
1772@@ -33,11 +33,11 @@
1773 obj_move = self.pool.get('account.move')
1774 if context is None:
1775 context = {}
1776- data = self.read(cr, uid, ids)[0]
1777+ data = self.read(cr, uid, ids, context=context)[0]
1778 ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data['journal_id']),('period_id','=',data['period_id'])])
1779 if not ids_move:
1780 raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period'))
1781- obj_move.button_validate(cr, uid, ids_move, context)
1782+ obj_move.button_validate(cr, uid, ids_move, context=context)
1783 return {}
1784
1785 validate_account_move()
1786
1787=== modified file 'account_analytic_analysis/account_analytic_analysis.py'
1788--- account_analytic_analysis/account_analytic_analysis.py 2010-10-27 11:11:08 +0000
1789+++ account_analytic_analysis/account_analytic_analysis.py 2010-12-13 07:44:48 +0000
1790@@ -269,7 +269,7 @@
1791 GROUP BY account_analytic_line.account_id", (child_ids,))
1792 for account_id, sum in cr.fetchall():
1793 res[account_id][name] = round(sum,2)
1794- data = self._compute_level_tree(cr, uid, ids, child_ids, res, [name], context)
1795+ data = self._compute_level_tree(cr, uid, ids, child_ids, res, [name], context=context)
1796 for i in data:
1797 res_final[i] = data[i][name]
1798 return res_final
1799@@ -324,7 +324,7 @@
1800
1801 def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context=None):
1802 res = {}
1803- for account in self.browse(cr, uid, ids):
1804+ for account in self.browse(cr, uid, ids, context=context):
1805 if account.hours_qtt_invoiced == 0:
1806 res[account.id]=0.0
1807 else:
1808@@ -335,7 +335,7 @@
1809
1810 def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context=None):
1811 res = {}
1812- for account in self.browse(cr, uid, ids):
1813+ for account in self.browse(cr, uid, ids, context=context):
1814 if account.ca_invoiced == 0:
1815 res[account.id]=0.0
1816 elif account.total_cost != 0.0:
1817@@ -348,7 +348,7 @@
1818
1819 def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None):
1820 res = {}
1821- for account in self.browse(cr, uid, ids):
1822+ for account in self.browse(cr, uid, ids, context=context):
1823 if account.amount_max != 0:
1824 res[account.id] = account.amount_max - account.ca_invoiced
1825 else:
1826@@ -359,7 +359,7 @@
1827
1828 def _real_margin_calc(self, cr, uid, ids, name, arg, context=None):
1829 res = {}
1830- for account in self.browse(cr, uid, ids):
1831+ for account in self.browse(cr, uid, ids, context=context):
1832 res[account.id] = account.ca_invoiced + account.total_cost
1833 for id in ids:
1834 res[id] = round(res.get(id, 0.0),2)
1835@@ -367,7 +367,7 @@
1836
1837 def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None):
1838 res = {}
1839- for account in self.browse(cr, uid, ids):
1840+ for account in self.browse(cr, uid, ids, context=context):
1841 res[account.id] = account.ca_theorical + account.total_cost
1842 for id in ids:
1843 res[id] = round(res.get(id, 0.0),2)
1844@@ -497,7 +497,7 @@
1845 ')')
1846
1847 def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
1848- if not context:
1849+ if context is None:
1850 context = {}
1851 if not ids:
1852 return []
1853@@ -671,7 +671,7 @@
1854 ')')
1855
1856 def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'):
1857- if not context:
1858+ if context is None:
1859 context = {}
1860 if not ids:
1861 return []
1862
1863=== modified file 'account_analytic_plans/account_analytic_plans.py'
1864--- account_analytic_plans/account_analytic_plans.py 2010-10-12 10:52:58 +0000
1865+++ account_analytic_plans/account_analytic_plans.py 2010-12-13 07:44:48 +0000
1866@@ -28,7 +28,7 @@
1867
1868 class one2many_mod2(fields.one2many):
1869 def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
1870- if not context:
1871+ if context is None:
1872 context = {}
1873 res = {}
1874 for id in ids:
1875@@ -115,7 +115,7 @@
1876 return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context=context)
1877
1878 def _default_journal(self, cr, uid, context=None):
1879- if not context:
1880+ if context is None:
1881 context = {}
1882 journal_obj = self.pool.get('account.journal')
1883 if context.has_key('journal_id') and context['journal_id']:
1884@@ -148,6 +148,8 @@
1885 return self.name_get(cr, uid, ids, context or {})
1886
1887 def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
1888+ if context is None:
1889+ context = {}
1890 wiz_id = self.pool.get('ir.actions.act_window').search(cr, uid, [("name","=","analytic.plan.create.model.action")], context=context)
1891 res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
1892 journal_obj = self.pool.get('account.journal')
1893@@ -214,6 +216,8 @@
1894 return super(account_analytic_plan_instance, self).create(cr, uid, vals, context=context)
1895
1896 def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
1897+ if context is None:
1898+ context = {}
1899 this = self.browse(cr, uid, ids[0], context=context)
1900 invoice_line_obj = self.pool.get('account.invoice.line')
1901 if this.plan_id and not vals.has_key('plan_id'):
1902@@ -307,6 +311,8 @@
1903 return data
1904
1905 def create_analytic_lines(self, cr, uid, ids, context=None):
1906+ if context is None:
1907+ context = {}
1908 super(account_move_line, self).create_analytic_lines(cr, uid, ids, context=context)
1909 analytic_line_obj = self.pool.get('account.analytic.line')
1910 for line in self.browse(cr, uid, ids, context=context):
1911@@ -336,7 +342,9 @@
1912 analytic_line_obj.create(cr, uid, al_vals, context=context)
1913 return True
1914
1915- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
1916+ def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
1917+ if context is None:
1918+ context = {}
1919 result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
1920 return result
1921
1922@@ -437,7 +445,7 @@
1923 def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
1924 account_move_line_pool = self.pool.get('account.move.line')
1925 account_bank_statement_line_pool = self.pool.get('account.bank.statement.line')
1926- st_line = account_bank_statement_line_pool.browse(cr, uid, st_line_id, context)
1927+ st_line = account_bank_statement_line_pool.browse(cr, uid, st_line_id, context=context)
1928 result = super(account_bank_statement,self).create_move_from_st_line(cr, uid, st_line_id, company_currency_id, st_line_number, context=context)
1929 move = st_line.move_ids and st_line.move_ids[0] or False
1930 if move:
1931@@ -447,7 +455,7 @@
1932
1933 def button_confirm_bank(self, cr, uid, ids, context=None):
1934 super(account_bank_statement,self).button_confirm_bank(cr, uid, ids, context=context)
1935- for st in self.browse(cr, uid, ids, context):
1936+ for st in self.browse(cr, uid, ids, context=context):
1937 for st_line in st.line_ids:
1938 if st_line.analytics_id:
1939 if not st.journal_id.analytic_journal_id:
1940
1941=== modified file 'account_analytic_plans/wizard/analytic_plan_create_model.py'
1942--- account_analytic_plans/wizard/analytic_plan_create_model.py 2010-10-11 11:25:50 +0000
1943+++ account_analytic_plans/wizard/analytic_plan_create_model.py 2010-12-13 07:44:48 +0000
1944@@ -30,6 +30,8 @@
1945 plan_obj = self.pool.get('account.analytic.plan.instance')
1946 mod_obj = self.pool.get('ir.model.data')
1947 anlytic_plan_obj = self.pool.get('account.analytic.plan')
1948+ if context is None:
1949+ context = {}
1950 if 'active_id' in context and context['active_id']:
1951 plan = plan_obj.browse(cr, uid, context['active_id'], context=context)
1952 if (not plan.name) or (not plan.code):
1953
1954=== modified file 'account_anglo_saxon/invoice.py'
1955--- account_anglo_saxon/invoice.py 2010-09-01 16:58:41 +0000
1956+++ account_anglo_saxon/invoice.py 2010-12-13 07:44:48 +0000
1957@@ -27,8 +27,8 @@
1958 _inherit = "account.invoice.line"
1959
1960 def move_line_get(self, cr, uid, invoice_id, context=None):
1961- res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context)
1962- inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
1963+ res = super(account_invoice_line,self).move_line_get(cr, uid, invoice_id, context=context)
1964+ inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
1965 if inv.type in ('out_invoice','out_refund'):
1966 for i_line in inv.invoice_line:
1967 if i_line.product_id:
1968@@ -144,7 +144,7 @@
1969 if not oa:
1970 oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
1971 if oa:
1972- fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id) or False
1973+ fpos = fposition_id and self.pool.get('account.fiscal.position').browse(cr, uid, fposition_id, context=context) or False
1974 a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
1975 res['value'].update({'account_id':a})
1976 return res
1977
1978=== modified file 'account_anglo_saxon/stock.py'
1979--- account_anglo_saxon/stock.py 2010-06-24 16:28:26 +0000
1980+++ account_anglo_saxon/stock.py 2010-12-13 07:44:48 +0000
1981@@ -31,7 +31,7 @@
1982 def action_invoice_create(self, cr, uid, ids, journal_id=False,
1983 group=False, type='out_invoice', context=None):
1984 '''Return ids of created invoices for the pickings'''
1985- res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context)
1986+ res = super(stock_picking,self).action_invoice_create(cr, uid, ids, journal_id, group, type, context=context)
1987 if type == 'in_refund':
1988 for inv in self.pool.get('account.invoice').browse(cr, uid, res.values(), context=context):
1989 for ol in inv.invoice_line:
1990
1991=== modified file 'account_budget/account_budget.py'
1992--- account_budget/account_budget.py 2010-10-20 13:54:21 +0000
1993+++ account_budget/account_budget.py 2010-12-13 07:44:48 +0000
1994@@ -108,10 +108,12 @@
1995
1996 class crossovered_budget_lines(osv.osv):
1997
1998- def _prac_amt(self, cr, uid, ids, context={}):
1999+ def _prac_amt(self, cr, uid, ids, context=None):
2000 res = {}
2001 result = 0.0
2002- for line in self.browse(cr, uid, ids):
2003+ if context is None:
2004+ context = {}
2005+ for line in self.browse(cr, uid, ids, context=context):
2006 acc_ids = [x.id for x in line.general_budget_id.account_ids]
2007 if not acc_ids:
2008 raise osv.except_osv(_('Error!'),_("The General Budget '%s' has no Accounts!") % str(line.general_budget_id.name))
2009@@ -131,15 +133,17 @@
2010 res[line.id] = result
2011 return res
2012
2013- def _prac(self, cr, uid, ids, name, args, context):
2014+ def _prac(self, cr, uid, ids, name, args, context=None):
2015 res={}
2016- for line in self.browse(cr, uid, ids):
2017+ for line in self.browse(cr, uid, ids, context=context):
2018 res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
2019 return res
2020
2021- def _theo_amt(self, cr, uid, ids, context={}):
2022+ def _theo_amt(self, cr, uid, ids, context=None):
2023 res = {}
2024- for line in self.browse(cr, uid, ids):
2025+ if context is None:
2026+ context = {}
2027+ for line in self.browse(cr, uid, ids, context=context):
2028 today = datetime.datetime.today()
2029 date_to = today.strftime("%Y-%m-%d")
2030 date_from = line.date_from
2031@@ -167,15 +171,15 @@
2032 res[line.id] = theo_amt
2033 return res
2034
2035- def _theo(self, cr, uid, ids, name, args, context):
2036+ def _theo(self, cr, uid, ids, name, args, context=None):
2037 res = {}
2038- for line in self.browse(cr, uid, ids):
2039+ for line in self.browse(cr, uid, ids, context=context):
2040 res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id]
2041 return res
2042
2043- def _perc(self, cr, uid, ids, name, args, context):
2044+ def _perc(self, cr, uid, ids, name, args, context=None):
2045 res = {}
2046- for line in self.browse(cr, uid, ids):
2047+ for line in self.browse(cr, uid, ids, context=context):
2048 if line.theoritical_amount <> 0.00:
2049 res[line.id] = float(line.practical_amount or 0.0 / line.theoritical_amount) * 100
2050 else:
2051
2052=== modified file 'account_budget/wizard/account_budget_analytic.py'
2053--- account_budget/wizard/account_budget_analytic.py 2010-11-04 12:42:42 +0000
2054+++ account_budget/wizard/account_budget_analytic.py 2010-12-13 07:44:48 +0000
2055@@ -39,7 +39,7 @@
2056 datas = {}
2057 if context is None:
2058 context = {}
2059- data = self.read(cr, uid, ids)[0]
2060+ data = self.read(cr, uid, ids, context=context)[0]
2061 datas = {
2062 'ids': context.get('active_ids',[]),
2063 'model': 'account.analytic.account',
2064
2065=== modified file 'account_budget/wizard/account_budget_crossovered_report.py'
2066--- account_budget/wizard/account_budget_crossovered_report.py 2010-11-04 12:42:42 +0000
2067+++ account_budget/wizard/account_budget_crossovered_report.py 2010-12-13 07:44:48 +0000
2068@@ -39,7 +39,7 @@
2069 datas = {}
2070 if context is None:
2071 context = {}
2072- data = self.read(cr, uid, ids)[0]
2073+ data = self.read(cr, uid, ids, context=context)[0]
2074 datas = {
2075 'ids': context.get('active_ids',[]),
2076 'model': 'crossovered.budget',
2077
2078=== modified file 'account_budget/wizard/account_budget_crossovered_summary_report.py'
2079--- account_budget/wizard/account_budget_crossovered_summary_report.py 2010-11-04 12:42:42 +0000
2080+++ account_budget/wizard/account_budget_crossovered_summary_report.py 2010-12-13 07:44:48 +0000
2081@@ -41,7 +41,7 @@
2082 datas = {}
2083 if context is None:
2084 context = {}
2085- data = self.read(cr, uid, ids)[0]
2086+ data = self.read(cr, uid, ids, context=context)[0]
2087 datas = {
2088 'ids': context.get('active_ids',[]),
2089 'model': 'crossovered.budge',
2090
2091=== modified file 'account_budget/wizard/account_budget_report.py'
2092--- account_budget/wizard/account_budget_report.py 2010-11-04 12:42:42 +0000
2093+++ account_budget/wizard/account_budget_report.py 2010-12-13 07:44:48 +0000
2094@@ -40,7 +40,7 @@
2095 datas = {}
2096 if context is None:
2097 context = {}
2098- data = self.read(cr, uid, ids)[0]
2099+ data = self.read(cr, uid, ids, context=context)[0]
2100 datas = {
2101 'ids': context.get('active_ids',[]),
2102 'model': 'account.budget.post',
2103
2104=== modified file 'account_coda/account_coda.py'
2105--- account_coda/account_coda.py 2010-11-04 12:42:42 +0000
2106+++ account_coda/account_coda.py 2010-12-13 07:44:48 +0000
2107@@ -43,6 +43,8 @@
2108 }
2109
2110 def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
2111+ if context is None:
2112+ context = {}
2113 res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
2114 context=context, count=count)
2115 if context.get('bank_statement', False) and not res:
2116
2117=== modified file 'account_coda/wizard/account_coda_import.py'
2118--- account_coda/wizard/account_coda_import.py 2010-10-28 06:54:18 +0000
2119+++ account_coda/wizard/account_coda_import.py 2010-12-13 07:44:48 +0000
2120@@ -66,13 +66,13 @@
2121 mod_obj = self.pool.get('ir.model.data')
2122 line_obj = self.pool.get('account.move.line')
2123
2124- if not context:
2125+ if context is None:
2126 context = {}
2127
2128 data = self.read(cr, uid, ids)[0]
2129
2130 codafile = data['coda']
2131- journal_code = journal_obj.browse(cr, uid, data['journal_id'], context).code
2132+ journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code
2133
2134 period = account_period_obj.find(cr, uid, context=context)[0]
2135 def_pay_acc = data['def_payable']
2136@@ -155,7 +155,7 @@
2137 bank_ids = partner_bank_obj.search(cr, uid, [('acc_number', '=', st_line_partner_acc)])
2138 bank_statement_lines[st_line_name].update({'cntry_number': cntry_number, 'contry_name': contry_name})
2139 if bank_ids:
2140- bank = partner_bank_obj.browse(cr, uid, bank_ids[0], context)
2141+ bank = partner_bank_obj.browse(cr, uid, bank_ids[0], context=context)
2142 if line and bank.partner_id:
2143 bank_statement_lines[st_line_name].update({'partner_id': bank.partner_id.id})
2144 if bank_statement_lines[st_line_name]['amount'] < 0:
2145@@ -321,7 +321,7 @@
2146 }
2147
2148 def action_open_window(self, cr, uid, data, context=None):
2149- if not context:
2150+ if context is None:
2151 context = {}
2152
2153 return {
2154
2155=== modified file 'account_followup/report/account_followup_print.py'
2156--- account_followup/report/account_followup_print.py 2010-11-10 11:43:46 +0000
2157+++ account_followup/report/account_followup_print.py 2010-12-13 07:44:48 +0000
2158@@ -58,7 +58,7 @@
2159 movelines = moveline_obj.read(self.cr, self.uid, movelines)
2160 return movelines
2161
2162- def _get_text(self, partner, followup_id, context={}):
2163+ def _get_text(self, partner, followup_id, context=None):
2164 fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup')
2165 fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line
2166 li_delay = []
2167
2168=== modified file 'account_followup/wizard/account_followup_print.py'
2169--- account_followup/wizard/account_followup_print.py 2010-11-16 06:07:20 +0000
2170+++ account_followup/wizard/account_followup_print.py 2010-12-13 07:44:48 +0000
2171@@ -39,7 +39,7 @@
2172 context = {}
2173 if context.get('active_model', 'ir.ui.menu') == 'account_followup.followup':
2174 return context.get('active_id', False)
2175- company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
2176+ company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
2177 followp_id = self.pool.get('account_followup.followup').search(cr, uid, [('company_id', '=', company_id)], context=context)
2178 return followp_id and followp_id[0] or False
2179
2180@@ -48,7 +48,7 @@
2181
2182 if context is None:
2183 context = {}
2184- data = self.read(cr, uid, ids, [])[0]
2185+ data = self.read(cr, uid, ids, [], context=context)[0]
2186 model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
2187 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
2188 context.update({'followup_id': data['followup_id'], 'date':data['date']})
2189@@ -146,7 +146,7 @@
2190 if context is None:
2191 context = {}
2192 if ids:
2193- data = self.read(cr, uid, ids, [])[0]
2194+ data = self.read(cr, uid, ids, [], context=context)[0]
2195 cr.execute(
2196 "SELECT l.partner_id, l.followup_line_id,l.date_maturity, l.date, l.id "\
2197 "FROM account_move_line AS l "\
2198@@ -208,14 +208,14 @@
2199
2200 if context is None:
2201 context = {}
2202- data = self.read(cr, uid, ids, [])[0]
2203+ data = self.read(cr, uid, ids, [], context=context)[0]
2204 model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all_msg')], context=context)
2205 resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
2206 if data['email_conf']:
2207 msg_sent = ''
2208 msg_unsent = ''
2209- data_user = user_obj.browse(cr, uid, uid)
2210- move_lines = line_obj.browse(cr, uid, data['partner_ids'])
2211+ data_user = user_obj.browse(cr, uid, uid, context=context)
2212+ move_lines = line_obj.browse(cr, uid, data['partner_ids'], context=context)
2213 partners = []
2214 dict_lines = {}
2215 for line in move_lines:
2216@@ -223,7 +223,7 @@
2217 dict_lines[line.name.id] =line
2218 for partner in partners:
2219 ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable'])])
2220- data_lines = move_obj.browse(cr, uid, ids_lines)
2221+ data_lines = move_obj.browse(cr, uid, ids_lines, context=context)
2222 followup_data = dict_lines[partner.id]
2223 dest = False
2224 if partner.address:
2225@@ -306,7 +306,7 @@
2226 def do_print(self, cr, uid, ids, context=None):
2227 if context is None:
2228 context = {}
2229- data = self.read(cr, uid, ids, [])[0]
2230+ data = self.read(cr, uid, ids, [], context=context)[0]
2231 res = self._get_partners_followp(cr, uid, ids, context)['to_update']
2232 to_update = res
2233 data['followup_id'] = 'followup_id' in context and context['followup_id'] or False
2234
2235=== modified file 'account_invoice_layout/account_invoice_layout.py'
2236--- account_invoice_layout/account_invoice_layout.py 2010-10-04 10:05:30 +0000
2237+++ account_invoice_layout/account_invoice_layout.py 2010-12-13 07:44:48 +0000
2238@@ -127,13 +127,12 @@
2239 def copy_data(self, cr, uid, id, default=None, context=None):
2240 if default is None:
2241 default = {}
2242- default['state'] = self.browse(cr, uid, id).state
2243+ default['state'] = self.browse(cr, uid, id, context=context).state
2244 return super(account_invoice_line, self).copy_data(cr, uid, id, default, context)
2245
2246 def _fnct(self, cr, uid, ids, name, args, context=None):
2247 res = {}
2248-
2249- lines = self.browse(cr, uid, ids)
2250+ lines = self.browse(cr, uid, ids, context=context)
2251 account_ids = [line.account_id.id for line in lines]
2252 account_names = dict(self.pool.get('account.account').name_get(cr, uid, account_ids, context=context))
2253 for line in lines:
2254@@ -180,7 +179,7 @@
2255 class one2many_mod2(fields.one2many):
2256
2257 def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
2258- if not context:
2259+ if context is None:
2260 context = {}
2261 if not values:
2262 values = {}
2263
2264=== modified file 'account_invoice_layout/wizard/account_invoice_special_message.py'
2265--- account_invoice_layout/wizard/account_invoice_special_message.py 2010-08-17 05:48:28 +0000
2266+++ account_invoice_layout/wizard/account_invoice_special_message.py 2010-12-13 07:44:48 +0000
2267@@ -34,7 +34,7 @@
2268 if context is None:
2269 context = {}
2270
2271- data = self.read(cr, uid, ids, [])[0]
2272+ data = self.read(cr, uid, ids, [], context=context)[0]
2273 datas = {
2274 'ids': context.get('active_ids',[]),
2275 'model': 'account.invoice',
2276
2277=== modified file 'account_payment/account_move_line.py'
2278--- account_payment/account_move_line.py 2010-10-22 12:08:56 +0000
2279+++ account_payment/account_move_line.py 2010-12-13 07:44:48 +0000
2280@@ -26,7 +26,7 @@
2281 class account_move_line(osv.osv):
2282 _inherit = "account.move.line"
2283
2284- def amount_to_pay(self, cr, uid, ids, name, arg={}, context={}):
2285+ def amount_to_pay(self, cr, uid, ids, name, arg={}, context=None):
2286 """ Return the amount still to pay regarding all the payemnt orders
2287 (excepting cancelled orders)"""
2288 if not ids:
2289@@ -47,7 +47,7 @@
2290 r = dict(cr.fetchall())
2291 return r
2292
2293- def _to_pay_search(self, cr, uid, obj, name, args, context):
2294+ def _to_pay_search(self, cr, uid, obj, name, args, context=None):
2295 if not args:
2296 return []
2297 line_obj = self.pool.get('account.move.line')
2298
2299=== modified file 'account_payment/account_payment.py'
2300--- account_payment/account_payment.py 2010-11-04 12:42:42 +0000
2301+++ account_payment/account_payment.py 2010-12-13 07:44:48 +0000
2302@@ -39,7 +39,7 @@
2303 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id
2304 }
2305
2306- def suitable_bank_types(self, cr, uid, payment_code=None, context={}):
2307+ def suitable_bank_types(self, cr, uid, payment_code=None, context=None):
2308 """Return the codes of the bank type that are suitable
2309 for the given payment type code"""
2310 if not payment_code:
2311@@ -267,10 +267,10 @@
2312 line.amount_currency, context=ctx)
2313 return res
2314
2315- def _get_currency(self, cr, uid, context):
2316+ def _get_currency(self, cr, uid, context=None):
2317 user_obj = self.pool.get('res.users')
2318 currency_obj = self.pool.get('res.currency')
2319- user = user_obj.browse(cr, uid, uid)
2320+ user = user_obj.browse(cr, uid, uid, context=context)
2321
2322 if user.company_id:
2323 return user.company_id.currency_id.id
2324@@ -284,7 +284,7 @@
2325 date = False
2326
2327 if context.get('order_id') and context['order_id']:
2328- order = payment_order_obj.browse(cr, uid, context['order_id'], context)
2329+ order = payment_order_obj.browse(cr, uid, context['order_id'], context=context)
2330 if order.date_prefered == 'fixed':
2331 date = order.date_scheduled
2332 else:
2333@@ -364,7 +364,7 @@
2334 data['amount_currency'] = data['communication'] = data['partner_id'] = data['reference'] = data['date_created'] = data['bank_id'] = data['amount'] = False
2335
2336 if move_line_id:
2337- line = move_line_obj.browse(cr, uid, move_line_id)
2338+ line = move_line_obj.browse(cr, uid, move_line_id, context=context)
2339 data['amount_currency'] = line.amount_to_pay
2340
2341 res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
2342@@ -413,7 +413,7 @@
2343 data['info_partner'] = data['bank_id'] = False
2344
2345 if partner_id:
2346- part_obj = partner_obj.browse(cr, uid, partner_id)
2347+ part_obj = partner_obj.browse(cr, uid, partner_id, context=context)
2348 partner = part_obj.name or ''
2349
2350 if part_obj.address:
2351
2352=== modified file 'account_payment/wizard/account_payment_order.py'
2353--- account_payment/wizard/account_payment_order.py 2010-11-15 05:25:33 +0000
2354+++ account_payment/wizard/account_payment_order.py 2010-12-13 07:44:48 +0000
2355@@ -62,7 +62,7 @@
2356 payment_obj = self.pool.get('payment.line')
2357 if context is None:
2358 context = {}
2359- data = self.read(cr, uid, ids, [])[0]
2360+ data = self.read(cr, uid, ids, [], context=context)[0]
2361 line_ids = data['entries']
2362 if not line_ids:
2363 return {}
2364
2365=== modified file 'account_payment/wizard/account_payment_pay.py'
2366--- account_payment/wizard/account_payment_pay.py 2010-10-21 05:39:17 +0000
2367+++ account_payment/wizard/account_payment_pay.py 2010-12-13 07:44:48 +0000
2368@@ -31,6 +31,8 @@
2369 If type is manual. just confirm the order.
2370 """
2371 obj_payment_order = self.pool.get('payment.order')
2372+ if context is None:
2373+ context = {}
2374 # obj_model = self.pool.get('ir.model.data')
2375 # obj_act = self.pool.get('ir.actions.act_window')
2376 # order = obj_payment_order.browse(cr, uid, context['active_id'], context)
2377
2378=== modified file 'account_payment/wizard/account_payment_populate_statement.py'
2379--- account_payment/wizard/account_payment_populate_statement.py 2010-10-21 05:39:17 +0000
2380+++ account_payment/wizard/account_payment_populate_statement.py 2010-12-13 07:44:48 +0000
2381@@ -60,7 +60,7 @@
2382
2383 if context is None:
2384 context = {}
2385- data = self.read(cr, uid, ids, [])[0]
2386+ data = self.read(cr, uid, ids, [], context=context)[0]
2387 line_ids = data['lines']
2388 if not line_ids:
2389 return {}
2390
2391=== modified file 'account_sequence/account_sequence.py'
2392--- account_sequence/account_sequence.py 2010-11-26 10:38:44 +0000
2393+++ account_sequence/account_sequence.py 2010-12-13 07:44:48 +0000
2394@@ -33,7 +33,7 @@
2395 obj_sequence = self.pool.get('ir.sequence')
2396 res = super(account_move, self).post(cr, uid, ids, context=context)
2397 seq_no = False
2398- for move in self.browse(cr, uid, ids, context):
2399+ for move in self.browse(cr, uid, ids, context=context):
2400 if move.journal_id.internal_sequence_id:
2401 seq_no = obj_sequence.get_id(cr, uid, move.journal_id.internal_sequence_id.id, context=context)
2402 if seq_no:
2403
2404=== modified file 'account_sequence/account_sequence_installer.py'
2405--- account_sequence/account_sequence_installer.py 2010-11-26 14:35:24 +0000
2406+++ account_sequence/account_sequence_installer.py 2010-12-13 07:44:48 +0000
2407@@ -47,7 +47,7 @@
2408 context = {}
2409 jou_obj = self.pool.get('account.journal')
2410 obj_sequence = self.pool.get('ir.sequence')
2411- record = self.browse(cr, uid, ids, context)[0]
2412+ record = self.browse(cr, uid, ids, context=context)[0]
2413 j_ids = []
2414 if record.company_id:
2415 company_id = record.company_id.id,
2416@@ -70,7 +70,7 @@
2417 ir_seq = obj_sequence.create(cr, uid, vals, context)
2418 res = super(account_sequence_installer, self).execute(cr, uid, ids, context=context)
2419 journal_ids = jou_obj.search(cr, uid, search_criteria, context=context)
2420- for journal in jou_obj.browse(cr, uid, journal_ids, context):
2421+ for journal in jou_obj.browse(cr, uid, journal_ids, context=context):
2422 if not journal.internal_sequence_id:
2423 j_ids.append(journal.id)
2424 if j_ids:
2425
2426=== modified file 'account_voucher/account_voucher.py'
2427--- account_voucher/account_voucher.py 2010-11-24 12:13:47 +0000
2428+++ account_voucher/account_voucher.py 2010-12-13 07:44:48 +0000
2429@@ -30,7 +30,7 @@
2430 class account_move_line(osv.osv):
2431 _inherit = 'account.move.line'
2432
2433- def _unreconciled(self, cr, uid, ids, prop, unknow_none, context):
2434+ def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None):
2435 res = {}
2436 for line in self.browse(cr, uid, ids, context=context):
2437 res[line.id] = line.debit - line.credit
2438@@ -49,16 +49,19 @@
2439
2440 class account_voucher(osv.osv):
2441
2442- def _get_type(self, cr, uid, ids, context={}):
2443+ def _get_type(self, cr, uid, ids, context=None):
2444+ if context is None: context = {}
2445 return context.get('type', False)
2446
2447- def _get_period(self, cr, uid, context={}):
2448+ def _get_period(self, cr, uid, context=None):
2449+ if context is None: context = {}
2450 if context.get('period_id', False):
2451 return context.get('period_id')
2452 periods = self.pool.get('account.period').find(cr, uid)
2453 return periods and periods[0] or False
2454
2455- def _get_journal(self, cr, uid, context={}):
2456+ def _get_journal(self, cr, uid, context=None):
2457+ if context is None: context = {}
2458 journal_pool = self.pool.get('account.journal')
2459 if context.get('journal_id', False):
2460 return context.get('journal_id')
2461@@ -71,7 +74,8 @@
2462 res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
2463 return res and res[0] or False
2464
2465- def _get_tax(self, cr, uid, context={}):
2466+ def _get_tax(self, cr, uid, context=None):
2467+ if context is None: context = {}
2468 journal_pool = self.pool.get('account.journal')
2469 journal_id = context.get('journal_id', False)
2470 if not journal_id:
2471@@ -83,39 +87,45 @@
2472
2473 if not journal_id:
2474 return False
2475- journal = journal_pool.browse(cr, uid, journal_id)
2476+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
2477 account_id = journal.default_credit_account_id or journal.default_debit_account_id
2478 if account_id and account_id.tax_ids:
2479 tax_id = account_id.tax_ids[0].id
2480 return tax_id
2481 return False
2482
2483- def _get_currency(self, cr, uid, context):
2484+ def _get_currency(self, cr, uid, context=None):
2485+ if context is None: context = {}
2486 journal_pool = self.pool.get('account.journal')
2487 journal_id = context.get('journal_id', False)
2488 if journal_id:
2489- journal = journal_pool.browse(cr, uid, journal_id)
2490+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
2491 # currency_id = journal.company_id.currency_id.id
2492 if journal.currency:
2493 return journal.currency.id
2494 return False
2495
2496- def _get_partner(self, cr, uid, context={}):
2497+ def _get_partner(self, cr, uid, context=None):
2498+ if context is None: context = {}
2499 return context.get('partner_id', False)
2500
2501- def _get_reference(self, cr, uid, context={}):
2502+ def _get_reference(self, cr, uid, context=None):
2503+ if context is None: context = {}
2504 return context.get('reference', False)
2505
2506- def _get_narration(self, cr, uid, context={}):
2507+ def _get_narration(self, cr, uid, context=None):
2508+ if context is None: context = {}
2509 return context.get('narration', False)
2510
2511 def name_get(self, cr, uid, ids, context=None):
2512 if not ids:
2513 return []
2514+ if context is None: context = {}
2515 return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
2516
2517 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
2518 mod_obj = self.pool.get('ir.model.data')
2519+ if context is None: context = {}
2520 if not view_id and context.get('invoice_type', False):
2521 if context.get('invoice_type', False) in ('out_invoice', 'out_refund'):
2522 result = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
2523@@ -232,14 +242,15 @@
2524 'comment': 'Write-Off',
2525 }
2526
2527- def compute_tax(self, cr, uid, ids, context={}):
2528+ def compute_tax(self, cr, uid, ids, context=None):
2529 tax_pool = self.pool.get('account.tax')
2530 partner_pool = self.pool.get('res.partner')
2531 position_pool = self.pool.get('account.fiscal.position')
2532 voucher_line_pool = self.pool.get('account.voucher.line')
2533 voucher_pool = self.pool.get('account.voucher')
2534+ if context is None: context = {}
2535
2536- for voucher in voucher_pool.browse(cr, uid, ids, context):
2537+ for voucher in voucher_pool.browse(cr, uid, ids, context=context):
2538 voucher_amount = 0.0
2539 for line in voucher.line_ids:
2540 voucher_amount += line.untax_amount or line.amount
2541@@ -250,10 +261,10 @@
2542 self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
2543 continue
2544
2545- tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
2546- partner = partner_pool.browse(cr, uid, voucher.partner_id.id) or False
2547+ tax = [tax_pool.browse(cr, uid, voucher.tax_id.id, context=context)]
2548+ partner = partner_pool.browse(cr, uid, voucher.partner_id.id, context=context) or False
2549 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
2550- tax = tax_pool.browse(cr, uid, taxes)
2551+ tax = tax_pool.browse(cr, uid, taxes, context=context)
2552
2553 total = voucher_amount
2554 total_tax = 0.0
2555@@ -277,7 +288,7 @@
2556 self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
2557 return True
2558
2559- def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
2560+ def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context=None):
2561 tax_pool = self.pool.get('account.tax')
2562 partner_pool = self.pool.get('res.partner')
2563 position_pool = self.pool.get('account.fiscal.position')
2564@@ -299,11 +310,11 @@
2565 total = voucher_total
2566 total_tax = 0.0
2567 if tax_id:
2568- tax = [tax_pool.browse(cr, uid, tax_id)]
2569+ tax = [tax_pool.browse(cr, uid, tax_id, context=context)]
2570 if partner_id:
2571- partner = partner_pool.browse(cr, uid, partner_id) or False
2572+ partner = partner_pool.browse(cr, uid, partner_id, context=context) or False
2573 taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
2574- tax = tax_pool.browse(cr, uid, taxes)
2575+ tax = tax_pool.browse(cr, uid, taxes, context=context)
2576
2577 if not tax[0].price_include:
2578 for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes', []):
2579@@ -332,7 +343,7 @@
2580 })
2581 return {'value':default}
2582
2583- def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context={}):
2584+ def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context=None):
2585 """price
2586 Returns a dict that contains new values and context
2587
2588@@ -352,8 +363,8 @@
2589 partner_pool = self.pool.get('res.partner')
2590 journal_pool = self.pool.get('account.journal')
2591
2592- journal = journal_pool.browse(cr, uid, journal_id)
2593- partner = partner_pool.browse(cr, uid, partner_id)
2594+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
2595+ partner = partner_pool.browse(cr, uid, partner_id, context=context)
2596 account_id = False
2597 tr_type = False
2598 if journal.type in ('sale','sale_refund'):
2599@@ -411,8 +422,8 @@
2600 line_pool.unlink(cr, uid, line_ids)
2601 return default
2602
2603- journal = journal_pool.browse(cr, uid, journal_id)
2604- partner = partner_pool.browse(cr, uid, partner_id)
2605+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
2606+ partner = partner_pool.browse(cr, uid, partner_id, context=context)
2607 account_id = False
2608 if journal.type in ('sale','sale_refund'):
2609 account_id = partner.property_account_receivable.id
2610@@ -441,7 +452,7 @@
2611 else:
2612 ids = context['move_line_ids']
2613 ids.reverse()
2614- moves = move_line_pool.browse(cr, uid, ids)
2615+ moves = move_line_pool.browse(cr, uid, ids, context=context)
2616
2617 company_currency = journal.company_id.currency_id.id
2618 if company_currency != currency_id and ttype == 'payment':
2619@@ -496,7 +507,7 @@
2620
2621 return default
2622
2623- def onchange_date(self, cr, user, ids, date, context={}):
2624+ def onchange_date(self, cr, user, ids, date, context=None):
2625 """
2626 @param date: latest value from user input for field date
2627 @param args: other arguments
2628@@ -513,11 +524,11 @@
2629 }
2630 }
2631
2632- def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
2633+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
2634 if not journal_id:
2635 return False
2636 journal_pool = self.pool.get('account.journal')
2637- journal = journal_pool.browse(cr, uid, journal_id)
2638+ journal = journal_pool.browse(cr, uid, journal_id, context=context)
2639 account_id = journal.default_credit_account_id or journal.default_debit_account_id
2640 tax_id = False
2641 if account_id and account_id.tax_ids:
2642@@ -535,18 +546,18 @@
2643 self.action_move_line_create(cr, uid, ids, context=context)
2644 return True
2645
2646- def action_cancel_draft(self, cr, uid, ids, context={}):
2647+ def action_cancel_draft(self, cr, uid, ids, context=None):
2648 wf_service = netsvc.LocalService("workflow")
2649 for voucher_id in ids:
2650 wf_service.trg_create(uid, 'account.voucher', voucher_id, cr)
2651 self.write(cr, uid, ids, {'state':'draft'})
2652 return True
2653
2654- def cancel_voucher(self, cr, uid, ids, context={}):
2655+ def cancel_voucher(self, cr, uid, ids, context=None):
2656 reconcile_pool = self.pool.get('account.move.reconcile')
2657 move_pool = self.pool.get('account.move')
2658
2659- for voucher in self.browse(cr, uid, ids):
2660+ for voucher in self.browse(cr, uid, ids, context=context):
2661 recs = []
2662 for line in voucher.move_ids:
2663 if line.reconcile_id:
2664@@ -600,14 +611,14 @@
2665 terms = term_pool.compute(cr, uid, term_id, amount)
2666 return terms
2667 return False
2668- if not context:
2669+ if context is None:
2670 context = {}
2671 move_pool = self.pool.get('account.move')
2672 move_line_pool = self.pool.get('account.move.line')
2673 currency_pool = self.pool.get('res.currency')
2674 tax_obj = self.pool.get('account.tax')
2675 seq_obj = self.pool.get('ir.sequence')
2676- for inv in self.browse(cr, uid, ids):
2677+ for inv in self.browse(cr, uid, ids, context=context):
2678 if inv.move_id:
2679 continue
2680 if inv.number:
2681@@ -787,7 +798,7 @@
2682 def _compute_balance(self, cr, uid, ids, name, args, context=None):
2683 currency_pool = self.pool.get('res.currency')
2684 rs_data = {}
2685- for line in self.browse(cr, uid, ids):
2686+ for line in self.browse(cr, uid, ids, context=context):
2687 res = {}
2688 company_currency = line.voucher_id.journal_id.company_id.currency_id.id
2689 voucher_currency = line.voucher_id.currency_id.id
2690@@ -827,7 +838,7 @@
2691 'name': ''
2692 }
2693
2694- def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
2695+ def onchange_move_line_id(self, cr, user, ids, move_line_id, context=None):
2696 """
2697 Returns a dict that contains new values and context
2698
2699@@ -862,6 +873,8 @@
2700
2701 @return: Returns a dict that contains default values for fields
2702 """
2703+ if context is None:
2704+ context = {}
2705 journal_id = context.get('journal_id', False)
2706 partner_id = context.get('partner_id', False)
2707 journal_pool = self.pool.get('account.journal')
2708@@ -869,7 +882,7 @@
2709 values = super(account_voucher_line, self).default_get(cr, user, fields_list, context=context)
2710 if (not journal_id) or ('account_id' not in fields_list):
2711 return values
2712- journal = journal_pool.browse(cr, user, journal_id)
2713+ journal = journal_pool.browse(cr, user, journal_id, context=context)
2714 account_id = False
2715 ttype = 'cr'
2716 if journal.type in ('sale', 'sale_refund'):
2717@@ -898,7 +911,7 @@
2718
2719 def button_cancel(self, cr, uid, ids, context=None):
2720 voucher_obj = self.pool.get('account.voucher')
2721- for st in self.browse(cr, uid, ids, context):
2722+ for st in self.browse(cr, uid, ids, context=context):
2723 voucher_ids = []
2724 for line in st.line_ids:
2725 if line.voucher_id:
2726@@ -958,7 +971,7 @@
2727
2728 def unlink(self, cr, uid, ids, context=None):
2729 voucher_obj = self.pool.get('account.voucher')
2730- statement_line = self.browse(cr, uid, ids, context)
2731+ statement_line = self.browse(cr, uid, ids, context=context)
2732 unlink_ids = []
2733 for st_line in statement_line:
2734 if st_line.voucher_id:
2735
2736=== modified file 'account_voucher/wizard/account_statement_from_invoice.py'
2737--- account_voucher/wizard/account_statement_from_invoice.py 2010-11-04 12:42:42 +0000
2738+++ account_voucher/wizard/account_statement_from_invoice.py 2010-12-13 07:44:48 +0000
2739@@ -35,7 +35,8 @@
2740 }
2741
2742 def populate_statement(self, cr, uid, ids, context=None):
2743-
2744+ if context is None:
2745+ context = {}
2746 statement_id = context.get('statement_id', False)
2747 if not statement_id:
2748 return {}
2749@@ -134,7 +135,8 @@
2750 }
2751
2752 def search_invoices(self, cr, uid, ids, context=None):
2753-
2754+ if context is None:
2755+ context = {}
2756 line_obj = self.pool.get('account.move.line')
2757 statement_obj = self.pool.get('account.bank.statement')
2758 journal_obj = self.pool.get('account.journal')
2759
2760=== modified file 'account_voucher/wizard/account_voucher_unreconcile.py'
2761--- account_voucher/wizard/account_voucher_unreconcile.py 2010-10-26 13:33:52 +0000
2762+++ account_voucher/wizard/account_voucher_unreconcile.py 2010-12-13 07:44:48 +0000
2763@@ -41,7 +41,7 @@
2764 voucher_pool = self.pool.get('account.voucher')
2765 reconcile_pool = self.pool.get('account.move.reconcile')
2766 if context.get('active_id'):
2767- voucher = voucher_pool.browse(cr, uid, context.get('active_id'), context)
2768+ voucher = voucher_pool.browse(cr, uid, context.get('active_id'), context=context)
2769 recs = []
2770 for line in voucher.move_ids:
2771 if line.reconcile_id:
2772
2773=== modified file 'analytic/analytic.py'
2774--- analytic/analytic.py 2010-11-27 20:15:32 +0000
2775+++ analytic/analytic.py 2010-12-13 07:44:48 +0000
2776@@ -183,7 +183,7 @@
2777 def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
2778 if not args:
2779 args=[]
2780- if not context:
2781+ if context is None:
2782 context={}
2783 account = self.search(cr, uid, [('code', '=', name)]+args, limit=limit, context=context)
2784 if not account:
2785
2786=== modified file 'auction/auction.py'
2787--- auction/auction.py 2010-11-15 13:15:55 +0000
2788+++ auction/auction.py 2010-12-13 07:44:48 +0000
2789@@ -57,18 +57,16 @@
2790 return res
2791
2792 def name_get(self, cr, uid, ids, context=None):
2793- if not context:
2794- context={}
2795 if not ids:
2796 return []
2797- reads = self.read(cr, uid, ids, ['name', 'auction1'], context)
2798+ reads = self.read(cr, uid, ids, ['name', 'auction1'], context=context)
2799 name = [(r['id'], '['+r['auction1']+'] '+ r['name']) for r in reads]
2800 return name
2801
2802- def _get_invoice(self, cr, uid, ids, name, arg, context={}):
2803+ def _get_invoice(self, cr, uid, ids, name, arg, context=None):
2804 lots_obj = self.pool.get('auction.lots')
2805 result = {}
2806- for data in self.browse(cr, uid, ids):
2807+ for data in self.browse(cr, uid, ids, context=context):
2808 buyer_inv_ids = []
2809 seller_inv_ids = []
2810 result[data.id] = {
2811@@ -76,7 +74,7 @@
2812 'buyer_invoice_history': seller_inv_ids,
2813 }
2814 lots_ids = lots_obj.search(cr, uid, [('auction_id','=',data.id)])
2815- for lot in lots_obj.browse(cr, uid, lots_ids):
2816+ for lot in lots_obj.browse(cr, uid, lots_ids, context=context):
2817 if lot.ach_inv_id:
2818 buyer_inv_ids.append(lot.ach_inv_id.id)
2819 if lot.sel_inv_id:
2820@@ -120,8 +118,6 @@
2821
2822 RETURN: True
2823 """
2824- if not context:
2825- context={}
2826 lots_obj = self.pool.get('auction.lots')
2827 lots_ids = lots_obj.search(cr, uid, [('auction_id', 'in', ids), ('state', '=', 'draft'), ('obj_price', '>', 0)])
2828 lots_obj.lots_invoice(cr, uid, lots_ids, {}, None)
2829@@ -194,12 +190,10 @@
2830 }
2831
2832 def name_get(self, cr, uid, ids, context=None):
2833- if not context:
2834- context = {}
2835 res = []
2836 if not ids:
2837 return res
2838- reads = self.read(cr, uid, ids, ['name', 'parent_id'], context)
2839+ reads = self.read(cr, uid, ids, ['name', 'parent_id'], context=context)
2840 for record in reads:
2841 name = record['name']
2842 if record['parent_id']:
2843@@ -229,8 +223,6 @@
2844 # Lots
2845 #----------------------------------------------------------
2846 def _type_get(self, cr, uid, context=None):
2847- if not context:
2848- context = {}
2849 obj = self.pool.get('auction.lot.category')
2850 ids = obj.search(cr, uid, [])
2851 res = obj.read(cr, uid, ids, ['name'], context)
2852@@ -245,23 +237,15 @@
2853 _description=__doc__
2854
2855 def button_not_bought(self, cr, uid, ids, context=None):
2856- if not context:
2857- context={}
2858 return self.write(cr, uid, ids, {'state':'unsold'})
2859
2860 def button_taken_away(self, cr, uid, ids, context=None):
2861- if not context:
2862- context={}
2863 return self.write(cr, uid, ids, {'state':'taken_away', 'ach_emp': True})
2864
2865 def button_unpaid(self, cr, uid, ids, context=None):
2866- if not context:
2867- context={}
2868 return self.write(cr, uid, ids, {'state':'draft'})
2869
2870 def button_bought(self, cr, uid, ids, context=None):
2871- if not context:
2872- context={}
2873 return self.write(cr, uid, ids, {'state':'sold'})
2874
2875 def _getprice(self, cr, uid, ids, fields, args, context=None):
2876@@ -271,12 +255,10 @@
2877 @param context: A standard dictionary for contextual values
2878 @return: Dictionary of function fields value.
2879 """
2880- if not context:
2881- context = {}
2882
2883 res = {}
2884 account_analytic_line_obj = self.pool.get('account.analytic.line')
2885- lots = self.browse(cr, uid, ids, context)
2886+ lots = self.browse(cr, uid, ids, context=context)
2887 pt_tax = self.pool.get('account.tax')
2888 for lot in lots:
2889 taxes = []
2890@@ -362,8 +344,6 @@
2891 return res
2892
2893 def onchange_obj_ret(self, cr, uid, ids, obj_ret, context=None):
2894- if not context:
2895- context={}
2896 if obj_ret:
2897 return {'value': {'obj_price': 0}}
2898 return {}
2899@@ -430,16 +410,12 @@
2900 }
2901
2902 def name_get(self, cr, user, ids, context=None):
2903- if not context:
2904- context={}
2905 if not ids:
2906 return []
2907 result = [ (r['id'], str(r['obj_num'])+' - '+r['name']) for r in self.read(cr, user, ids, ['name', 'obj_num'])]
2908 return result
2909
2910 def name_search(self, cr, user, name, args=None, operator='ilike', context=None):
2911- if not context:
2912- context={}
2913 if not args:
2914 args = []
2915 ids = []
2916@@ -583,14 +559,12 @@
2917
2918 def buyer_proforma(self, cr, uid, ids, context=None):
2919
2920- if not context:
2921- context={}
2922 invoices = {}
2923 inv_ref = self.pool.get('account.invoice')
2924 res_obj = self.pool.get('res.partner')
2925 inv_line_obj = self.pool.get('account.invoice.line')
2926 wf_service = netsvc.LocalService('workflow')
2927- for lot in self.browse(cr, uid, ids, context):
2928+ for lot in self.browse(cr, uid, ids, context=context):
2929 if not lot.obj_price>0:
2930 continue
2931 if not lot.ach_uid.id:
2932@@ -643,12 +617,10 @@
2933 """
2934 # use each list of object in turn
2935 invoices = {}
2936- if not context:
2937- context={}
2938 inv_ref=self.pool.get('account.invoice')
2939 inv_line_obj = self.pool.get('account.invoice.line')
2940 wf_service = netsvc.LocalService('workflow')
2941- for lot in self.browse(cr, uid, ids, context):
2942+ for lot in self.browse(cr, uid, ids, context=context):
2943 if not lot.auction_id.id:
2944 continue
2945 if lot.bord_vnd_id.id in invoices:
2946@@ -684,7 +656,7 @@
2947 }
2948 inv_line_obj.create(cr, uid, inv_line, context)
2949 inv_ref.button_compute(cr, uid, invoices.values())
2950- for inv in inv_ref.browse(cr, uid, invoices.values(), context):
2951+ for inv in inv_ref.browse(cr, uid, invoices.values(), context=context):
2952 inv_ref.write(cr, uid, [inv.id], {
2953 'check_total': inv.amount_total
2954 })
2955
2956=== modified file 'auction/report/huissier.py'
2957--- auction/report/huissier.py 2010-08-19 11:51:57 +0000
2958+++ auction/report/huissier.py 2010-12-13 07:44:48 +0000
2959@@ -31,9 +31,9 @@
2960 def __init__(self, name, table, tmpl, xsl):
2961 report_rml.__init__(self, name, table, tmpl, xsl)
2962
2963- def create_xml(self,cr, uid, ids, datas, context={}):
2964+ def create_xml(self,cr, uid, ids, datas, context=None):
2965 pool= pooler.get_pool(cr.dbname)
2966- lots = pool.get('auction.lots').browse(cr, uid, ids)
2967+ lots = pool.get('auction.lots').browse(cr, uid, ids, context=context)
2968 auction = lots[0].auction_id
2969
2970 xml = '''<?xml version="1.0" encoding="UTF-8"?>
2971
2972=== modified file 'auction/report/report_auction.py'
2973--- auction/report/report_auction.py 2010-10-15 14:01:53 +0000
2974+++ auction/report/report_auction.py 2010-12-13 07:44:48 +0000
2975@@ -28,8 +28,6 @@
2976 import tools
2977
2978 def _type_get(self, cr, uid, context=None):
2979- if not context:
2980- context = {}
2981 obj = self.pool.get('auction.lot.category')
2982 ids = obj.search(cr, uid, [])
2983 res = obj.read(cr, uid, ids, ['name'], context)
2984
2985=== modified file 'auction/report/total.py'
2986--- auction/report/total.py 2010-08-19 11:51:57 +0000
2987+++ auction/report/total.py 2010-12-13 07:44:48 +0000
2988@@ -35,7 +35,7 @@
2989 def __init__(self, name, table, tmpl, xsl):
2990 report_rml.__init__(self, name, table, tmpl, xsl)
2991
2992- def create_xml(self, cr, uid, ids, datas, context={}):
2993+ def create_xml(self, cr, uid, ids, datas, context=None):
2994 service = netsvc.LocalService("object_proxy")
2995
2996 lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
2997
2998=== modified file 'auction/wizard/auction_aie_send.py'
2999--- auction/wizard/auction_aie_send.py 2010-08-19 11:51:57 +0000
3000+++ auction/wizard/auction_aie_send.py 2010-12-13 07:44:48 +0000
3001@@ -34,7 +34,7 @@
3002 _name = 'auction.lots.send.aie'
3003 _descritption = 'Send to website'
3004
3005- def _date_get(self, cr, uid, context={}):
3006+ def _date_get(self, cr, uid, context=None):
3007 selection = context and context.get('selection')
3008 if selection:
3009 return [('','')] + selection
3010@@ -50,7 +50,7 @@
3011 'img_send': fields.boolean('Send Image also ?'),
3012 }
3013
3014- def default_get(self, cr, uid, fields, context):
3015+ def default_get(self, cr, uid, fields, context=None):
3016 """
3017 To get default values for the object.
3018 @param self: The object pointer.
3019@@ -60,6 +60,8 @@
3020 @param context: A standard dictionary
3021 @return: A dictionary which of fields with values.
3022 """
3023+ if context is None:
3024+ context = {}
3025 res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
3026 if 'uname' in fields and context.get('uname',False):
3027 res['uname'] = context.get('uname')
3028@@ -147,7 +149,9 @@
3029 fname = datas[0]['name']
3030 self._photo_bin_send(uname, passwd, ref, did, fname, bin)
3031
3032- def get_dates(self, cr, uid, ids, context={}):
3033+ def get_dates(self, cr, uid, ids, context=None):
3034+ if context is None:
3035+ context = {}
3036 import httplib
3037 data_obj = self.pool.get('ir.model.data')
3038 conn = httplib.HTTPConnection('www.auction-in-europe.com')
3039@@ -174,14 +178,16 @@
3040 'context': context
3041 }
3042
3043- def _send(self, cr, uid, ids, context={}):
3044+ def _send(self, cr, uid, ids, context=None):
3045 import pickle, thread, sql_db
3046 cr.execute('select name,aie_categ from auction_lot_category')
3047 vals = dict(cr.fetchall())
3048 cr.close()
3049+ if context is None:
3050+ context = {}
3051
3052 service = netsvc.LocalService("object_proxy")
3053- lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
3054+ lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids',[]), ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
3055 lots_ids = []
3056 datas = self.read(cr, uid, ids[0],['uname','login','lang','numerotation','dates'])
3057 for l in lots:
3058@@ -211,7 +217,7 @@
3059 thread.start_new_thread(_photos_send, (cr.dbname, uid, datas['uname'], datas['password'],datas['dates'], lots_ids))
3060 return {}
3061
3062- def send_pdf(self, cr, uid, ids, context):
3063+ def send_pdf(self, cr, uid, ids, context=None):
3064 threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
3065 threaded_calculation.start()
3066 return {}
3067
3068=== modified file 'auction/wizard/auction_aie_send_result.py'
3069--- auction/wizard/auction_aie_send_result.py 2010-05-26 08:28:37 +0000
3070+++ auction/wizard/auction_aie_send_result.py 2010-12-13 07:44:48 +0000
3071@@ -32,7 +32,7 @@
3072 _description = 'Send results to Auction-in-europe.com'
3073
3074
3075- def _date_get(self, cr, uid, context={}):
3076+ def _date_get(self, cr, uid, context=None):
3077 selection = context and context.get('selection')
3078 if selection:
3079 return [('','')] + selection
3080@@ -45,7 +45,7 @@
3081 'dates': fields.selection(_date_get,'Auction Date'),
3082 }
3083
3084- def default_get(self, cr, uid, fields, context):
3085+ def default_get(self, cr, uid, fields, context=None):
3086 """
3087 To get default values for the object.
3088 @param self: The object pointer.
3089@@ -55,6 +55,8 @@
3090 @param context: A standard dictionary
3091 @return: A dictionary which of fields with values.
3092 """
3093+ if context is None:
3094+ context = {}
3095 res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
3096 if 'uname' in fields and context.get('uname',False):
3097 res['uname'] = context.get('uname')
3098@@ -96,7 +98,9 @@
3099 return val
3100 return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
3101
3102- def get_dates(self, cr, uid, ids, context):
3103+ def get_dates(self, cr, uid, ids, context=None):
3104+ if context is None:
3105+ context = {}
3106 import httplib
3107 conn = httplib.HTTPConnection('www.auction-in-europe.com')
3108 data_obj = self.pool.get('ir.model.data')
3109@@ -124,7 +128,9 @@
3110 'context': context
3111 }
3112
3113- def send(self, cr, uid, ids, context):
3114+ def send(self, cr, uid, ids, context=None):
3115+ if context is None:
3116+ context = {}
3117 import pickle
3118 service = netsvc.LocalService("object_proxy")
3119 datas = self.read(cr, uid, ids[0],['uname','password','dates'])
3120
3121=== modified file 'auction/wizard/auction_catalog_flagey_report.py'
3122--- auction/wizard/auction_catalog_flagey_report.py 2010-10-27 13:35:24 +0000
3123+++ auction/wizard/auction_catalog_flagey_report.py 2010-12-13 07:44:48 +0000
3124@@ -27,7 +27,7 @@
3125 _name = 'auction.catalog.flagey'
3126 _description = 'Auction Catalog Flagey'
3127
3128- def default_get(self, cr, uid, fields, context):
3129+ def default_get(self, cr, uid, fields, context=None):
3130 """
3131 To get default values for the object.
3132 @param self: The object pointer.
3133@@ -40,7 +40,7 @@
3134 res = super(auction_catalog_flagey, self).default_get(cr, uid, fields, context=context)
3135 return res
3136
3137- def view_init(self, cr, uid, fields, context):
3138+ def view_init(self, cr, uid, fields, context=None):
3139 """
3140 Creates view dynamically, adding fields at runtime, raises exception
3141 at the time of initialization of view.
3142@@ -53,15 +53,17 @@
3143 """
3144 lots_obj = self.pool.get('auction.lots')
3145 auc_dates_obj = self.pool.get('auction.dates')
3146+ if context is None:
3147+ context = {}
3148 current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', []))
3149 v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)])
3150- v_ids = lots_obj.browse(cr, uid, v_lots)
3151+ v_ids = lots_obj.browse(cr, uid, v_lots, context=context)
3152 for ab in v_ids:
3153 if not ab.auction_id :
3154 raise osv.except_osv(_('Error!'), _('No Lots belong to this Auction Date'))
3155 pass
3156
3157- def print_report(self, cr, uid, ids, context):
3158+ def print_report(self, cr, uid, ids, context=None):
3159 """
3160 Prints auction catalog flagey report.
3161 @param self: The object pointer.
3162@@ -71,6 +73,8 @@
3163 @param context: A standard dictionary
3164 @return: Report
3165 """
3166+ if context is None:
3167+ context = {}
3168 datas = {'ids': context.get('active_ids',[])}
3169 return {
3170 'type': 'ir.actions.report.xml',
3171
3172=== modified file 'auction/wizard/auction_lots_able.py'
3173--- auction/wizard/auction_lots_able.py 2010-04-05 15:53:13 +0000
3174+++ auction/wizard/auction_lots_able.py 2010-12-13 07:44:48 +0000
3175@@ -31,14 +31,16 @@
3176 _name = "auction.lots.able"
3177 _description = "Lots able"
3178
3179- def confirm_able(self, cr, uid, ids, context={}):
3180+ def confirm_able(self, cr, uid, ids, context=None):
3181 """
3182 This function Update auction lots object and set taken away field true.
3183 @param cr: the current row, from the database cursor,
3184 @param uid: the current user’s ID for security checks,
3185 @param ids: List of auction lots able’s IDs.
3186 """
3187- self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'ach_emp':True})
3188+ if context is None:
3189+ context = {}
3190+ self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True})
3191 return {}
3192
3193 auction_lots_able()
3194
3195=== modified file 'auction/wizard/auction_lots_auction_move.py'
3196--- auction/wizard/auction_lots_auction_move.py 2010-08-19 11:51:57 +0000
3197+++ auction/wizard/auction_lots_auction_move.py 2010-12-13 07:44:48 +0000
3198@@ -44,13 +44,13 @@
3199 @param uid: the current user’s ID for security checks,
3200 @param ids: List of auction lots auction move’s IDs.
3201 """
3202- if not context:
3203+ if context is None:
3204 context={}
3205 auction_bid_line_obj = self.pool.get('auction.bid_line')
3206 auction_lot_history_obj = self.pool.get('auction.lot.history')
3207 auction_lots_obj = self.pool.get('auction.lots')
3208 rec_ids = auction_lots_obj.browse(cr, uid, context.get('active_ids', []))
3209- for current in self.browse(cr, uid, ids, context):
3210+ for current in self.browse(cr, uid, ids, context=context):
3211 if not (current.auction_id and len(context.get('active_ids', []))):
3212 return {}
3213
3214
3215=== modified file 'auction/wizard/auction_lots_buyer_map.py'
3216--- auction/wizard/auction_lots_buyer_map.py 2010-10-27 13:35:24 +0000
3217+++ auction/wizard/auction_lots_buyer_map.py 2010-12-13 07:44:48 +0000
3218@@ -32,7 +32,7 @@
3219 'ach_uid': fields.many2one('res.partner','Buyer', required=True),
3220 }
3221
3222- def default_get(self, cr, uid, fields, context):
3223+ def default_get(self, cr, uid, fields, context=None):
3224 """
3225 To get default values for the object.
3226 @param self: The object pointer.
3227@@ -42,14 +42,16 @@
3228 @param context: A standard dictionary
3229 @return: A dictionary which of fields with values.
3230 """
3231- res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context)
3232+ if context is None:
3233+ context = {}
3234+ res = super(wiz_auc_lots_buyer_map,self).default_get(cr, uid, fields, context=context)
3235 auction_lots_obj = self.pool.get('auction.lots')
3236 lots_ids = auction_lots_obj.search(cr, uid, [('ach_uid', '=', ''), ('ach_login', '!=', '')])
3237- for rec in auction_lots_obj.browse(cr, uid, lots_ids, context):
3238+ for rec in auction_lots_obj.browse(cr, uid, lots_ids, context=context):
3239 if (not rec.ach_uid or not rec.ach_login):
3240- res.update(self._start(cr, uid, context.get('active_ids', []), context))
3241+ res.update(self._start(cr, uid, context.get('active_ids', []), context=context))
3242 return res
3243- res.update(self._start(cr, uid, context.get('active_ids', []), context))
3244+ res.update(self._start(cr, uid, context.get('active_ids', []), context=context))
3245 return res
3246
3247 def _start(self, cr, uid, ids, context=None):
3248@@ -62,10 +64,8 @@
3249 @param context: A standard dictionary
3250 @return: login field from current record.
3251 """
3252- if not context:
3253- context={}
3254 lots_obj = self.pool.get('auction.lots')
3255- for rec in lots_obj.browse(cr, uid, ids, context):
3256+ for rec in lots_obj.browse(cr, uid, ids, context=context):
3257 if (len(ids)==1) and (not rec.ach_uid and not rec.ach_login):
3258 raise osv.except_osv(_('Error'), _('No buyer is set for this lot.'))
3259 if not rec.ach_uid and rec.ach_login:
3260@@ -81,13 +81,13 @@
3261 @param ids: List of ids
3262 @param context: A standard dictionary
3263 """
3264- if not context:
3265+ if context is None:
3266 context={}
3267 rec_ids = context and context.get('active_ids',[]) or []
3268 assert rec_ids, _('Active IDs not Found')
3269 lots_obj = self.pool.get('auction.lots')
3270- for current in self.browse(cr, uid, ids):
3271- for lots in lots_obj.browse(cr, uid, rec_ids, context):
3272+ for current in self.browse(cr, uid, ids, context=context):
3273+ for lots in lots_obj.browse(cr, uid, rec_ids, context=context):
3274 if lots.ach_login == current.ach_login:
3275 lots_obj.write(cr, uid, [lots.id], {'ach_uid': current.ach_uid.id}, context=context)
3276 return {}
3277@@ -102,7 +102,7 @@
3278 @param context: A standard dictionary
3279 @return: New arch of view.
3280 """
3281- if not context:
3282+ if context is None:
3283 context={}
3284 record_ids = context and context.get('active_ids', []) or []
3285 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)
3286@@ -111,7 +111,7 @@
3287 lots_obj = self.pool.get('auction.lots')
3288 if record_ids:
3289 try:
3290- for lots in lots_obj.browse(cr, uid, record_ids):
3291+ for lots in lots_obj.browse(cr, uid, record_ids, context=context):
3292 if lots.ach_uid:
3293 res['arch'] = """
3294 <form title="Mapping Result">
3295
3296=== modified file 'auction/wizard/auction_lots_cancel.py'
3297--- auction/wizard/auction_lots_cancel.py 2010-08-10 11:35:06 +0000
3298+++ auction/wizard/auction_lots_cancel.py 2010-12-13 07:44:48 +0000
3299@@ -40,11 +40,11 @@
3300 @param context: A standard dictionary
3301 @return:
3302 """
3303- if not context:
3304+ if context is None:
3305 context={}
3306 lots_obj = self.pool.get('auction.lots')
3307 invoice_obj = self.pool.get('account.invoice')
3308- lot = lots_obj.browse(cr, uid, context.get('active_id', False), context)
3309+ lot = lots_obj.browse(cr, uid, context.get('active_id', False), context=context)
3310 if lot.ach_inv_id:
3311 supplier_refund_inv_id = invoice_obj.refund(cr, uid, [lot.ach_inv_id.id])
3312 if lot.sel_inv_id:
3313
3314=== modified file 'auction/wizard/auction_lots_enable.py'
3315--- auction/wizard/auction_lots_enable.py 2010-04-05 15:53:13 +0000
3316+++ auction/wizard/auction_lots_enable.py 2010-12-13 07:44:48 +0000
3317@@ -28,14 +28,16 @@
3318 'confirm_en':fields.integer('Catalog Number')
3319 }
3320
3321- def confirm_enable(self, cr, uid, ids, context={}):
3322+ def confirm_enable(self, cr, uid, ids, context=None):
3323 """
3324 This function Update auction lots object and set taken away field False.
3325 @param cr: the current row, from the database cursor,
3326 @param uid: the current user’s ID for security checks,
3327 @param ids: List of auction lots enable’s IDs.
3328 """
3329- self.pool.get('auction.lots').write(cr, uid, context['active_id'], {'ach_emp':False})
3330+ if context is None:
3331+ context = {}
3332+ self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False})
3333 return {}
3334
3335 auction_lots_enable()
3336
3337=== modified file 'auction/wizard/auction_lots_invoice.py'
3338--- auction/wizard/auction_lots_invoice.py 2010-08-19 11:51:57 +0000
3339+++ auction/wizard/auction_lots_invoice.py 2010-12-13 07:44:48 +0000
3340@@ -36,7 +36,7 @@
3341 'number': fields.integer('Invoice Number'),
3342 }
3343
3344- def default_get(self, cr, uid, fields, context={}):
3345+ def default_get(self, cr, uid, fields, context=None):
3346 """
3347 To get default values for the object.
3348 @param self: The object pointer.
3349@@ -46,6 +46,8 @@
3350 @param context: A standard dictionary
3351 @return: A dictionary which of fields with values.
3352 """
3353+ if context is None:
3354+ context = {}
3355 res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
3356 service = netsvc.LocalService("object_proxy")
3357 lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
3358@@ -78,7 +80,7 @@
3359
3360 #TODO: recuperer id next invoice (de la sequence)???
3361 invoice_number = False
3362- for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', [])):
3363+ for lot in self.pool.get('auction.lots').browse(cr, uid, context.get('active_ids', []), context=context):
3364 if 'objects' in fields:
3365 res.update({'objects':len(context.get('active_ids', []))})
3366 if 'amount' in fields:
3367@@ -93,7 +95,7 @@
3368 res.update({'number':invoice_number})
3369 return res
3370
3371- def print_report(self, cr, uid, ids, context={}):
3372+ def print_report(self, cr, uid, ids, context=None):
3373 """
3374 Create an invoice report.
3375 @param cr: the current row, from the database cursor.
3376@@ -101,6 +103,8 @@
3377 @param ids: List of Auction lots make invoice buyer’s IDs
3378 @return: dictionary of account invoice form.
3379 """
3380+ if context is None:
3381+ context = {}
3382 service = netsvc.LocalService("object_proxy")
3383 datas = {'ids' : context.get('active_ids',[])}
3384 res = self.read(cr, uid, ids, ['number','ach_uid'])
3385
3386=== modified file 'auction/wizard/auction_lots_make_invoice.py'
3387--- auction/wizard/auction_lots_make_invoice.py 2010-08-05 10:26:19 +0000
3388+++ auction/wizard/auction_lots_make_invoice.py 2010-12-13 07:44:48 +0000
3389@@ -50,11 +50,11 @@
3390 @param context: A standard dictionary
3391 @return: A dictionary which of fields with values.
3392 """
3393- if not context:
3394+ if context is None:
3395 context={}
3396 res = super(auction_lots_make_invoice, self).default_get(cr, uid, fields, context=context)
3397 lots_obj = self.pool.get('auction.lots')
3398- for lot in lots_obj.browse(cr, uid, context.get('active_ids', [])):
3399+ for lot in lots_obj.browse(cr, uid, context.get('active_ids', []), context=context):
3400 if 'amount' in fields:
3401 res.update({'amount': lot.seller_price})
3402 if 'objects' in fields:
3403@@ -69,13 +69,13 @@
3404 @param ids: List of Auction lots make invoice’s IDs
3405 @return: dictionary of account invoice form.
3406 """
3407- if not context:
3408+ if context is None:
3409 context={}
3410 order_obj = self.pool.get('auction.lots')
3411 mod_obj = self.pool.get('ir.model.data')
3412 result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
3413 id = mod_obj.read(cr, uid, result, ['res_id'])
3414- lots_ids = order_obj.seller_trans_create(cr, uid, context.get('active_ids', []), context)
3415+ lots_ids = order_obj.seller_trans_create(cr, uid, context.get('active_ids', []), context=context)
3416 return {
3417 'domain': "[('id','in', ["+','.join(map(str, lots_ids))+"])]",
3418 'name': 'Seller invoices',
3419
3420=== modified file 'auction/wizard/auction_lots_make_invoice_buyer.py'
3421--- auction/wizard/auction_lots_make_invoice_buyer.py 2010-08-05 10:26:19 +0000
3422+++ auction/wizard/auction_lots_make_invoice_buyer.py 2010-12-13 07:44:48 +0000
3423@@ -45,11 +45,11 @@
3424 @param context: A standard dictionary
3425 @return: A dictionary which of fields with values.
3426 """
3427- if not context:
3428+ if context is None:
3429 context={}
3430 res = super(auction_lots_make_invoice_buyer, self).default_get(cr, uid, fields, context=context)
3431 lots_obj=self.pool.get('auction.lots')
3432- for lot in lots_obj.browse(cr, uid, context.get('active_ids', [])):
3433+ for lot in lots_obj.browse(cr, uid, context.get('active_ids', []), context=context):
3434 if 'amount' in fields:
3435 res.update({'amount': lot.buyer_price})
3436 if 'buyer_id' in fields:
3437@@ -58,7 +58,7 @@
3438 res.update({'objects': len(context.get('active_ids', []))})
3439 return res
3440
3441- def makeInvoices(self, cr, uid, ids, context):
3442+ def makeInvoices(self, cr, uid, ids, context=None):
3443 """
3444 Create an invoice for selected lots (IDS) to BUYER_ID .
3445 @param cr: the current row, from the database cursor.
3446@@ -70,8 +70,8 @@
3447 mod_obj = self.pool.get('ir.model.data')
3448 result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
3449 id = mod_obj.read(cr, uid, result, ['res_id'])
3450- lots = order_obj.browse(cr, uid, context.get('active_ids', []))
3451- for current in self.browse(cr, uid, ids, context):
3452+ lots = order_obj.browse(cr, uid, context.get('active_ids', []), context=context)
3453+ for current in self.browse(cr, uid, ids, context=context):
3454 invoice_number = current.number
3455 for lot in lots:
3456 up_auction = order_obj.write(cr, uid, [lot.id], {'ach_uid': current.buyer_id.id})
3457
3458=== modified file 'auction/wizard/auction_lots_numerotate.py'
3459--- auction/wizard/auction_lots_numerotate.py 2010-10-27 13:35:24 +0000
3460+++ auction/wizard/auction_lots_numerotate.py 2010-12-13 07:44:48 +0000
3461@@ -38,7 +38,7 @@
3462 'obj_num': fields.integer('Catalog Number', required=True)
3463 }
3464
3465- def default_get(self, cr, uid, fields, context):
3466+ def default_get(self, cr, uid, fields, context=None):
3467 """
3468 To get default values for the object.
3469 @param self: The object pointer.
3470@@ -48,13 +48,14 @@
3471 @param context: A standard dictionary
3472 @return: A dictionary which of fields with values.
3473 """
3474+ if context is None: context = {}
3475 res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context)
3476 active_id = context.get('active_id',False)
3477 active_model = context.get('active_model')
3478 if active_id and (active_model and active_model!='auction.lots'):
3479 return res
3480 lots_obj = self.pool.get('auction.lots')
3481- lots = lots_obj.browse(cr, uid, active_id)
3482+ lots = lots_obj.browse(cr, uid, active_id, context=context)
3483 if 'bord_vnd_id' in fields and context.get('bord_vnd_id',False):
3484 res['bord_vnd_id'] = context.get('bord_vnd_id')
3485 if 'lot_num' in fields and context.get('lot_num',False):
3486@@ -71,7 +72,7 @@
3487 res['obj_num'] = lots.obj_num
3488 return res
3489
3490- def open_init_form(self, cr, uid, ids, context={}):
3491+ def open_init_form(self, cr, uid, ids, context=None):
3492 record_ids = context and context.get('active_ids',False) or False
3493 assert record_ids, _('Active IDs not Found')
3494 data_obj = self.pool.get('ir.model.data')
3495@@ -89,7 +90,7 @@
3496 'context': context
3497 }
3498
3499- def numerotate(self, cr, uid, ids, context={}):
3500+ def numerotate(self, cr, uid, ids, context=None):
3501 record_ids = context and context.get('active_ids',False) or False
3502 assert record_ids, _('Active IDs not Found')
3503 datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
3504@@ -116,7 +117,7 @@
3505 'context': context
3506 }
3507
3508- def read_record(self, cr, uid, ids, context={}):
3509+ def read_record(self, cr, uid, ids, context=None):
3510 record_ids = context and context.get('active_ids',False) or False
3511 assert record_ids, _('Active IDs not Found')
3512 datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num'])
3513@@ -131,7 +132,7 @@
3514 'lot_est2', 'obj_desc'])
3515 return lots_datas[0]
3516
3517- def test_exist(self, cr, uid, ids, context={}):
3518+ def test_exist(self, cr, uid, ids, context=None):
3519 record_ids = context and context.get('active_ids',False) or False
3520 assert record_ids, _('Active IDs not Found')
3521 data_obj = self.pool.get('ir.model.data')
3522@@ -167,13 +168,13 @@
3523 'number': fields.integer('First Number', required=True)
3524 }
3525
3526- def numerotate_cont(self, cr, uid, ids, context={}):
3527+ def numerotate_cont(self, cr, uid, ids, context=None):
3528 record_ids = context and context.get('active_ids',False) or False
3529 assert record_ids, _('Active IDs not Found')
3530 datas = self.read(cr, uid, ids[0], ['number'])
3531 nbr = int(datas['number'])
3532 lots_obj = self.pool.get('auction.lots')
3533- rec_ids = lots_obj.browse(cr, uid, record_ids)
3534+ rec_ids = lots_obj.browse(cr, uid, record_ids, context=context)
3535 for rec_id in rec_ids:
3536 lots_obj.write(cr, uid, [rec_id.id], {'obj_num':nbr})
3537 nbr+=1
3538
3539=== modified file 'auction/wizard/auction_lots_sms_send.py'
3540--- auction/wizard/auction_lots_sms_send.py 2010-08-17 07:04:50 +0000
3541+++ auction/wizard/auction_lots_sms_send.py 2010-12-13 07:44:48 +0000
3542@@ -34,7 +34,7 @@
3543 'text':fields.text('SMS Message', required=True)
3544 }
3545
3546- def sms_send(self, cr, uid, ids, context):
3547+ def sms_send(self, cr, uid, ids, context=None):
3548 """
3549 to send sms
3550
3551@@ -44,18 +44,18 @@
3552 @param context: A standard dictionary
3553 @return: number indicating the acknowledgement
3554 """
3555-
3556+ if context is None: context = {}
3557 lot_obj = self.pool.get('auction.lots')
3558 partner_obj = self.pool.get('res.partner')
3559 partner_address_obj = self.pool.get('res.partner.address')
3560- for data in self.read(cr, uid, ids):
3561- lots = lot_obj.read(cr, uid, context['active_ids'], ['obj_num','obj_price','ach_uid'])
3562+ for data in self.read(cr, uid, ids, context=context):
3563+ lots = lot_obj.read(cr, uid, context.get('active_ids', []), ['obj_num','obj_price','ach_uid'])
3564 res = partner_obj.read(cr, uid, [l['ach_uid'][0] for l in lots if l['ach_uid']], ['gsm'], context)
3565
3566 nbr = 0
3567 for r in res:
3568 add = partner_obj.address_get(cr, uid, [r['id']])['default']
3569- addr = partner_address_obj.browse(cr, uid, add)
3570+ addr = partner_address_obj.browse(cr, uid, add, context=context)
3571 to = addr.mobile
3572 if to:
3573 tools.smssend(data['user'], data['password'], data['app_id'], unicode(data['text'], 'utf-8').encode('latin1'), to)
3574
3575=== modified file 'auction/wizard/auction_pay_buy.py'
3576--- auction/wizard/auction_pay_buy.py 2010-10-27 13:35:24 +0000
3577+++ auction/wizard/auction_pay_buy.py 2010-12-13 07:44:48 +0000
3578@@ -48,11 +48,11 @@
3579 @param context: A standard dictionary
3580 @return: A dictionary which of fields with values.
3581 """
3582- if not context:
3583+ if context is None:
3584 context={}
3585 res = super(auction_pay_buy, self).default_get(cr, uid, fields, context=context)
3586 auction_lots_obj= self.pool.get('auction.lots')
3587- for lot in auction_lots_obj.browse(cr, uid, context.get('active_ids', [])):
3588+ for lot in auction_lots_obj.browse(cr, uid, context.get('active_ids', []), context=context):
3589 if 'amount' in fields:
3590 res.update({'amount': lot.buyer_price})
3591 if 'buyer_id' in fields:
3592@@ -61,7 +61,7 @@
3593 res.update({'total': lot.buyer_price})
3594 return res
3595
3596- def pay_and_reconcile(self, cr, uid, ids, context):
3597+ def pay_and_reconcile(self, cr, uid, ids, context=None):
3598 """
3599 Pay and Reconcile
3600 @param cr: the current row, from the database cursor.
3601@@ -70,15 +70,16 @@
3602 @param context: A standard dictionary
3603 @return:
3604 """
3605+ if context is None: context = {}
3606 lot_obj = self.pool.get('auction.lots')
3607 bank_statement_line_obj = self.pool.get('account.bank.statement.line')
3608
3609- for datas in self.read(cr, uid, ids):
3610+ for datas in self.read(cr, uid, ids, context=context):
3611 if not abs(datas['total'] - (datas['amount'] + datas['amount2'] + datas['amount3'])) <0.01:
3612 rest = datas['total'] - (datas['amount'] + datas['amount2'] + datas['amount3'])
3613 raise osv.except_osv(_('Payment aborted !'), _('You should pay all the total: "%.2f" are missing to accomplish the payment.') %(round(rest, 2)))
3614
3615- lots = lot_obj.browse(cr, uid, context['active_ids'], context)
3616+ lots = lot_obj.browse(cr, uid, context.get('active_ids', []), context=context)
3617 for lot in lots:
3618 if datas['buyer_id']:
3619 lot_obj.write(cr, uid, [lot.id], {'ach_uid': datas['buyer_id']})
3620
3621=== modified file 'auction/wizard/auction_pay_sel.py'
3622--- auction/wizard/auction_pay_sel.py 2010-08-19 11:51:57 +0000
3623+++ auction/wizard/auction_pay_sel.py 2010-12-13 07:44:48 +0000
3624@@ -33,7 +33,7 @@
3625 'period_id':fields.many2one('account.period', 'Period', required=True),
3626 }
3627
3628- def pay_and_reconcile(self, cr, uid, ids, context):
3629+ def pay_and_reconcile(self, cr, uid, ids, context=None):
3630 """
3631 Pay and Reconcile
3632 @param cr: the current row, from the database cursor.
3633@@ -42,9 +42,11 @@
3634 @param context: A standard dictionary
3635 @return:
3636 """
3637- lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context)
3638+ if context is None:
3639+ context = {}
3640+ lot = self.pool.get('auction.lots').browse(cr, uid, context['active_id'], context=context)
3641 invoice_obj = self.pool.get('account.invoice')
3642- for datas in self.read(cr, uid, ids):
3643+ for datas in self.read(cr, uid, ids, context=context):
3644 account_id = datas.get('writeoff_acc_id', False)
3645 period_id = datas.get('period_id', False)
3646 journal_id = datas.get('journal_id', False)
3647
3648=== modified file 'auction/wizard/auction_payer_sel.py'
3649--- auction/wizard/auction_payer_sel.py 2010-07-29 12:06:16 +0000
3650+++ auction/wizard/auction_payer_sel.py 2010-12-13 07:44:48 +0000
3651@@ -25,7 +25,9 @@
3652 _name = "auction.payer"
3653 _description = "Auction payer"
3654
3655- def payer(self, cr, uid, ids, context):
3656+ def payer(self, cr, uid, ids, context=None):
3657+ if context is None:
3658+ context = {}
3659 self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'})
3660 return {}
3661
3662@@ -38,14 +40,16 @@
3663 _name = "auction.payer.sel"
3664 _description = "Auction payment for seller"
3665
3666- def payer_sel(self, cr, uid, ids, context):
3667+ def payer_sel(self, cr, uid, ids, context=None):
3668 """
3669 This function Update auction lots object and seller paid true.
3670 @param cr: the current row, from the database cursor,
3671 @param uid: the current user’s ID for security checks,
3672 @param ids: List of auction payer sel’s IDs.
3673 """
3674- self.pool.get('auction.lots').write(cr, uid, context['active_ids'], {'paid_vnd':True})
3675+ if context is None:
3676+ context = {}
3677+ self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True})
3678 return {}
3679
3680 auction_payer_sel()
3681
3682=== modified file 'auction/wizard/auction_taken.py'
3683--- auction/wizard/auction_taken.py 2010-09-27 08:28:04 +0000
3684+++ auction/wizard/auction_taken.py 2010-12-13 07:44:48 +0000
3685@@ -42,10 +42,10 @@
3686 @param ids: List of Auction taken’s IDs
3687 @return: dictionary of lot_ids fields with empty list
3688 """
3689- if not context:
3690+ if context is None:
3691 context={}
3692 lot_obj = self.pool.get('auction.lots')
3693- for current in self.browse(cr, uid, ids, context):
3694+ for current in self.browse(cr, uid, ids, context=context):
3695 for lot in current.lot_ids:
3696 lot_obj.write(cr, uid, lot.id, {'state':'taken_away', 'ach_emp': True})
3697 return {'lot_ids': []}
3698
3699=== modified file 'auction/wizard/auction_transfer_unsold_object.py'
3700--- auction/wizard/auction_transfer_unsold_object.py 2010-08-17 07:04:50 +0000
3701+++ auction/wizard/auction_transfer_unsold_object.py 2010-12-13 07:44:48 +0000
3702@@ -29,7 +29,7 @@
3703 _name = 'auction.transfer.unsold.object'
3704 _description = 'To transfer unsold objects'
3705
3706- def _start(self, cr, uid, context):
3707+ def _start(self, cr, uid, context=None):
3708 """
3709 To initialize auction_id_from
3710 @param self: The object pointer.
3711@@ -40,7 +40,7 @@
3712 @return: auction_id_from
3713 """
3714 lots_obj = self.pool.get('auction.lots')
3715- rec = lots_obj.browse(cr, uid, context['active_id'], context)
3716+ rec = lots_obj.browse(cr, uid, context.get('active_id', False), context=context)
3717 auction_from = rec and rec.auction_id.id or False
3718 return auction_from
3719
3720@@ -53,7 +53,7 @@
3721 'auction_id_from': _start,
3722 }
3723
3724- def transfer_unsold_object(self, cr, uid, ids, context):
3725+ def transfer_unsold_object(self, cr, uid, ids, context=None):
3726 """
3727 To Transfer the unsold object
3728 @param self: The object pointer.
3729@@ -63,15 +63,16 @@
3730 @param context: A standard dictionary
3731 @return:
3732 """
3733+ if context is None: context = {}
3734 bid_line_obj = self.pool.get('auction.bid_line')
3735 lots_obj = self.pool.get('auction.lots')
3736 lot_history_obj = self.pool.get('auction.lot.history')
3737- line_ids= bid_line_obj.search(cr, uid, [('lot_id','in',context['active_ids'])])
3738+ line_ids= bid_line_obj.search(cr, uid, [('lot_id','in',context.get('active_ids', []))])
3739 bid_line_obj.unlink(cr, uid, line_ids)
3740
3741- res = self.browse(cr, uid, ids)
3742+ res = self.browse(cr, uid, ids, context=context)
3743 unsold_ids = lots_obj.search(cr,uid,[('auction_id','=',res[0].auction_id_from.id),('state','=','unsold')])
3744- for rec in lots_obj.browse(cr, uid, unsold_ids, context):
3745+ for rec in lots_obj.browse(cr, uid, unsold_ids, context=context):
3746 new_id = lot_history_obj.create(cr, uid, {'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1})
3747 up_auction = lots_obj.write(cr, uid, [rec.id], {'auction_id': res[0].auction_id_to.id,
3748 'obj_ret':None,
3749
3750=== modified file 'audittrail/wizard/audittrail_view_log.py'
3751--- audittrail/wizard/audittrail_view_log.py 2010-08-19 11:51:57 +0000
3752+++ audittrail/wizard/audittrail_view_log.py 2010-12-13 07:44:48 +0000
3753@@ -42,17 +42,15 @@
3754 @param ids: List of audittrail view log’s IDs.
3755 @return: Dictionary of audittrail log form on given date range.
3756 """
3757- if not context:
3758- context = {}
3759
3760 mod_obj = self.pool.get('ir.model.data')
3761 act_obj = self.pool.get('ir.actions.act_window')
3762 result = mod_obj._get_id(cr, uid, 'audittrail', 'action_audittrail_log_tree')
3763- id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
3764- result = act_obj.read(cr, uid, [id])[0]
3765+ id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
3766+ result = act_obj.read(cr, uid, [id], context=context)[0]
3767
3768 #start Loop
3769- for datas in self.read(cr, uid, ids):
3770+ for datas in self.read(cr, uid, ids, context=context):
3771 if not datas.get('from', None):
3772 if datas.get('to') <> time.strftime("%Y-%m-%d %H:%M:%S"):
3773 result['domain'] = str([('timestamp', '<', datas.get('to'))])
3774
3775=== modified file 'base_action_rule/base_action_rule.py'
3776--- base_action_rule/base_action_rule.py 2010-11-18 07:08:23 +0000
3777+++ base_action_rule/base_action_rule.py 2010-12-13 07:44:48 +0000
3778@@ -35,7 +35,7 @@
3779 _name = 'base.action.rule'
3780 _description = 'Action Rules'
3781
3782- def _state_get(self, cr, uid, context={}):
3783+ def _state_get(self, cr, uid, context=None):
3784 """ Get State
3785 @param self: The object pointer
3786 @param cr: the current row, from the database cursor,
3787@@ -43,7 +43,7 @@
3788 @param context: A standard dictionary for contextual values """
3789 return self.state_get(cr, uid, context=context)
3790
3791- def state_get(self, cr, uid, context={}):
3792+ def state_get(self, cr, uid, context=None):
3793 """ Get State
3794 @param self: The object pointer
3795 @param cr: the current row, from the database cursor,
3796@@ -51,7 +51,7 @@
3797 @param context: A standard dictionary for contextual values """
3798 return [('', '')]
3799
3800- def priority_get(self, cr, uid, context={}):
3801+ def priority_get(self, cr, uid, context=None):
3802 """ Get Priority
3803 @param self: The object pointer
3804 @param cr: the current row, from the database cursor,
3805@@ -157,7 +157,7 @@
3806 return True
3807
3808 def _create(self, old_create, model, context=None):
3809- if not context:
3810+ if context is None:
3811 context = {}
3812 def make_call_old(cr, uid, vals, context=context):
3813 new_id = old_create(cr, uid, vals, context=context)
3814@@ -167,7 +167,7 @@
3815 return make_call_old
3816
3817 def _write(self, old_write, model, context=None):
3818- if not context:
3819+ if context is None:
3820 context = {}
3821 def make_call_old(cr, uid, ids, vals, context=context):
3822 if isinstance(ids, (str, int, long)):
3823@@ -178,7 +178,7 @@
3824 return make_call_old
3825
3826 def _register_hook(self, cr, uid, ids, context=None):
3827- if not context:
3828+ if context is None:
3829 context = {}
3830 for action_rule in self.browse(cr, uid, ids, context=context):
3831 model = action_rule.model_id.model
3832@@ -190,12 +190,12 @@
3833
3834 return True
3835 def create(self, cr, uid, vals, context=None):
3836- res_id = super(base_action_rule, self).create(cr, uid, vals, context)
3837+ res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
3838 self._register_hook(cr, uid, [res_id], context=context)
3839 return res_id
3840
3841 def write(self, cr, uid, ids, vals, context=None):
3842- res = super(base_action_rule, self).write(cr, uid, ids, vals, context)
3843+ res = super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
3844 self._register_hook(cr, uid, ids, context=context)
3845 return res
3846
3847@@ -396,7 +396,7 @@
3848 if not scrit:
3849 scrit = []
3850
3851- for action in self.browse(cr, uid, ids, context):
3852+ for action in self.browse(cr, uid, ids, context=context):
3853 model_obj = self.pool.get(action.model_id.model)
3854 for obj in objects:
3855 ok = self.do_check(cr, uid, action, obj, context=context)
3856@@ -454,7 +454,7 @@
3857
3858 empty = orm.browse_null()
3859 rule_obj = self.pool.get('base.action.rule')
3860- for rule in self.browse(cr, uid, ids):
3861+ for rule in self.browse(cr, uid, ids, context=context):
3862 if rule.act_mail_body:
3863 try:
3864 rule_obj.format_mail(empty, rule.act_mail_body)
3865
3866=== modified file 'base_calendar/base_calendar.py'
3867--- base_calendar/base_calendar.py 2010-11-15 06:23:57 +0000
3868+++ base_calendar/base_calendar.py 2010-12-13 07:44:48 +0000
3869@@ -106,7 +106,6 @@
3870 @param context: A standard dictionary for contextual values
3871 @return: list of dictionary which contain object and name and id.
3872 """
3873-
3874 obj = self.pool.get('res.request.link')
3875 ids = obj.search(cr, uid, [])
3876 res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
3877@@ -222,7 +221,7 @@
3878 name += ':'
3879 return (name or '') + (email and ('MAILTO:' + email) or '')
3880
3881- def _compute_data(self, cr, uid, ids, name, arg, context):
3882+ def _compute_data(self, cr, uid, ids, name, arg, context=None):
3883 """
3884 Compute data on function fields for attendee values .
3885 @param cr: the current row, from the database cursor,
3886@@ -300,7 +299,6 @@
3887 @param context: A standard dictionary for contextual values
3888 @return: list of dictionary which contain object and name and id.
3889 """
3890-
3891 obj = self.pool.get('res.request.link')
3892 ids = obj.search(cr, uid, [])
3893 res = obj.read(cr, uid, ids, ['object', 'name'], context=context)
3894@@ -649,7 +647,7 @@
3895 model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
3896
3897 model_obj = self.pool.get(model)
3898- for data in model_obj.browse(cr, uid, ids, context):
3899+ for data in model_obj.browse(cr, uid, ids, context=context):
3900
3901 basic_alarm = data.alarm_id
3902 cal_alarm = data.base_calendar_alarm_id
3903@@ -719,7 +717,7 @@
3904 ir_obj = self.pool.get('ir.model')
3905 model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
3906 model_obj = self.pool.get(model)
3907- for datas in model_obj.browse(cr, uid, ids, context):
3908+ for datas in model_obj.browse(cr, uid, ids, context=context):
3909 alarm_ids = alarm_obj.search(cr, uid, [('model_id', '=', model_id), ('res_id', '=', datas.id)])
3910 if alarm_ids:
3911 alarm_obj.unlink(cr, uid, alarm_ids)
3912@@ -794,7 +792,7 @@
3913 delta = timedelta(minutes=vals['trigger_duration'])
3914 trigger_date = dtstart + (vals['trigger_occurs'] == 'after' and delta or -delta)
3915 vals['trigger_date'] = trigger_date
3916- res = super(calendar_alarm, self).create(cr, uid, vals, context)
3917+ res = super(calendar_alarm, self).create(cr, uid, vals, context=context)
3918 return res
3919
3920 def do_run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, \
3921@@ -1685,7 +1683,7 @@
3922 _inherit = "calendar.event"
3923 _description = "Calendar Task"
3924
3925- def _get_date(self, cr, uid, ids, name, arg, context):
3926+ def _get_date(self, cr, uid, ids, name, arg, context=None):
3927 """
3928 Get Date
3929 @param self: The object pointer
3930@@ -1701,7 +1699,7 @@
3931 res[event.id] = event.date_start
3932 return res
3933
3934- def _set_date(self, cr, uid, id, name, value, arg, context):
3935+ def _set_date(self, cr, uid, id, name, value, arg, context=None):
3936 """
3937 Set Date
3938 @param self: The object pointer
3939
3940=== modified file 'base_calendar/wizard/base_calendar_invite_attendee.py'
3941--- base_calendar/wizard/base_calendar_invite_attendee.py 2010-10-04 05:14:05 +0000
3942+++ base_calendar/wizard/base_calendar_invite_attendee.py 2010-12-13 07:44:48 +0000
3943@@ -62,7 +62,7 @@
3944 @return: Dictionary of {}.
3945 """
3946
3947- if not context:
3948+ if context is None:
3949 context = {}
3950
3951 model = False
3952@@ -74,7 +74,7 @@
3953
3954 model_field = context.get('attendee_field', False)
3955 obj = self.pool.get(model)
3956- res_obj = obj.browse(cr, uid, context_id)
3957+ res_obj = obj.browse(cr, uid, context_id, context=context)
3958 att_obj = self.pool.get('calendar.attendee')
3959 user_obj = self.pool.get('res.users')
3960 current_user = user_obj.browse(cr, uid, uid, context=context)
3961
3962=== modified file 'base_calendar/wizard/base_calendar_set_exrule.py'
3963--- base_calendar/wizard/base_calendar_set_exrule.py 2010-09-29 08:05:01 +0000
3964+++ base_calendar/wizard/base_calendar_set_exrule.py 2010-12-13 07:44:48 +0000
3965@@ -82,8 +82,10 @@
3966 @param fields: List of fields for default value
3967 @param context: A standard dictionary for contextual values
3968 """
3969+ if context is None:
3970+ context = {}
3971 event_obj = self.pool.get(context.get('active_model'))
3972- for event in event_obj.browse(cr, uid, context.get('active_ids', [])):
3973+ for event in event_obj.browse(cr, uid, context.get('active_ids', []), context=context):
3974 if not event.rrule:
3975 raise osv.except_osv(_("Warning !"), _("Please Apply Recurrency before applying Exception Rule."))
3976 return False
3977@@ -102,7 +104,9 @@
3978 weekstring = ''
3979 monthstring = ''
3980 yearstring = ''
3981- ex_id = base_calendar.base_calendar_id2real_id(context['active_id'])
3982+ if context is None:
3983+ context = {}
3984+ ex_id = base_calendar.base_calendar_id2real_id(context.get('active_id', False))
3985 model = context.get('model', False)
3986 model_obj = self.pool.get(model)
3987 for datas in self.read(cr, uid, ids, context=context):
3988
3989=== modified file 'base_calendar/wizard/calendar_event_edit_all.py'
3990--- base_calendar/wizard/calendar_event_edit_all.py 2010-04-29 08:01:54 +0000
3991+++ base_calendar/wizard/calendar_event_edit_all.py 2010-12-13 07:44:48 +0000
3992@@ -24,7 +24,7 @@
3993
3994 class calendar_event_edit_all(osv.osv_memory):
3995
3996- def _default_values(self, cr, uid, context={}):
3997+ def _default_values(self, cr, uid, context=None):
3998 """ Get Default value for Start Date
3999 @param self: The object pointer
4000 @param cr: the current row, from the database cursor,
4001@@ -42,7 +42,7 @@
4002 event = model_obj.read(cr, uid, context_id, ['name', 'location', 'alarm_id'])
4003 return event['date']
4004
4005- def _default_deadline(self, cr, uid, context={}):
4006+ def _default_deadline(self, cr, uid, context=None):
4007 """ Get Default value for End Date
4008 @param self: The object pointer
4009 @param cr: the current row, from the database cursor,
4010@@ -69,7 +69,7 @@
4011 @param ids: List of calendar event edit all’s IDs
4012 @return: dictionary {}
4013 """
4014- if not context:
4015+ if context is None:
4016 context = {}
4017
4018 context_id = context and context.get('active_id', False) or False
4019
4020=== modified file 'base_contact/base_contact.py'
4021--- base_contact/base_contact.py 2010-11-15 13:15:55 +0000
4022+++ base_contact/base_contact.py 2010-12-13 07:44:48 +0000
4023@@ -42,7 +42,7 @@
4024 all_job_ids = res_partner_job_obj.search(cr, uid, [])
4025 all_job_names = dict(zip(all_job_ids, res_partner_job_obj.name_get(cr, uid, all_job_ids, context=context)))
4026
4027- for contact in self.browse(cr, uid, ids, context):
4028+ for contact in self.browse(cr, uid, ids, context=context):
4029 if contact.job_ids:
4030 res[contact.id] = all_job_names.get(contact.job_ids[0].id, False)
4031
4032@@ -77,7 +77,7 @@
4033
4034 _order = "name,first_name"
4035
4036- def name_get(self, cr, user, ids, context={}):
4037+ def name_get(self, cr, user, ids, context=None):
4038
4039 """ will return name and first_name.......
4040 @param self: The object pointer
4041@@ -119,7 +119,7 @@
4042 class res_partner_address(osv.osv):
4043
4044 #overriding of the name_get defined in base in order to remove the old contact name
4045- def name_get(self, cr, user, ids, context={}):
4046+ def name_get(self, cr, user, ids, context=None):
4047 """
4048 @param self: The object pointer
4049 @param cr: the current row, from the database cursor,
4050@@ -131,6 +131,8 @@
4051 if not len(ids):
4052 return []
4053 res = []
4054+ if context is None:
4055+ context = {}
4056 for r in self.read(cr, user, ids, ['zip', 'city', 'partner_id', 'street']):
4057 if context.get('contact_display', 'contact')=='partner' and r['partner_id']:
4058 res.append((r['id'], r['partner_id'][1]))
4059@@ -168,7 +170,7 @@
4060 return []
4061 res = []
4062
4063- jobs = self.browse(cr, uid, ids)
4064+ jobs = self.browse(cr, uid, ids, context=context)
4065
4066 contact_ids = [rec.contact_id.id for rec in jobs]
4067 contact_names = dict(self.pool.get('res.partner.contact').name_get(cr, uid, contact_ids, context=context))
4068@@ -238,7 +240,7 @@
4069 partner_id = False
4070 if address_id:
4071 address = self.pool.get('res.partner.address')\
4072- .browse(cr, uid, address_id, context)
4073+ .browse(cr, uid, address_id, context=context)
4074 partner_id = address.partner_id.id
4075 return {'value': {'name': partner_id}}
4076
4077
4078=== modified file 'base_contact/base_contact_installer.py'
4079--- base_contact/base_contact_installer.py 2010-09-09 13:06:03 +0000
4080+++ base_contact/base_contact_installer.py 2010-12-13 07:44:48 +0000
4081@@ -35,7 +35,7 @@
4082 """
4083 This function is used to create contact and address from existing partner address
4084 """
4085- obj = self.pool.get("base.contact.installer").browse(cr, uid, uid)
4086+ obj = self.pool.get("base.contact.installer").browse(cr, uid, uid, context=context)
4087 if obj.migrate:
4088 cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact;
4089 DROP LANGUAGE IF EXISTS plpgsql CASCADE;
4090
4091=== modified file 'base_iban/base_iban.py'
4092--- base_iban/base_iban.py 2010-11-23 04:44:48 +0000
4093+++ base_iban/base_iban.py 2010-12-13 07:44:48 +0000
4094@@ -73,23 +73,23 @@
4095 class res_partner_bank(osv.osv):
4096 _inherit = "res.partner.bank"
4097
4098- def create(self, cr, uid, vals, context={}):
4099+ def create(self, cr, uid, vals, context=None):
4100 #overwrite to format the iban number correctly
4101 if 'iban' in vals and vals['iban']:
4102 vals['iban'] = _format_iban(vals['iban'])
4103 return super(res_partner_bank, self).create(cr, uid, vals, context)
4104
4105- def write(self, cr, uid, ids, vals, context={}):
4106+ def write(self, cr, uid, ids, vals, context=None):
4107 #overwrite to format the iban number correctly
4108 if 'iban' in vals and vals['iban']:
4109 vals['iban'] = _format_iban(vals['iban'])
4110 return super(res_partner_bank, self).write(cr, uid, ids, vals, context)
4111
4112- def check_iban(self, cr, uid, ids):
4113+ def check_iban(self, cr, uid, ids, context=None):
4114 '''
4115 Check the IBAN number
4116 '''
4117- for bank_acc in self.browse(cr, uid, ids):
4118+ for bank_acc in self.browse(cr, uid, ids, context=context):
4119 if not bank_acc.iban:
4120 continue
4121 iban = _format_iban(bank_acc.iban).lower()
4122@@ -109,7 +109,7 @@
4123 return False
4124 return True
4125
4126- def _construct_constraint_msg(self, cr, uid, ids):
4127+ def _construct_constraint_msg(self, cr, uid, ids, context=None):
4128
4129 def default_iban_check(iban_cn):
4130 return iban_cn[0] in string.ascii_lowercase and iban_cn[1] in string.ascii_lowercase
4131@@ -123,12 +123,12 @@
4132 def name_get(self, cr, uid, ids, context=None):
4133 res = []
4134 to_check_ids = []
4135- for id in self.browse(cr, uid, ids):
4136+ for id in self.browse(cr, uid, ids, context=context):
4137 if id.state=='iban':
4138 res.append((id.id,id.iban))
4139 else:
4140 to_check_ids.append(id.id)
4141- res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context)
4142+ res += super(res_partner_bank, self).name_get(cr, uid, to_check_ids, context=context)
4143 return res
4144
4145 def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
4146@@ -158,7 +158,7 @@
4147 'ch': lambda x: x[9:],
4148 'gb': lambda x: x[14:],
4149 }
4150- for record in self.browse(cr, uid, ids, context):
4151+ for record in self.browse(cr, uid, ids, context=context):
4152 if not record.iban:
4153 res[record.id] = False
4154 continue
4155
4156=== modified file 'base_module_doc_rst/base_module_doc_rst.py'
4157--- base_module_doc_rst/base_module_doc_rst.py 2010-10-26 13:22:54 +0000
4158+++ base_module_doc_rst/base_module_doc_rst.py 2010-12-13 07:44:48 +0000
4159@@ -35,7 +35,7 @@
4160 'file_graph': fields.binary('Relationship Graph'),
4161 }
4162
4163- def _get_graphical_representation(self, cr, uid, model_ids, level=1, context={}):
4164+ def _get_graphical_representation(self, cr, uid, model_ids, level=1, context=None):
4165 obj_model = self.pool.get('ir.model')
4166 if level == 0:
4167 return tuple()
4168@@ -86,7 +86,7 @@
4169 )
4170 return res
4171
4172- def _get_module_objects(self, cr, uid, module, context={}):
4173+ def _get_module_objects(self, cr, uid, module, context=None):
4174 obj_model = self.pool.get('ir.model')
4175 obj_mod_data = self.pool.get('ir.model.data')
4176 obj_ids = []
4177@@ -99,6 +99,7 @@
4178 return obj_ids
4179
4180 def get_relation_graph(self, cr, uid, module_name, context=None):
4181+ if context is None: context = {}
4182 object_ids = self._get_module_objects(cr, uid, module_name, context=context)
4183 if not object_ids:
4184 return {'module_file': False}
4185
4186=== modified file 'base_module_doc_rst/report/report_proximity_graph.py'
4187--- base_module_doc_rst/report/report_proximity_graph.py 2010-08-19 11:51:57 +0000
4188+++ base_module_doc_rst/report/report_proximity_graph.py 2010-12-13 07:44:48 +0000
4189@@ -74,7 +74,7 @@
4190 input.close()
4191 return output.read()
4192
4193- def create(self, cr, uid, ids, data, context={}):
4194+ def create(self, cr, uid, ids, data, context=None):
4195 pdf_string = self.get_proximity_graph(cr, uid, data['id'])
4196 return (pdf_string, 'pdf')
4197
4198
4199=== modified file 'base_module_doc_rst/wizard/generate_relation_graph.py'
4200--- base_module_doc_rst/wizard/generate_relation_graph.py 2010-05-19 15:57:31 +0000
4201+++ base_module_doc_rst/wizard/generate_relation_graph.py 2010-12-13 07:44:48 +0000
4202@@ -28,7 +28,7 @@
4203 <label colspan="2" string="(Relationship Graphs generated)" align="0.0"/>
4204 </form>'''
4205
4206-def _get_graph(self, cr, uid, datas, context={}):
4207+def _get_graph(self, cr, uid, datas, context=None):
4208 mod_obj = pooler.get_pool(cr.dbname).get('ir.module.module')
4209 modules = mod_obj.browse(cr, uid, datas['ids'], context=context)
4210 for module in modules:
4211
4212=== modified file 'base_module_doc_rst/wizard/wizard_tech_guide_rst.py'
4213--- base_module_doc_rst/wizard/wizard_tech_guide_rst.py 2010-08-19 11:51:57 +0000
4214+++ base_module_doc_rst/wizard/wizard_tech_guide_rst.py 2010-12-13 07:44:48 +0000
4215@@ -404,7 +404,7 @@
4216 'name': 'modules_technical_guide_rst.tgz'
4217 }
4218
4219- def _get_views(self, cr, uid, module_id, context={}):
4220+ def _get_views(self, cr, uid, module_id, context=None):
4221 pool = pooler.get_pool(cr.dbname)
4222 module_module_obj = pool.get('ir.module.module')
4223 res = {}
4224
4225=== modified file 'base_module_quality/wizard/module_quality_check.py'
4226--- base_module_quality/wizard/module_quality_check.py 2010-02-24 10:55:29 +0000
4227+++ base_module_quality/wizard/module_quality_check.py 2010-12-13 07:44:48 +0000
4228@@ -28,7 +28,7 @@
4229
4230 class quality_check(wizard.interface):
4231
4232- def _create_quality_check(self, cr, uid, data, context={}):
4233+ def _create_quality_check(self, cr, uid, data, context=None):
4234 pool = pooler.get_pool(cr.dbname)
4235 obj_quality = pool.get('module.quality.check')
4236 objs = []
4237
4238=== modified file 'base_module_quality/wizard/quality_save_report.py'
4239--- base_module_quality/wizard/quality_save_report.py 2010-02-24 10:55:29 +0000
4240+++ base_module_quality/wizard/quality_save_report.py 2010-12-13 07:44:48 +0000
4241@@ -40,7 +40,7 @@
4242 'module_file': {'string': 'Save report', 'type': 'binary', 'required': True},
4243 }
4244
4245-def get_detail(self, cr, uid, datas, context={}):
4246+def get_detail(self, cr, uid, datas, context=None):
4247 data = pooler.get_pool(cr.dbname).get('module.quality.detail').browse(cr, uid, datas['id'])
4248 if not data.detail:
4249 raise wizard.except_wizard(_('Warning'), _('No report to save!'))
4250
4251=== modified file 'base_report_creator/base_report_creator.py'
4252--- base_report_creator/base_report_creator.py 2010-11-25 05:03:18 +0000
4253+++ base_report_creator/base_report_creator.py 2010-12-13 07:44:48 +0000
4254@@ -36,7 +36,7 @@
4255 def export_data(self, cr, uid, ids, fields_to_export, context=None):
4256 if context is None:
4257 context = {}
4258- data_l = self.read(cr, uid, ids, ['sql_query'], context)
4259+ data_l = self.read(cr, uid, ids, ['sql_query'], context=context)
4260 final_datas = []
4261 #start Loop
4262 for record in data_l:
4263@@ -181,7 +181,7 @@
4264 }
4265 return result
4266
4267- def read(self, cr, user, ids, fields = None, context = None, load = '_classic_read'):
4268+ def read(self, cr, user, ids, fields=None, context=None, load='_classic_read'):
4269 """
4270 overrides orm Read method.Read List of fields for report creator.
4271 @param cr: the current row, from the database cursor,
4272@@ -355,13 +355,13 @@
4273 """
4274 return self.model_set_id and 'min('+self.model_set_id+'.id)'
4275
4276- def _sql_query_get(self, cr, uid, ids, prop, unknow_none, context, where_plus=[], limit=None, offset=None):
4277+ def _sql_query_get(self, cr, uid, ids, prop, unknow_none, context=None, where_plus=[], limit=None, offset=None):
4278 """
4279 Get sql query which return on sql_query field.
4280 @return: Dictionary of sql query.
4281 """
4282 result = {}
4283- for obj in self.browse(cr, uid, ids):
4284+ for obj in self.browse(cr, uid, ids, context=context):
4285 fields = []
4286 groupby = []
4287 i = 0
4288@@ -449,7 +449,7 @@
4289 @param context: A standard dictionary for contextual values
4290 @return : Dictionary value for base creator report form
4291 """
4292- if not context:
4293+ if context is None:
4294 context = {}
4295
4296 rep = self.browse(cr, uid, ids, context=context)
4297@@ -474,7 +474,7 @@
4298
4299 return value
4300
4301- def _function_field(self, cr, uid, ids):
4302+ def _function_field(self, cr, uid, ids, context=None):
4303 """
4304 constraints function which specify that
4305 not display field which are not stored in Database.
4306@@ -484,7 +484,7 @@
4307 @return: True if display field which are stored in database.
4308 or false if display field which are not store in dtabase.
4309 """
4310- this_objs = self.browse(cr, uid, ids)
4311+ this_objs = self.browse(cr, uid, ids, context=context)
4312 for obj in this_objs:
4313 for fld in obj.field_ids:
4314 # Allowing to use count(*)
4315@@ -495,7 +495,7 @@
4316 return False
4317 return True
4318
4319- def _aggregation_error(self, cr, uid, ids):
4320+ def _aggregation_error(self, cr, uid, ids, context=None):
4321 """
4322 constraints function which specify that
4323 aggregate function to the non calculated field..
4324@@ -505,10 +505,9 @@
4325 @return: True if model colume type is in integer or float.
4326 or false model colume type is not in integer or float.
4327 """
4328-
4329 aggregate_columns = ('integer', 'float')
4330 apply_functions = ('sum', 'min', 'max', 'avg', 'count')
4331- this_objs = self.browse(cr, uid, ids)
4332+ this_objs = self.browse(cr, uid, ids, context=context)
4333 for obj in this_objs:
4334 for fld in obj.field_ids:
4335 # Allowing to use count(*)
4336@@ -519,9 +518,9 @@
4337 return False
4338 return True
4339
4340- def _calander_view_error(self, cr, uid, ids):
4341+ def _calander_view_error(self, cr, uid, ids, context=None):
4342 required_types = []
4343- this_objs = self.browse(cr, uid, ids)
4344+ this_objs = self.browse(cr, uid, ids, context=context)
4345 for obj in this_objs:
4346 if obj.view_type1 == 'calendar' or obj.view_type2 == 'calendar' or obj.view_type3 == 'calendar':
4347 for fld in obj.field_ids:
4348
4349=== modified file 'base_report_creator/wizard/report_menu_create.py'
4350--- base_report_creator/wizard/report_menu_create.py 2010-07-08 06:26:09 +0000
4351+++ base_report_creator/wizard/report_menu_create.py 2010-12-13 07:44:48 +0000
4352@@ -40,7 +40,7 @@
4353 @param ids: List of Report Menu Create's IDs
4354 @return: Dictionary {}.
4355 """
4356- if not context:
4357+ if context is None:
4358 context = {}
4359 context_id = context and context.get('active_id', False) or False
4360 obj_menu = self.pool.get('ir.ui.menu')
4361@@ -52,7 +52,7 @@
4362 return {}
4363 data = data[0]
4364
4365- board = obj_board.browse(cr, uid, context_id)
4366+ board = obj_board.browse(cr, uid, context_id, context=context)
4367 view = board.view_type1
4368 if board.view_type2:
4369 view += ',' + board.view_type2
4370
4371=== modified file 'base_report_designer/base_report_designer.py'
4372--- base_report_designer/base_report_designer.py 2010-11-16 14:11:33 +0000
4373+++ base_report_designer/base_report_designer.py 2010-12-13 07:44:48 +0000
4374@@ -40,7 +40,7 @@
4375 fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
4376 return {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))}
4377
4378- def upload_report(self, cr, uid, report_id, file_sxw, file_type, context):
4379+ def upload_report(self, cr, uid, report_id, file_sxw, file_type, context=None):
4380 '''
4381 Untested function
4382 '''
4383@@ -57,8 +57,8 @@
4384 pool.get('ir.actions.report.xml').register_all(cr)
4385 return True
4386
4387- def report_get(self, cr, uid, report_id, context={}):
4388- report = self.browse(cr, uid, report_id, context)
4389+ def report_get(self, cr, uid, report_id, context=None):
4390+ report = self.browse(cr, uid, report_id, context=context)
4391 return {
4392 'file_type' : report.report_type,
4393 'report_sxw_content': report.report_sxw_content and base64.encodestring(report.report_sxw_content) or False,
4394
4395=== modified file 'base_report_designer/installer.py'
4396--- base_report_designer/installer.py 2010-09-15 15:18:41 +0000
4397+++ base_report_designer/installer.py 2010-12-13 07:44:48 +0000
4398@@ -29,8 +29,8 @@
4399 _name = 'base_report_designer.installer'
4400 _inherit = 'res.config.installer'
4401
4402- def default_get(self, cr, uid, fields, context={}):
4403- data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context)
4404+ def default_get(self, cr, uid, fields, context=None):
4405+ data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context=context)
4406 plugin_file = open(addons.get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
4407 data['plugin_file'] = base64.encodestring(plugin_file.read())
4408 return data
4409
4410=== modified file 'base_report_designer/wizard/base_report_designer_modify.py'
4411--- base_report_designer/wizard/base_report_designer_modify.py 2010-10-28 06:54:18 +0000
4412+++ base_report_designer/wizard/base_report_designer_modify.py 2010-12-13 07:44:48 +0000
4413@@ -38,11 +38,11 @@
4414 }
4415
4416
4417- def get_report(self, cr, uid, ids, context):
4418- data=self.read(cr,uid,ids)[0]
4419+ def get_report(self, cr, uid, ids, context=None):
4420+ data = self.read(cr, uid, ids, context=context)[0]
4421 data_obj = self.pool.get('ir.model.data')
4422 id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_sxw')
4423- report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
4424+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
4425 if id2:
4426 id2 = data_obj.browse(cr, uid, id2, context=context).res_id
4427 return {
4428@@ -74,12 +74,11 @@
4429 @return: A dictionary which of fields with values.
4430
4431 """
4432-
4433 res = super(base_report_file_sxw, self).default_get(cr, uid, fields, context=context)
4434 report_id1 = self.pool.get('base.report.sxw').search(cr,uid,[])
4435- data=self.pool.get('base.report.sxw').read(cr,uid,report_id1)[0]
4436- report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
4437- if not context:
4438+ data = self.pool.get('base.report.sxw').read(cr, uid, report_id1, context=context)[0]
4439+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
4440+ if context is None:
4441 context={}
4442 if 'report_id' in fields:
4443 res['report_id'] = data['report_id']
4444@@ -92,7 +91,7 @@
4445 'file_sxw_upload':fields.binary('Your .SXW file',required=True)
4446 }
4447
4448- def upload_report(self, cr, uid, ids, context):
4449+ def upload_report(self, cr, uid, ids, context=None):
4450 from base_report_designer import openerp_sxw2rml
4451 import StringIO
4452 data=self.read(cr,uid,ids)[0]
4453@@ -106,7 +105,7 @@
4454 cr.commit()
4455 data_obj = self.pool.get('ir.model.data')
4456 id2 = data_obj._get_id(cr, uid, 'base_report_designer', 'view_base_report_file_rml')
4457- report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
4458+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
4459 if id2:
4460 id2 = data_obj.browse(cr, uid, id2, context=context).res_id
4461 return {
4462@@ -135,12 +134,12 @@
4463 @return: A dictionary which of fields with values.
4464
4465 """
4466+
4467 res = super(base_report_rml_save, self).default_get(cr, uid, fields, context=context)
4468 report_id = self.pool.get('base.report.sxw').search(cr,uid,[])
4469- data=self.pool.get('base.report.file.sxw').read(cr,uid,report_id)[0]
4470- report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context)
4471- if not context:
4472- context={}
4473+ data = self.pool.get('base.report.file.sxw').read(cr, uid, report_id, context=context)[0]
4474+ report = self.pool.get('ir.actions.report.xml').browse(cr, uid, data['report_id'], context=context)
4475+
4476 if 'file_rml' in fields:
4477 res['file_rml'] = base64.encodestring(report.report_rml_content)
4478 return res
4479
4480=== modified file 'base_setup/__init__.py'
4481--- base_setup/__init__.py 2010-10-09 09:36:34 +0000
4482+++ base_setup/__init__.py 2010-12-13 07:44:48 +0000
4483@@ -42,10 +42,10 @@
4484 file_data = tools.file_open(path,'rb').read()
4485 return base64.encodestring(file_data)
4486
4487- def get_users(self, cr, uid, context={}):
4488+ def get_users(self, cr, uid, context=None):
4489 user_obj = self.pool.get('res.users')
4490 user_ids = user_obj.search(cr, uid, [])
4491- users = user_obj.browse(cr, uid, user_ids)
4492+ users = user_obj.browse(cr, uid, user_ids, context=context)
4493 user_str = '\n'.join(map(lambda x: ' - %s :\n\t\tLogin : %s \n\t\tPassword : %s' % (x.name, x.login, x.password), users))
4494 return _('The following users have been installed : \n')+ user_str
4495
4496
4497=== modified file 'base_setup/todo.py'
4498--- base_setup/todo.py 2010-11-10 16:01:04 +0000
4499+++ base_setup/todo.py 2010-12-13 07:44:48 +0000
4500@@ -65,7 +65,7 @@
4501 company_id = companies.search(cr, uid, [], limit=1, order="id")
4502 if not company_id or 'company_id' not in fields_list:
4503 return defaults
4504- company = companies.browse(cr, uid, company_id[0])
4505+ company = companies.browse(cr, uid, company_id[0], context=context)
4506 defaults['company_id'] = company.id
4507
4508 if not self._show_company_data(cr, uid, context=context):
4509
4510=== modified file 'base_synchro/base_synchro_obj.py'
4511--- base_synchro/base_synchro_obj.py 2010-09-27 06:51:19 +0000
4512+++ base_synchro/base_synchro_obj.py 2010-12-13 07:44:48 +0000
4513@@ -1,111 +1,111 @@
4514-# -*- coding: utf-8 -*-
4515-##############################################################################
4516-#
4517-# OpenERP, Open Source Management Solution
4518-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
4519-#
4520-# This program is free software: you can redistribute it and/or modify
4521-# it under the terms of the GNU Affero General Public License as
4522-# published by the Free Software Foundation, either version 3 of the
4523-# License, or (at your option) any later version.
4524-#
4525-# This program is distributed in the hope that it will be useful,
4526-# but WITHOUT ANY WARRANTY; without even the implied warranty of
4527-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4528-# GNU Affero General Public License for more details.
4529-#
4530-# You should have received a copy of the GNU Affero General Public License
4531-# along with this program. If not, see <http://www.gnu.org/licenses/>.
4532-#
4533-##############################################################################
4534-from osv import fields,osv
4535-import tools
4536-import re
4537-import time
4538-
4539-class base_synchro_server(osv.osv):
4540- '''Class to store the information regarding server'''
4541- _name = "base.synchro.server"
4542- _description = "Synchronized server"
4543- _columns = {
4544- 'name': fields.char('Server name', size=64,required=True),
4545- 'server_url': fields.char('Server URL', size=64,required=True),
4546- 'server_port': fields.integer('Server Port', size=64,required=True),
4547- 'server_db': fields.char('Server Database', size=64,required=True),
4548- 'login': fields.char('User Name',size=50,required=True),
4549- 'password': fields.char('Password',size=64,invisible=True,required=True),
4550- 'obj_ids' : fields.one2many('base.synchro.obj','server_id','Models',ondelete='cascade')
4551- }
4552- _defaults = {
4553- 'server_port': lambda *args: 8069
4554- }
4555-base_synchro_server()
4556-
4557-class base_synchro_obj(osv.osv):
4558- '''Class to store the operations done by wizard'''
4559- _name = "base.synchro.obj"
4560- _description = "Register Class"
4561- _columns = {
4562- 'name':fields.char('Name', size=64, select=1, required=1),
4563- 'domain':fields.char('Domain', size=64, select=1, required=1),
4564- 'server_id':fields.many2one('base.synchro.server','Server', ondelete='cascade', select=1, required=1),
4565- 'model_id': fields.many2one('ir.model', 'Object to synchronize',required=True),
4566- 'action':fields.selection([('d','Download'),('u','Upload'),('b','Both')],'Synchronisation direction', required=True),
4567- 'sequence': fields.integer('Sequence'),
4568- 'active': fields.boolean('Active'),
4569- 'synchronize_date':fields.datetime('Latest Synchronization', readonly=True),
4570- 'line_id':fields.one2many('base.synchro.obj.line','obj_id','Ids Affected',ondelete='cascade'),
4571- 'avoid_ids':fields.one2many('base.synchro.obj.avoid','obj_id','Fields Not Sync.'),
4572- }
4573- _defaults = {
4574- 'active': lambda *args: True,
4575- 'action': lambda *args: 'd',
4576- 'domain': lambda *args: '[]'
4577- }
4578- _order = 'sequence'
4579- #
4580- # Return a list of changes: [ (date, id) ]
4581- #
4582-
4583- def get_ids(self, cr, uid, object, dt, domain=[], context={}):
4584- return self._get_ids(cr, uid, object, dt, domain, context)
4585-
4586- def _get_ids(self, cr, uid, object, dt, domain=[], context={}):
4587- result = []
4588- if dt:
4589- domain2 = domain+[('write_date','>=',dt)]
4590- domain3 = domain+[('create_date','>=',dt)]
4591- else:
4592- domain2 = domain3 = domain
4593- ids = self.pool.get(object).search(cr, uid, domain2, context=context)
4594- ids += self.pool.get(object).search(cr, uid, domain3, context=context)
4595- for r in self.pool.get(object).perm_read(cr, uid, ids, context, details=False):
4596- result.append( (r['write_date'] or r['create_date'], r['id'], context.get('action', 'd')))
4597- return result
4598-base_synchro_obj()
4599-
4600-class base_synchro_obj_avoid(osv.osv):
4601- _name = "base.synchro.obj.avoid"
4602- _description = "Fields to not synchronize"
4603- _columns = {
4604- 'name':fields.char('Field Name', size=64, select=1, required=1),
4605- 'obj_id':fields.many2one('base.synchro.obj', 'Object', required=1,ondelete='cascade'),
4606- }
4607-base_synchro_obj_avoid()
4608-
4609-
4610-class base_synchro_obj_line(osv.osv):
4611- '''Class to store the operations done by wizard'''
4612- _name = "base.synchro.obj.line"
4613- _description = "Synchronized instances"
4614- _columns = {
4615- 'name': fields.datetime('Date', required=True),
4616- 'obj_id': fields.many2one('base.synchro.obj', 'Object', ondelete='cascade', select=True),
4617- 'local_id': fields.integer('Local Id',readonly=True),
4618- 'remote_id':fields.integer('Remote Id',readonly=True),
4619- }
4620- _defaults = {
4621- 'name': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S')
4622- }
4623-base_synchro_obj_line()
4624-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4625+# -*- coding: utf-8 -*-
4626+##############################################################################
4627+#
4628+# OpenERP, Open Source Management Solution
4629+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
4630+#
4631+# This program is free software: you can redistribute it and/or modify
4632+# it under the terms of the GNU Affero General Public License as
4633+# published by the Free Software Foundation, either version 3 of the
4634+# License, or (at your option) any later version.
4635+#
4636+# This program is distributed in the hope that it will be useful,
4637+# but WITHOUT ANY WARRANTY; without even the implied warranty of
4638+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4639+# GNU Affero General Public License for more details.
4640+#
4641+# You should have received a copy of the GNU Affero General Public License
4642+# along with this program. If not, see <http://www.gnu.org/licenses/>.
4643+#
4644+##############################################################################
4645+from osv import fields,osv
4646+import tools
4647+import re
4648+import time
4649+
4650+class base_synchro_server(osv.osv):
4651+ '''Class to store the information regarding server'''
4652+ _name = "base.synchro.server"
4653+ _description = "Synchronized server"
4654+ _columns = {
4655+ 'name': fields.char('Server name', size=64,required=True),
4656+ 'server_url': fields.char('Server URL', size=64,required=True),
4657+ 'server_port': fields.integer('Server Port', size=64,required=True),
4658+ 'server_db': fields.char('Server Database', size=64,required=True),
4659+ 'login': fields.char('User Name',size=50,required=True),
4660+ 'password': fields.char('Password',size=64,invisible=True,required=True),
4661+ 'obj_ids' : fields.one2many('base.synchro.obj','server_id','Models',ondelete='cascade')
4662+ }
4663+ _defaults = {
4664+ 'server_port': lambda *args: 8069
4665+ }
4666+base_synchro_server()
4667+
4668+class base_synchro_obj(osv.osv):
4669+ '''Class to store the operations done by wizard'''
4670+ _name = "base.synchro.obj"
4671+ _description = "Register Class"
4672+ _columns = {
4673+ 'name':fields.char('Name', size=64, select=1, required=1),
4674+ 'domain':fields.char('Domain', size=64, select=1, required=1),
4675+ 'server_id':fields.many2one('base.synchro.server','Server', ondelete='cascade', select=1, required=1),
4676+ 'model_id': fields.many2one('ir.model', 'Object to synchronize',required=True),
4677+ 'action':fields.selection([('d','Download'),('u','Upload'),('b','Both')],'Synchronisation direction', required=True),
4678+ 'sequence': fields.integer('Sequence'),
4679+ 'active': fields.boolean('Active'),
4680+ 'synchronize_date':fields.datetime('Latest Synchronization', readonly=True),
4681+ 'line_id':fields.one2many('base.synchro.obj.line','obj_id','Ids Affected',ondelete='cascade'),
4682+ 'avoid_ids':fields.one2many('base.synchro.obj.avoid','obj_id','Fields Not Sync.'),
4683+ }
4684+ _defaults = {
4685+ 'active': lambda *args: True,
4686+ 'action': lambda *args: 'd',
4687+ 'domain': lambda *args: '[]'
4688+ }
4689+ _order = 'sequence'
4690+ #
4691+ # Return a list of changes: [ (date, id) ]
4692+ #
4693+
4694+ def get_ids(self, cr, uid, object, dt, domain=[], context=None):
4695+ return self._get_ids(cr, uid, object, dt, domain, context=context)
4696+
4697+ def _get_ids(self, cr, uid, object, dt, domain=[], context=None):
4698+ result = []
4699+ if dt:
4700+ domain2 = domain+[('write_date','>=',dt)]
4701+ domain3 = domain+[('create_date','>=',dt)]
4702+ else:
4703+ domain2 = domain3 = domain
4704+ ids = self.pool.get(object).search(cr, uid, domain2, context=context)
4705+ ids += self.pool.get(object).search(cr, uid, domain3, context=context)
4706+ for r in self.pool.get(object).perm_read(cr, uid, ids, context, details=False):
4707+ result.append( (r['write_date'] or r['create_date'], r['id'], context.get('action', 'd')))
4708+ return result
4709+base_synchro_obj()
4710+
4711+class base_synchro_obj_avoid(osv.osv):
4712+ _name = "base.synchro.obj.avoid"
4713+ _description = "Fields to not synchronize"
4714+ _columns = {
4715+ 'name':fields.char('Field Name', size=64, select=1, required=1),
4716+ 'obj_id':fields.many2one('base.synchro.obj', 'Object', required=1,ondelete='cascade'),
4717+ }
4718+base_synchro_obj_avoid()
4719+
4720+
4721+class base_synchro_obj_line(osv.osv):
4722+ '''Class to store the operations done by wizard'''
4723+ _name = "base.synchro.obj.line"
4724+ _description = "Synchronized instances"
4725+ _columns = {
4726+ 'name': fields.datetime('Date', required=True),
4727+ 'obj_id': fields.many2one('base.synchro.obj', 'Object', ondelete='cascade', select=True),
4728+ 'local_id': fields.integer('Local Id',readonly=True),
4729+ 'remote_id':fields.integer('Remote Id',readonly=True),
4730+ }
4731+ _defaults = {
4732+ 'name': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S')
4733+ }
4734+base_synchro_obj_line()
4735+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4736
4737=== modified file 'base_synchro/wizard/base_synchro.py'
4738--- base_synchro/wizard/base_synchro.py 2010-10-04 04:46:18 +0000
4739+++ base_synchro/wizard/base_synchro.py 2010-12-13 07:44:48 +0000
4740@@ -65,7 +65,7 @@
4741 report_create = 0
4742 report_write = 0
4743
4744- def synchronize(self, cr, uid, server, object, context):
4745+ def synchronize(self, cr, uid, server, object, context=None):
4746 pool = pooler.get_pool(cr.dbname)
4747 self.meta = {}
4748 ids = []
4749@@ -136,7 +136,7 @@
4750 self.meta = {}
4751 return True
4752
4753- def get_id(self, cr, uid, object_id, id, action, context={}):
4754+ def get_id(self, cr, uid, object_id, id, action, context=None):
4755 pool = pooler.get_pool(cr.dbname)
4756 line_pool = pool.get('base.synchro.obj.line')
4757 field_src = (action=='u') and 'local_id' or 'remote_id'
4758@@ -147,7 +147,7 @@
4759 result = line_pool.read(cr, uid, rid, [field_dest], context=context)[0][field_dest]
4760 return result
4761
4762- def relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context={}):
4763+ def relation_transform(self, cr, uid, pool_src, pool_dest, object, id, action, context=None):
4764 if not id:
4765 return False
4766 pool = pooler.get_pool(cr.dbname)
4767@@ -181,10 +181,10 @@
4768 # Otherwise, use the name_search method
4769 #
4770
4771- def data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context={}):
4772+ def data_transform(self, cr, uid, pool_src, pool_dest, object, data, action='u', context=None):
4773 self.meta.setdefault(pool_src, {})
4774 if not object in self.meta[pool_src]:
4775- self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context)
4776+ self.meta[pool_src][object] = pool_src.get(object).fields_get(cr, uid, context=context)
4777 fields = self.meta[pool_src][object]
4778
4779 for f in fields:
4780@@ -196,7 +196,7 @@
4781 del data[f]
4782 elif ftype == 'many2one':
4783 if data[f]:
4784- df = self.relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], data[f][0], action, context)
4785+ df = self.relation_transform(cr, uid, pool_src, pool_dest, fields[f]['relation'], data[f][0], action, context=context)
4786 data[f] = df
4787 if not data[f]:
4788 del data[f]
4789@@ -212,11 +212,11 @@
4790 #
4791
4792
4793- def upload_download(self, cr, uid, ids, context):
4794+ def upload_download(self, cr, uid, ids, context=None):
4795 start_date = time.strftime('%Y-%m-%d, %Hh %Mm %Ss')
4796- syn_obj = self.browse(cr, uid, ids)[0]
4797+ syn_obj = self.browse(cr, uid, ids, context=context)[0]
4798 pool = pooler.get_pool(cr.dbname)
4799- server = pool.get('base.synchro.server').browse(cr, uid, ids, context)[0]
4800+ server = pool.get('base.synchro.server').browse(cr, uid, ids, context=context)[0]
4801 for object in server.obj_ids:
4802 dt = time.strftime('%Y-%m-%d %H:%M:%S')
4803 self.synchronize(cr, uid, server, object, context)
4804@@ -249,7 +249,7 @@
4805 })
4806 return True
4807
4808- def upload_download_multi_thread(self, cr, uid, data, context):
4809+ def upload_download_multi_thread(self, cr, uid, data, context=None):
4810 threaded_synchronization = threading.Thread(target=self.upload_download, args=(cr, uid, data, context))
4811 threaded_synchronization.run()
4812 data_obj = self.pool.get('ir.model.data')
4813
4814=== modified file 'base_vat/base_vat.py'
4815--- base_vat/base_vat.py 2010-11-10 08:12:44 +0000
4816+++ base_vat/base_vat.py 2010-12-13 07:44:48 +0000
4817@@ -52,12 +52,12 @@
4818 vat_country, vat_number = vat[:2].lower(), vat[2:].replace(' ', '')
4819 return vat_country, vat_number
4820
4821- def check_vat(self, cr, uid, ids):
4822+ def check_vat(self, cr, uid, ids, context=None):
4823 '''
4824 Check the VAT number depending of the country.
4825 http://sima-pc.com/nif.php
4826 '''
4827- for partner in self.browse(cr, uid, ids):
4828+ for partner in self.browse(cr, uid, ids, context=context):
4829 if not partner.vat:
4830 continue
4831 vat_country, vat_number = self._split_vat(partner.vat)
4832@@ -75,7 +75,7 @@
4833 'vat_subjected': fields.boolean('VAT Legal Statement', help="Check this box if the partner is subjected to the VAT. It will be used for the VAT legal statement.")
4834 }
4835
4836- def _construct_constraint_msg(self, cr, uid, ids):
4837+ def _construct_constraint_msg(self, cr, uid, ids, context=None):
4838 def default_vat_check(cn, vn):
4839 # by default, a VAT number is valid if:
4840 # it starts with 2 letters
4841
4842=== modified file 'board/board.py'
4843--- board/board.py 2010-11-27 20:14:37 +0000
4844+++ board/board.py 2010-12-13 07:44:48 +0000
4845@@ -38,8 +38,6 @@
4846 @param ids: List of Board's IDs
4847 @return: arch of xml view.
4848 """
4849- if not context:
4850- context = {}
4851 board = self.pool.get('board.board').browse(cr, uid, ids, context=context)
4852 left = []
4853 right = []
4854@@ -70,7 +68,7 @@
4855
4856 return arch
4857
4858- def write(self, cr, uid, ids, vals, context = {}):
4859+ def write(self, cr, uid, ids, vals, context=None):
4860
4861 """
4862 Writes values in one or several fields.
4863@@ -81,10 +79,10 @@
4864 dictionary must be with the form: {‘name_of_the_field’: value, ...}.
4865 @return: True
4866 """
4867- result = super(board_board, self).write(cr, uid, ids, vals, context)
4868+ result = super(board_board, self).write(cr, uid, ids, vals, context=context)
4869
4870- board = self.pool.get('board.board').browse(cr, uid, ids[0])
4871- view = self.create_view(cr, uid, ids[0], context)
4872+ board = self.pool.get('board.board').browse(cr, uid, ids[0], context=context)
4873+ view = self.create_view(cr, uid, ids[0], context=context)
4874 id = board.view_id.id
4875 cr.execute("update ir_ui_view set arch=%s where id=%s", (view, id))
4876 return result
4877@@ -99,18 +97,16 @@
4878 @return: id of new created record of board.board.
4879 """
4880
4881- if not context:
4882- context = {}
4883
4884 if not 'name' in vals:
4885 return False
4886- id = super(board_board, self).create(cr, user, vals, context)
4887+ id = super(board_board, self).create(cr, user, vals, context=context)
4888 view_id = self.pool.get('ir.ui.view').create(cr, user, {
4889 'name': vals['name'],
4890 'model': 'board.board',
4891 'priority': 16,
4892 'type': 'form',
4893- 'arch': self.create_view(cr, user, id, context),
4894+ 'arch': self.create_view(cr, user, id, context=context),
4895 })
4896
4897 super(board_board, self).write(cr, user, [id], {'view_id': view_id}, context)
4898@@ -124,8 +120,6 @@
4899 @return: Dictionary of Fields, arch and toolbar.
4900 """
4901
4902- if not context:
4903- context = {}
4904
4905 res = {}
4906 res = super(board_board, self).fields_view_get(cr, user, view_id, view_type,\
4907@@ -135,7 +129,7 @@
4908 [('user_id', '=', user), ('ref_id' ,'=', view_id)])
4909 if vids:
4910 view_id = vids[0]
4911- arch = self.pool.get('ir.ui.view.custom').browse(cr, user, view_id)
4912+ arch = self.pool.get('ir.ui.view.custom').browse(cr, user, view_id, context=context)
4913 res['arch'] = arch.arch
4914
4915 res['toolbar'] = {'print': [], 'action': [], 'relate': []}
4916@@ -193,13 +187,13 @@
4917
4918 board_note_type()
4919
4920-def _type_get(self, cr, uid, context={}):
4921+def _type_get(self, cr, uid, context=None):
4922 """
4923 Get by default Note type.
4924 """
4925 obj = self.pool.get('board.note.type')
4926 ids = obj.search(cr, uid, [])
4927- res = obj.read(cr, uid, ids, ['name'], context)
4928+ res = obj.read(cr, uid, ids, ['name'], context=context)
4929 res = [(r['name'], r['name']) for r in res]
4930 return res
4931
4932
4933=== modified file 'board/wizard/board_menu_create.py'
4934--- board/wizard/board_menu_create.py 2010-05-21 10:26:00 +0000
4935+++ board/wizard/board_menu_create.py 2010-12-13 07:44:48 +0000
4936@@ -40,7 +40,7 @@
4937 """
4938 data = context and context.get('active_id', False) or False
4939 if data:
4940- board = self.pool.get('board.board').browse(cr, uid, data)
4941+ board = self.pool.get('board.board').browse(cr, uid, data, context=context)
4942 if not board.line_ids:
4943 raise osv.except_osv(_('User Error!'),
4944 _('Please Insert Dashboard View(s) !'))
4945@@ -55,12 +55,12 @@
4946 @param ids: List of Board Menu Create's IDs
4947 @return: Dictionary {}.
4948 """
4949- if not context:
4950+ if context is None:
4951 context = {}
4952
4953 context_id = context and context.get('active_id', False) or False
4954 if context_id:
4955- board = self.pool.get('board.board').browse(cr, uid, context_id)
4956+ board = self.pool.get('board.board').browse(cr, uid, context_id, context=context)
4957 action_id = self.pool.get('ir.actions.act_window').create(cr, uid, {
4958 'name': board.name,
4959 'view_type': 'form',
4960
4961=== modified file 'caldav/calendar.py'
4962--- caldav/calendar.py 2010-11-19 06:10:09 +0000
4963+++ caldav/calendar.py 2010-12-13 07:44:48 +0000
4964@@ -148,7 +148,7 @@
4965 @param calname: Get Calendar name
4966 @param context: A standard dictionary for contextual values """
4967
4968- if not context:
4969+ if context is None:
4970 context = {}
4971 pool = pooler.get_pool(cr.dbname)
4972 field_obj = pool.get('basic.calendar.fields')
4973@@ -159,7 +159,7 @@
4974 type_id = type_obj.search(cr, uid, domain)
4975 fids = field_obj.search(cr, uid, [('type_id', '=', type_id[0])])
4976 res = {}
4977- for field in field_obj.browse(cr, uid, fids):
4978+ for field in field_obj.browse(cr, uid, fids, context=context):
4979 attr = field.name.name
4980 res[attr] = {}
4981 res[attr]['field'] = field.field_id.name
4982@@ -469,7 +469,7 @@
4983 @param vals: Get Values
4984 @param context: A standard dictionary for contextual values
4985 """
4986- if not context:
4987+ if context is None:
4988 context = {}
4989 ids = []
4990 model_obj = self.pool.get(context.get('model'))
4991@@ -591,7 +591,7 @@
4992 }
4993
4994 def get_calendar_objects(self, cr, uid, ids, parent=None, domain=None, context=None):
4995- if not context:
4996+ if context is None:
4997 context = {}
4998 if not domain:
4999 domain = []
5000@@ -621,7 +621,7 @@
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: