[MERGE] Sale, Point of sale: Get_id on model data calling replaced by get object referce => MTR branch
bzr revid: mra@mra-laptop-20101029041701-z51eucau74vxmx1y
This commit is contained in:
commit
daa0158657
|
@ -50,22 +50,20 @@ class pos_close_statement(osv.osv_memory):
|
|||
if not journal.check_dtls:
|
||||
statement_obj.button_confirm_cash(cr, uid, ids, context=context)
|
||||
|
||||
id2 = mod_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')
|
||||
id3 = mod_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')
|
||||
result = mod_obj._get_id(cr, uid, 'point_of_sale', 'view_pos_confirm_cash_statement_filter')
|
||||
search_id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
if id2:
|
||||
id2 = mod_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = mod_obj.browse(cr, uid, id3, context=context).res_id
|
||||
tree_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_bank_statement_tree')
|
||||
tree_id = tree_res and tree_res[1] or False
|
||||
form_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_bank_statement_form2')
|
||||
form_id = form_res and form_res[1] or False
|
||||
search_id = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_pos_confirm_cash_statement_filter')
|
||||
|
||||
return {
|
||||
'domain': "[('id', 'in', " + str(ids) + ")]",
|
||||
'name': 'Close Statements',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree, form',
|
||||
'search_view_id': search_id['res_id'],
|
||||
'search_view_id': search_id and search_id[1] or False,
|
||||
'res_model': 'account.bank.statement',
|
||||
'views': [(id2, 'tree'), (id3, 'form')],
|
||||
'views': [(tree_id, 'tree'), (form_id, 'form')],
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
|
|
|
@ -65,23 +65,20 @@ class pos_open_statement(osv.osv_memory):
|
|||
statement_id = statement_obj.create(cr, uid, data, context=context)
|
||||
statement_obj.button_open(cr, uid, [statement_id], context)
|
||||
|
||||
id2 = mod_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')
|
||||
id3 = mod_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')
|
||||
result = mod_obj._get_id(cr, uid, 'point_of_sale', 'view_pos_open_cash_statement_filter')
|
||||
search_id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
if id2:
|
||||
id2 = mod_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = mod_obj.browse(cr, uid, id3, context=context).res_id
|
||||
tree_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_bank_statement_tree')
|
||||
tree_id = tree_res and tree_res[1] or False
|
||||
form_res = mod_obj.get_object_reference(cr, uid, 'account', 'view_bank_statement_form2')
|
||||
form_id = form_res and form_res[1] or False
|
||||
search_id = mod_obj.get_object_reference(cr, uid, 'point_of_sale', 'view_pos_open_cash_statement_filter')
|
||||
|
||||
return {
|
||||
'domain': "[('state', '=', 'open'),('user_id', '=', "+ str(uid) +")]",
|
||||
'name': 'Open Statement',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree, form',
|
||||
'search_view_id': search_id['res_id'],
|
||||
'search_view_id': search_id and search_id[1] or False ,
|
||||
'res_model': 'account.bank.statement',
|
||||
'views': [(id2, 'tree'), (id3, 'form')],
|
||||
'views': [(tree_id, 'tree'), (form_id, 'form')],
|
||||
'context': {'search_default_open': 1},
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
|
|
@ -469,13 +469,14 @@ class sale_order(osv.osv):
|
|||
inv_ids1.add(record.id)
|
||||
inv_ids = list(inv_ids1.difference(inv_ids))
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'invoice_form')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
result = {
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
|
||||
res_id = res and res[1] or False,
|
||||
|
||||
return {
|
||||
'name': 'Customer Invoices',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'view_id': [res['res_id']],
|
||||
'view_id': [res_id],
|
||||
'res_model': 'account.invoice',
|
||||
'context': "{'type':'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
|
@ -483,7 +484,6 @@ class sale_order(osv.osv):
|
|||
'target': 'current',
|
||||
'res_id': inv_ids and inv_ids[0] or False,
|
||||
}
|
||||
return result
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
|
||||
res = False
|
||||
|
@ -1220,8 +1220,8 @@ class sale_config_picking_policy(osv.osv_memory):
|
|||
ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], o.order_policy)
|
||||
if o.step == 'one':
|
||||
md = self.pool.get('ir.model.data')
|
||||
location_id = md._get_id(cr, uid, 'stock', 'stock_location_output')
|
||||
location_id = md.browse(cr, uid, location_id, context=context).res_id
|
||||
location_id = md.get_object_reference(cr, uid, 'stock', 'stock_location_output')
|
||||
location_id = location_id and location_id[1] or False
|
||||
self.pool.get('stock.location').write(cr, uid, [location_id], {'chained_auto_packing': 'transparent'})
|
||||
|
||||
sale_config_picking_policy()
|
||||
|
|
|
@ -44,6 +44,7 @@ class sale_make_invoice(osv.osv_memory):
|
|||
|
||||
def make_invoices(self, cr, uid, ids, context={}):
|
||||
order_obj = self.pool.get('sale.order')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
newinv = []
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
order_obj.action_invoice_create(cr, uid, context.get(('active_ids'), []), data['grouped'], date_inv = data['invoice_date'])
|
||||
|
@ -55,10 +56,8 @@ class sale_make_invoice(osv.osv_memory):
|
|||
for i in o.invoice_ids:
|
||||
newinv.append(i.id)
|
||||
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
res = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
|
||||
'name': 'Invoices',
|
||||
|
@ -68,7 +67,7 @@ class sale_make_invoice(osv.osv_memory):
|
|||
'view_id': False,
|
||||
'context': "{'type': 'out_refund'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': id['res_id']
|
||||
'search_view_id': res and res[1] or False
|
||||
}
|
||||
|
||||
sale_make_invoice()
|
||||
|
|
|
@ -135,7 +135,8 @@ sale_advance_payment_inv()
|
|||
class sale_open_invoice(osv.osv_memory):
|
||||
_name = "sale.open.invoice"
|
||||
_description = "Sale Open Invoice"
|
||||
def open_invoice(self, cr, uid, ids, context):
|
||||
|
||||
def open_invoice(self, cr, uid, ids, context=None):
|
||||
|
||||
"""
|
||||
To open invoice.
|
||||
|
@ -147,14 +148,15 @@ class sale_open_invoice(osv.osv_memory):
|
|||
@return:
|
||||
|
||||
"""
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
for advance_pay in self.browse(cr, uid, ids):
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
form_id = mod_obj._get_id(cr, uid, 'account', 'invoice_form')
|
||||
form_res = mod_obj.browse(cr, uid, form_id, context=context).res_id
|
||||
tree_id = mod_obj._get_id(cr, uid, 'account', 'invoice_tree')
|
||||
tree_res = mod_obj.browse(cr, uid, tree_id, context=context).res_id
|
||||
form_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
|
||||
form_id = form_res and form_res[1] or False
|
||||
tree_res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_tree')
|
||||
tree_id = tree_res and tree_res[1] or False
|
||||
|
||||
return {
|
||||
'name': _('Advance Invoice'),
|
||||
'view_type': 'form',
|
||||
|
@ -162,7 +164,7 @@ class sale_open_invoice(osv.osv_memory):
|
|||
'res_model': 'account.invoice',
|
||||
'res_id': int(context['invoice_id'][0]),
|
||||
'view_id': False,
|
||||
'views': [(form_res, 'form'), (tree_res, 'tree')],
|
||||
'views': [(form_id, 'form'), (tree_id, 'tree')],
|
||||
'context': "{'type': 'out_invoice'}",
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue