diff --git a/account_fiscal_year_closing/fyc.py b/account_fiscal_year_closing/fyc.py index 3acd64aa2..1a065f2d0 100644 --- a/account_fiscal_year_closing/fyc.py +++ b/account_fiscal_year_closing/fyc.py @@ -404,13 +404,13 @@ def action_draft(self, cr, uid, ids, context=None): """ if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) # # Make sure the lang is defined on the context # - user = self.pool.get('res.users').browse(cr, uid, uid, context) - #for 7.0## context['lang'] = context.get('lang') or user.lang - context['lang'] = context.get('lang') or user.context_lang + # user = self.pool.get('res.users').browse(cr, uid, uid, context) + # #for 7.0## context['lang'] = context.get('lang') or user.lang + # context['lang'] = context.get('lang') or user.context_lang for fyc in self.browse(cr, uid, ids, context): # @@ -508,13 +508,13 @@ def action_confirm(self, cr, uid, ids, context=None): Called when the user clicks the confirm button. """ if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) # # Make sure the lang is defined on the context # - user = self.pool.get('res.users').browse(cr, uid, uid, context) - #for 7.0###context['lang'] = context.get('lang') or user.lang - context['lang'] = context.get('lang') or user.context_lang + # user = self.pool.get('res.users').browse(cr, uid, uid, context) + # #for 7.0###context['lang'] = context.get('lang') or user.lang + # context['lang'] = context.get('lang') or user.context_lang for fyc in self.browse(cr, uid, ids, context): # @@ -608,13 +608,13 @@ def action_cancel(self, cr, uid, ids, context=None): Called when the user clicks the cancel button. """ if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) # # Make sure the lang is defined on the context # - user = self.pool.get('res.users').browse(cr, uid, uid, context) - #for 7.0###context['lang'] = context.get('lang') or user.lang - context['lang'] = context.get('lang') or user.context_lang + # user = self.pool.get('res.users').browse(cr, uid, uid, context) + # #for 7.0###context['lang'] = context.get('lang') or user.lang + # context['lang'] = context.get('lang') or user.context_lang # # Uncheck all the operations # @@ -681,7 +681,10 @@ def action_recover(self, cr, uid, ids, context=None): Called when the user clicks the draft button to create a new workflow instance. """ - self.write(cr, uid, ids, {'state': 'new'}) + if not context: + context = self.pool['res.users'].context_get(cr, uid) + + self.write(cr, uid, ids, {'state': 'new'}, context) wf_service = netsvc.LocalService("workflow") for item_id in ids: wf_service.trg_create(uid, 'account_fiscal_year_closing.fyc', item_id, cr) diff --git a/account_invoice_reopen/account_invoice.py b/account_invoice_reopen/account_invoice.py index dd383a0c2..f80df90e5 100644 --- a/account_invoice_reopen/account_invoice.py +++ b/account_invoice_reopen/account_invoice.py @@ -120,14 +120,14 @@ def action_reopen(self, cr, uid, ids, *args): # attachment_obj.write(cr, uid, a.id, vals) # unset set the invoices move_id - self.write(cr, uid, ids, {'move_id': False}) + self.write(cr, uid, ids, {'move_id': False}, context) if move_ids: - for move in account_move_obj.browse(cr, uid, move_ids): + for move in account_move_obj.browse(cr, uid, move_ids, context): name = move.name + now account_move_obj.write(cr, uid, [move.id], {'name': name}) - _logger.debug('FGF reopen move_copy moveid %s' % (move.id)) + _logger.debug('FGF reopen move_copy moveid %s' % move.id) if move.journal_id.entry_posted: raise orm.except_orm(_('Error !'), _('You can not reopen an invoice if the journal is set to skip draft!')) @@ -137,21 +137,21 @@ def action_reopen(self, cr, uid, ids, *args): cr.execute("""update account_move_line set debit=credit, credit=debit, tax_amount= -tax_amount where move_id = %s;""" % move_copy_id) - account_move_obj.write(cr, uid, [move_copy_id], {'name': name}) + account_move_obj.write(cr, uid, [move_copy_id], {'name': name}, context) _logger.debug('FGF reopen move_copy_id validate') - account_move_obj.button_validate(cr, uid, [move_copy_id], context=None) + account_move_obj.button_validate(cr, uid, [move_copy_id], context=context) _logger.debug('FGF reopen move_copy_id validated') # reconcile - r_id = self.pool.get('account.move.reconcile').create(cr, uid, {'type': 'auto'}) + r_id = self.pool.get('account.move.reconcile').create(cr, uid, {'type': 'auto'}, context) _logger.debug('FGF reopen reconcile_id %s' % r_id) - line_ids = account_move_line_obj.search(cr, uid, [('move_id', 'in', [move_copy_id, move.id])]) + line_ids = account_move_line_obj.search(cr, uid, [('move_id', 'in', [move_copy_id, move.id])], context=context) _logger.debug('FGF reopen reconcile_line_ids %s' % line_ids) lines_to_reconile = [] - for ltr in account_move_line_obj.browse(cr, uid, line_ids): + for ltr in account_move_line_obj.browse(cr, uid, line_ids, context): if ltr.account_id.id in ( ltr.partner_id.property_account_payable.id, ltr.partner_id.property_account_receivable.id): lines_to_reconile.append(ltr.id) - account_move_line_obj.write(cr, uid, lines_to_reconile, {'reconcile_id': r_id}) + account_move_line_obj.write(cr, uid, lines_to_reconile, {'reconcile_id': r_id}, context) self._log_event(cr, uid, ids, -1.0, 'Reopened Invoice') @@ -173,6 +173,3 @@ def action_number(self, cr, uid, ids, context=None): if not inv.internal_number: super(account_invoice, self).action_number(cr, uid, ids, context) return True - - -account_invoice() diff --git a/account_invoice_template/wizard/select_template.py b/account_invoice_template/wizard/select_template.py index f32f075cf..789daac7b 100644 --- a/account_invoice_template/wizard/select_template.py +++ b/account_invoice_template/wizard/select_template.py @@ -80,7 +80,7 @@ def load_lines(self, cr, uid, ids, context=None): def load_template(self, cr, uid, ids, context=None): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) template_obj = self.pool['account.invoice.template'] account_invoice_obj = self.pool['account.invoice'] account_invoice_line_obj = self.pool['account.invoice.line'] diff --git a/account_journal_report_xls/report/nov_account_journal.py b/account_journal_report_xls/report/nov_account_journal.py index d46fb5d45..3afaab264 100644 --- a/account_journal_report_xls/report/nov_account_journal.py +++ b/account_journal_report_xls/report/nov_account_journal.py @@ -65,7 +65,7 @@ def set_context(self, objects, data, ids, report_type=None): def __init__(self, cr, uid, name, context): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) super(nov_journal_print, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/account_vat_period_end_statement/report/vat_period_end_statement.py b/account_vat_period_end_statement/report/vat_period_end_statement.py index 28cc91fac..3f34393f1 100644 --- a/account_vat_period_end_statement/report/vat_period_end_statement.py +++ b/account_vat_period_end_statement/report/vat_period_end_statement.py @@ -80,7 +80,7 @@ def find_period(self, date, context=None): def __init__(self, cr, uid, name, context=None): if context is None: - context = self.pool['res.users'].context_get(self.cr, self.uid) + context = self.pool['res.users'].context_get(self.cr, self.uid) super(print_vat_period_end_statement, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/base_address_contacts/res_partner_address.py b/base_address_contacts/res_partner_address.py index 523497d2a..824b5e9ec 100644 --- a/base_address_contacts/res_partner_address.py +++ b/base_address_contacts/res_partner_address.py @@ -181,7 +181,7 @@ def name_get(self, cr, uid, ids, context=None): return [] res = [] if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) length = context.get('name_lenght', False) or 80 for record in self.browse(cr, uid, ids, context=context): name = record.complete_name or record.name or '' diff --git a/crm_lead_correct/wizard/mail_compose_message.py b/crm_lead_correct/wizard/mail_compose_message.py index 2068a8f29..c73d33bb2 100644 --- a/crm_lead_correct/wizard/mail_compose_message.py +++ b/crm_lead_correct/wizard/mail_compose_message.py @@ -34,7 +34,7 @@ class mail_compose_message(orm.TransientModel): def default_get(self, cr, uid, fields, context=None): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) result = super(mail_compose_message, self).default_get(cr, uid, fields, context=context) # link to model and record if not done yet diff --git a/data_migration/wizard/sale_order_state.py b/data_migration/wizard/sale_order_state.py index 3cdd44ff3..3383b3487 100644 --- a/data_migration/wizard/sale_order_state.py +++ b/data_migration/wizard/sale_order_state.py @@ -36,7 +36,7 @@ class sale_order_cancel(orm.TransientModel): def order_cancel(self, cr, uid, ids, context=None): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) sale_orders = self.pool['sale.order'].browse(cr, uid, context['active_ids'], context=context) diff --git a/dt_product_serial/wizard/stock_move.py b/dt_product_serial/wizard/stock_move.py index 8f60a25d3..a01e4d253 100644 --- a/dt_product_serial/wizard/stock_move.py +++ b/dt_product_serial/wizard/stock_move.py @@ -44,7 +44,7 @@ class split_in_production_lot(orm.TransientModel): def split_lot_serial(self, cr, uid, ids, context=None): """ To split a lot""" if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) res = self.split_serial(cr, uid, ids, context.get('active_ids'), context=context) return {'type': 'ir.actions.act_window_close'} @@ -54,7 +54,7 @@ def split_serial(self, cr, uid, ids, move_ids, context=None): :param move_ids: the ID or list of IDs of stock move we want to split """ if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) assert context.get('active_model') == 'stock.move',\ 'Incorrect use of the stock move split wizard' diff --git a/material_asset/asset.py b/material_asset/asset.py index 0494ae6b5..479f7f792 100644 --- a/material_asset/asset.py +++ b/material_asset/asset.py @@ -329,7 +329,7 @@ class asset_product(orm.Model): def _product_code(self, cr, uid, ids, name, arg, context=None): res = {} if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) for p in self.browse(cr, uid, ids, context=context): res[p.id] = self._get_partner_code_name(cr, uid, [], p, context.get('partner_id', None), context=context)['code'] return res @@ -345,7 +345,7 @@ def _product_code(self, cr, uid, ids, name, arg, context=None): def onchange_category_id(self, cr, uid, ids, asset_category_id, context=None): has_date_option = False if asset_category_id: - category_id_obj = self.pool.get('asset.category') + category_id_obj = self.pool['asset.category'] category_type = category_id_obj.browse(cr, uid, [asset_category_id], context) if category_type and category_type[0].has_date_option: has_date_option = True diff --git a/material_asset/stock.py b/material_asset/stock.py index b9866381b..8c2950450 100644 --- a/material_asset/stock.py +++ b/material_asset/stock.py @@ -69,7 +69,7 @@ def action_done(self, cr, uid, ids, context=None): def create_asset(self, cr, uid, ids, context): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) for move in self.browse(cr, uid, ids, context=context): if not move.prodlot_id.id and move.location_dest_id.usage == 'assets': @@ -78,7 +78,7 @@ def create_asset(self, cr, uid, ids, context): prodlot_id = move.prodlot_id.id # verify that product is not yet an asset: - asset_product_ids = self.pool.get('asset.product').search(cr, uid, [('product_product_id', '=', move.product_id.id), ]) + asset_product_ids = self.pool['asset.product'].search(cr, uid, [('product_product_id', '=', move.product_id.id), ], context=context) if move.location_dest_id.usage == 'assets' and not asset_product_ids: # Launch a form and ask about category: assign_category_id = self.pool["asset.assign.category"].create(cr, uid, {}, context=dict(context, active_ids=ids)) diff --git a/purchase_discount/purchase_discount.py b/purchase_discount/purchase_discount.py index a690d4797..14cdfc87c 100755 --- a/purchase_discount/purchase_discount.py +++ b/purchase_discount/purchase_discount.py @@ -68,7 +68,7 @@ def get_real_price(res_dict, product_id, qty, uom, pricelist): return price * factor if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) res = super(purchase_order_line, self).onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order, fiscal_position_id, date_planned, diff --git a/sale_commission/sale_order.py b/sale_commission/sale_order.py index dd36843fb..91f583d94 100755 --- a/sale_commission/sale_order.py +++ b/sale_commission/sale_order.py @@ -229,7 +229,7 @@ def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, cont line_agent_id = self._create_invoice_line_agent(cr, uid, [], l_comm.agent_id.id, l_comm.commission_id.id) list_ids.append(line_agent_id) - res['commission_ids'] = [(6, 0, list_ids)] + # res['commission_ids'] = [(6, 0, list_ids)] return res def _create_line_commission(self, cr, uid, ids, agent_id, commission_id): diff --git a/sale_order_confirm/wizard/sale_make_invoice_advance.py b/sale_order_confirm/wizard/sale_make_invoice_advance.py index 977e58286..a0a39a91c 100644 --- a/sale_order_confirm/wizard/sale_make_invoice_advance.py +++ b/sale_order_confirm/wizard/sale_make_invoice_advance.py @@ -36,7 +36,7 @@ def default_get(self, cr, uid, fields, context=None): @return: A dictionary which of fields with values. """ if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) res = super(sale_advance_payment_inv, self).default_get(cr, uid, fields, context=context) if not res.get('product_id', False): product_id = self.pool['res.users'].browse(cr, uid, uid, context).company_id.default_property_advance_product_id.id diff --git a/sale_order_price_recalculation/models/sale_order.py b/sale_order_price_recalculation/models/sale_order.py index 23e3648f2..9a7fe8d20 100755 --- a/sale_order_price_recalculation/models/sale_order.py +++ b/sale_order_price_recalculation/models/sale_order.py @@ -37,7 +37,7 @@ def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context def recalculate_prices(self, cr, uid, ids, context=None): if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) for sale in self.browse(cr, uid, ids, context): for line in sale.order_line: order = line.order_id diff --git a/sale_order_version/sale.py b/sale_order_version/sale.py index a3a707b75..6b64bbc9e 100644 --- a/sale_order_version/sale.py +++ b/sale_order_version/sale.py @@ -53,7 +53,7 @@ def action_previous_version(self, cr, uid, ids, default=None, context=None): default = {} if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) attachment_obj = self.pool['ir.attachment'] diff --git a/sale_subscriptions/models/sale.py b/sale_subscriptions/models/sale.py index d9292d71c..6c8dc1391 100644 --- a/sale_subscriptions/models/sale.py +++ b/sale_subscriptions/models/sale.py @@ -47,7 +47,7 @@ def _amount_line(self, cr, uid, ids, field_name, arg, context=None): order_obj = self.pool['sale.order'] res = {} if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) for line in self.browse(cr, uid, ids, context=context): price = line.price_unit * (1 - (line.discount or 0.0) / 100.0) taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id) @@ -579,7 +579,7 @@ def get_invoice_dates(self, cr, uid, order_id, context): def auto_invoice(self, cr, uid, ids, context=None): if context is None: - context = {} + context = self.pool['res.users'].context_get(cr, uid) if not ids: return False diff --git a/stock_picking_extended/sale/sale.py b/stock_picking_extended/sale/sale.py index 1113591eb..7ac80b08d 100644 --- a/stock_picking_extended/sale/sale.py +++ b/stock_picking_extended/sale/sale.py @@ -143,7 +143,7 @@ def _prepare_order_picking(self, cr, uid, order, context=None): def write(self, cr, uid, ids, vals, context=None): if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) # adaptative function: the system learn if not isinstance(ids, (list, tuple)): @@ -163,7 +163,7 @@ def write(self, cr, uid, ids, vals, context=None): def create(self, cr, uid, vals, context=None): if not context: - context = {} + context = self.pool['res.users'].context_get(cr, uid) # adaptative function: the system learn sale_order_id = super(sale_order, self).create(cr, uid, vals, context=context) # create function return only 1 id diff --git a/stock_picking_extended/stock/picking_view.xml b/stock_picking_extended/stock/picking_view.xml index a56eb1c00..517b1bda1 100644 --- a/stock_picking_extended/stock/picking_view.xml +++ b/stock_picking_extended/stock/picking_view.xml @@ -9,7 +9,7 @@ 1 - +