[REF]: Refactored some lines from previous commit.
bzr revid: uco@tinyerp.com-20101123113152-0ue71yg9usp1gklx
This commit is contained in:
parent
097ff85deb
commit
3700e08ed6
|
@ -902,9 +902,11 @@ class account_period(osv.osv):
|
||||||
cr.execute('update account_period set state=%s where id=%s', (mode, id))
|
cr.execute('update account_period set state=%s where id=%s', (mode, id))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
|
||||||
if args is None:
|
if args is None:
|
||||||
args = []
|
args = []
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
ids = []
|
ids = []
|
||||||
if name:
|
if name:
|
||||||
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
|
ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit)
|
||||||
|
@ -1219,7 +1221,8 @@ class account_move(osv.osv):
|
||||||
# TODO: Check if period is closed !
|
# TODO: Check if period is closed !
|
||||||
#
|
#
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
if 'line_id' in vals and context.get('copy'):
|
if 'line_id' in vals and context.get('copy'):
|
||||||
for l in vals['line_id']:
|
for l in vals['line_id']:
|
||||||
if not l[0]:
|
if not l[0]:
|
||||||
|
@ -1260,7 +1263,8 @@ class account_move(osv.osv):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default={}, context=None):
|
def copy(self, cr, uid, id, default={}, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
default.update({
|
default.update({
|
||||||
'state':'draft',
|
'state':'draft',
|
||||||
'name':'/',
|
'name':'/',
|
||||||
|
@ -1478,7 +1482,6 @@ class account_move_reconcile(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
if not ids:
|
if not ids:
|
||||||
return []
|
return []
|
||||||
result = []
|
result = []
|
||||||
|
@ -1603,7 +1606,6 @@ class account_tax_code(osv.osv):
|
||||||
|
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
if isinstance(ids, (int, long)):
|
if isinstance(ids, (int, long)):
|
||||||
ids = [ids]
|
ids = [ids]
|
||||||
if not ids:
|
if not ids:
|
||||||
|
@ -1615,7 +1617,6 @@ class account_tax_code(osv.osv):
|
||||||
for x in reads]
|
for x in reads]
|
||||||
|
|
||||||
def _default_company(self, cr, uid, context=None):
|
def _default_company(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
if user.company_id:
|
if user.company_id:
|
||||||
return user.company_id.id
|
return user.company_id.id
|
||||||
|
@ -1761,7 +1762,6 @@ class account_tax(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _default_company(self, cr, uid, context=None):
|
def _default_company(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
if user.company_id:
|
if user.company_id:
|
||||||
return user.company_id.id
|
return user.company_id.id
|
||||||
|
@ -2314,7 +2314,6 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
||||||
_name = 'account.addtmpl.wizard'
|
_name = 'account.addtmpl.wizard'
|
||||||
|
|
||||||
def _get_def_cparent(self, cr, uid, context=None):
|
def _get_def_cparent(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
acc_obj=self.pool.get('account.account')
|
acc_obj=self.pool.get('account.account')
|
||||||
tmpl_obj=self.pool.get('account.account.template')
|
tmpl_obj=self.pool.get('account.account.template')
|
||||||
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
|
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
|
||||||
|
@ -2336,7 +2335,8 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
||||||
}
|
}
|
||||||
|
|
||||||
def action_create(self,cr,uid,ids,context=None):
|
def action_create(self,cr,uid,ids,context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
acc_obj = self.pool.get('account.account')
|
acc_obj = self.pool.get('account.account')
|
||||||
tmpl_obj = self.pool.get('account.account.template')
|
tmpl_obj = self.pool.get('account.account.template')
|
||||||
data = self.read(cr, uid, ids)
|
data = self.read(cr, uid, ids)
|
||||||
|
@ -2384,7 +2384,6 @@ class account_tax_code_template(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
if not ids:
|
if not ids:
|
||||||
return []
|
return []
|
||||||
if isinstance(ids, (int, long)):
|
if isinstance(ids, (int, long)):
|
||||||
|
@ -2464,7 +2463,6 @@ class account_tax_template(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
if not ids:
|
if not ids:
|
||||||
return []
|
return []
|
||||||
res = []
|
res = []
|
||||||
|
@ -2474,7 +2472,6 @@ class account_tax_template(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _default_company(self, cr, uid, context=None):
|
def _default_company(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
if user.company_id:
|
if user.company_id:
|
||||||
return user.company_id.id
|
return user.company_id.id
|
||||||
|
@ -2602,7 +2599,6 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
||||||
}
|
}
|
||||||
|
|
||||||
def execute(self, cr, uid, ids, context=None):
|
def execute(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
obj_multi = self.browse(cr, uid, ids[0])
|
obj_multi = self.browse(cr, uid, ids[0])
|
||||||
obj_acc = self.pool.get('account.account')
|
obj_acc = self.pool.get('account.account')
|
||||||
obj_acc_tax = self.pool.get('account.tax')
|
obj_acc_tax = self.pool.get('account.tax')
|
||||||
|
|
|
@ -59,7 +59,6 @@ class account_analytic_line(osv.osv):
|
||||||
order, context=context, count=count)
|
order, context=context, count=count)
|
||||||
|
|
||||||
def _check_company(self, cr, uid, ids, context=None):
|
def _check_company(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
lines = self.browse(cr, uid, ids, context=context)
|
lines = self.browse(cr, uid, ids, context=context)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if l.move_id and not l.account_id.company_id.id == l.move_id.account_id.company_id.id:
|
if l.move_id and not l.account_id.company_id.id == l.move_id.account_id.company_id.id:
|
||||||
|
@ -135,7 +134,8 @@ class account_analytic_line(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
def view_header_get(self, cr, user, view_id, view_type, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
if context.get('account_id', False):
|
if context.get('account_id', False):
|
||||||
# account_id in context may also be pointing to an account.account.id
|
# account_id in context may also be pointing to an account.account.id
|
||||||
cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],))
|
cr.execute('select name from account_analytic_account where id=%s', (context['account_id'],))
|
||||||
|
|
|
@ -47,7 +47,8 @@ class account_bank_statement(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _default_journal_id(self, cr, uid, context=None):
|
def _default_journal_id(self, cr, uid, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
journal_pool = self.pool.get('account.journal')
|
journal_pool = self.pool.get('account.journal')
|
||||||
journal_type = context.get('journal_type', False)
|
journal_type = context.get('journal_type', False)
|
||||||
journal_id = False
|
journal_id = False
|
||||||
|
@ -58,15 +59,13 @@ class account_bank_statement(osv.osv):
|
||||||
return journal_id
|
return journal_id
|
||||||
|
|
||||||
def _default_balance_start(self, cr, uid, context=None):
|
def _default_balance_start(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
|
cr.execute('select id from account_bank_statement where journal_id=%s order by date desc limit 1', (1,))
|
||||||
res = cr.fetchone()
|
res = cr.fetchone()
|
||||||
if res:
|
if res:
|
||||||
return self.browse(cr, uid, [res[0]], context=context)[0].balance_end
|
return self.browse(cr, uid, res[0], context=context).balance_end
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||||
context = context or {}
|
|
||||||
res_currency_obj = self.pool.get('res.currency')
|
res_currency_obj = self.pool.get('res.currency')
|
||||||
res_users_obj = self.pool.get('res.users')
|
res_users_obj = self.pool.get('res.users')
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -105,7 +104,6 @@ class account_bank_statement(osv.osv):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _currency(self, cursor, user, ids, name, args, context=None):
|
def _currency(self, cursor, user, ids, name, args, context=None):
|
||||||
context = context or {}
|
|
||||||
res = {}
|
res = {}
|
||||||
res_currency_obj = self.pool.get('res.currency')
|
res_currency_obj = self.pool.get('res.currency')
|
||||||
res_users_obj = self.pool.get('res.users')
|
res_users_obj = self.pool.get('res.users')
|
||||||
|
@ -198,7 +196,8 @@ class account_bank_statement(osv.osv):
|
||||||
return self.write(cr, uid, ids, {}, context=context)
|
return self.write(cr, uid, ids, {}, context=context)
|
||||||
|
|
||||||
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
|
def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
res_currency_obj = self.pool.get('res.currency')
|
res_currency_obj = self.pool.get('res.currency')
|
||||||
account_move_obj = self.pool.get('account.move')
|
account_move_obj = self.pool.get('account.move')
|
||||||
account_move_line_obj = self.pool.get('account.move.line')
|
account_move_line_obj = self.pool.get('account.move.line')
|
||||||
|
@ -303,7 +302,6 @@ class account_bank_statement(osv.osv):
|
||||||
return st_number + '/' + str(st_line.sequence)
|
return st_number + '/' + str(st_line.sequence)
|
||||||
|
|
||||||
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
|
def balance_check(self, cr, uid, st_id, journal_type='bank', context=None):
|
||||||
context = context or {}
|
|
||||||
st = self.browse(cr, uid, st_id, context=context)
|
st = self.browse(cr, uid, st_id, context=context)
|
||||||
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
|
if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
|
||||||
raise osv.except_osv(_('Error !'),
|
raise osv.except_osv(_('Error !'),
|
||||||
|
|
|
@ -41,7 +41,6 @@ class account_cashbox_line(osv.osv):
|
||||||
@return: Dictionary of values.
|
@return: Dictionary of values.
|
||||||
"""
|
"""
|
||||||
res = {}
|
res = {}
|
||||||
context = context or {}
|
|
||||||
for obj in self.browse(cr, uid, ids, context=context):
|
for obj in self.browse(cr, uid, ids, context=context):
|
||||||
res[obj.id] = obj.pieces * obj.number
|
res[obj.id] = obj.pieces * obj.number
|
||||||
return res
|
return res
|
||||||
|
@ -77,7 +76,6 @@ class account_cash_statement(osv.osv):
|
||||||
@return: Dictionary of values.
|
@return: Dictionary of values.
|
||||||
"""
|
"""
|
||||||
res = {}
|
res = {}
|
||||||
context = context or {}
|
|
||||||
for statement in self.browse(cr, uid, ids, context=context):
|
for statement in self.browse(cr, uid, ids, context=context):
|
||||||
amount_total = 0.0
|
amount_total = 0.0
|
||||||
|
|
||||||
|
@ -98,7 +96,6 @@ class account_cash_statement(osv.osv):
|
||||||
@return: Dictionary of values.
|
@return: Dictionary of values.
|
||||||
"""
|
"""
|
||||||
res ={}
|
res ={}
|
||||||
context = context or {}
|
|
||||||
for statement in self.browse(cr, uid, ids, context=context):
|
for statement in self.browse(cr, uid, ids, context=context):
|
||||||
amount_total = 0.0
|
amount_total = 0.0
|
||||||
for line in statement.ending_details_ids:
|
for line in statement.ending_details_ids:
|
||||||
|
@ -114,7 +111,6 @@ class account_cash_statement(osv.osv):
|
||||||
@return: Dictionary of values.
|
@return: Dictionary of values.
|
||||||
"""
|
"""
|
||||||
res2={}
|
res2={}
|
||||||
context = context or {}
|
|
||||||
for statement in self.browse(cr, uid, ids, context=context):
|
for statement in self.browse(cr, uid, ids, context=context):
|
||||||
encoding_total=0.0
|
encoding_total=0.0
|
||||||
for line in statement.line_ids:
|
for line in statement.line_ids:
|
||||||
|
@ -123,7 +119,6 @@ class account_cash_statement(osv.osv):
|
||||||
return res2
|
return res2
|
||||||
|
|
||||||
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
def _end_balance(self, cursor, user, ids, name, attr, context=None):
|
||||||
context = context or {}
|
|
||||||
res_currency_obj = self.pool.get('res.currency')
|
res_currency_obj = self.pool.get('res.currency')
|
||||||
res_users_obj = self.pool.get('res.users')
|
res_users_obj = self.pool.get('res.users')
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -157,7 +152,6 @@ class account_cash_statement(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_company(self, cr, uid, context=None):
|
def _get_company(self, cr, uid, context=None):
|
||||||
context = context or {}
|
|
||||||
user_pool = self.pool.get('res.users')
|
user_pool = self.pool.get('res.users')
|
||||||
company_pool = self.pool.get('res.company')
|
company_pool = self.pool.get('res.company')
|
||||||
user = user_pool.browse(cr, uid, uid, context=context)
|
user = user_pool.browse(cr, uid, uid, context=context)
|
||||||
|
@ -246,7 +240,6 @@ class account_cash_statement(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def create(self, cr, uid, vals, context=None):
|
def create(self, cr, uid, vals, context=None):
|
||||||
context = context or {}
|
|
||||||
sql = [
|
sql = [
|
||||||
('journal_id', '=', vals.get('journal_id', False)),
|
('journal_id', '=', vals.get('journal_id', False)),
|
||||||
('state', '=', 'open')
|
('state', '=', 'open')
|
||||||
|
|
|
@ -108,7 +108,6 @@ class account_move_line(osv.osv):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def create_analytic_lines(self, cr, uid, ids, context=None):
|
def create_analytic_lines(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
acc_ana_line_obj = self.pool.get('account.analytic.line')
|
acc_ana_line_obj = self.pool.get('account.analytic.line')
|
||||||
for obj_line in self.browse(cr, uid, ids, context=context):
|
for obj_line in self.browse(cr, uid, ids, context=context):
|
||||||
if obj_line.analytic_account_id:
|
if obj_line.analytic_account_id:
|
||||||
|
@ -141,7 +140,8 @@ class account_move_line(osv.osv):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def convert_to_period(self, cr, uid, context=None):
|
def convert_to_period(self, cr, uid, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
period_obj = self.pool.get('account.period')
|
period_obj = self.pool.get('account.period')
|
||||||
#check if the period_id changed in the context from client side
|
#check if the period_id changed in the context from client side
|
||||||
if context.get('period_id', False):
|
if context.get('period_id', False):
|
||||||
|
@ -154,7 +154,8 @@ class account_move_line(osv.osv):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def _default_get(self, cr, uid, fields, context=None):
|
def _default_get(self, cr, uid, fields, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
|
if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
|
||||||
context['journal_id'] = context.get('search_default_journal_id')
|
context['journal_id'] = context.get('search_default_journal_id')
|
||||||
account_obj = self.pool.get('account.account')
|
account_obj = self.pool.get('account.account')
|
||||||
|
@ -293,10 +294,9 @@ class account_move_line(osv.osv):
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def on_create_write(self, cr, uid, id, context=None):
|
def on_create_write(self, cr, uid, id, context=None):
|
||||||
context = context or {}
|
|
||||||
if not id:
|
if not id:
|
||||||
return []
|
return []
|
||||||
ml = self.browse(cr, uid, id, context)
|
ml = self.browse(cr, uid, id, context=context)
|
||||||
return map(lambda x: x.id, ml.move_id.line_id)
|
return map(lambda x: x.id, ml.move_id.line_id)
|
||||||
|
|
||||||
def _balance(self, cr, uid, ids, name, arg, context=None):
|
def _balance(self, cr, uid, ids, name, arg, context=None):
|
||||||
|
@ -343,11 +343,10 @@ class account_move_line(osv.osv):
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
def name_get(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
if not ids:
|
if not ids:
|
||||||
return []
|
return []
|
||||||
result = []
|
result = []
|
||||||
for line in self.browse(cr, uid, ids, context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
if line.ref:
|
if line.ref:
|
||||||
result.append((line.id, (line.move_id.name or '')+' ('+line.ref+')'))
|
result.append((line.id, (line.move_id.name or '')+' ('+line.ref+')'))
|
||||||
else:
|
else:
|
||||||
|
@ -413,7 +412,6 @@ class account_move_line(osv.osv):
|
||||||
return [('id', 'in', [x[0] for x in res])]
|
return [('id', 'in', [x[0] for x in res])]
|
||||||
|
|
||||||
def _get_move_lines(self, cr, uid, ids, context=None):
|
def _get_move_lines(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
result = []
|
result = []
|
||||||
for move in self.pool.get('account.move').browse(cr, uid, ids, context=context):
|
for move in self.pool.get('account.move').browse(cr, uid, ids, context=context):
|
||||||
for line in move.line_id:
|
for line in move.line_id:
|
||||||
|
@ -464,7 +462,8 @@ class account_move_line(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_date(self, cr, uid, context=None):
|
def _get_date(self, cr, uid, context=None):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context or {}
|
||||||
period_obj = self.pool.get('account.period')
|
period_obj = self.pool.get('account.period')
|
||||||
dt = time.strftime('%Y-%m-%d')
|
dt = time.strftime('%Y-%m-%d')
|
||||||
if ('journal_id' in context) and ('period_id' in context):
|
if ('journal_id' in context) and ('period_id' in context):
|
||||||
|
@ -507,14 +506,12 @@ class account_move_line(osv.osv):
|
||||||
]
|
]
|
||||||
|
|
||||||
def _auto_init(self, cr, context=None):
|
def _auto_init(self, cr, context=None):
|
||||||
context = context or {}
|
|
||||||
super(account_move_line, self)._auto_init(cr, context=context)
|
super(account_move_line, self)._auto_init(cr, context=context)
|
||||||
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
|
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
|
||||||
if not cr.fetchone():
|
if not cr.fetchone():
|
||||||
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
|
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
|
||||||
|
|
||||||
def _check_no_view(self, cr, uid, ids, context=None):
|
def _check_no_view(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
lines = self.browse(cr, uid, ids, context=context)
|
lines = self.browse(cr, uid, ids, context=context)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if l.account_id.type == 'view':
|
if l.account_id.type == 'view':
|
||||||
|
@ -522,7 +519,6 @@ class account_move_line(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_no_closed(self, cr, uid, ids, context=None):
|
def _check_no_closed(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
lines = self.browse(cr, uid, ids, context=context)
|
lines = self.browse(cr, uid, ids, context=context)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if l.account_id.type == 'closed':
|
if l.account_id.type == 'closed':
|
||||||
|
@ -530,7 +526,6 @@ class account_move_line(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_company_id(self, cr, uid, ids, context=None):
|
def _check_company_id(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
lines = self.browse(cr, uid, ids, context=context)
|
lines = self.browse(cr, uid, ids, context=context)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:
|
if l.company_id != l.account_id.company_id or l.company_id != l.period_id.company_id:
|
||||||
|
@ -538,7 +533,6 @@ class account_move_line(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _check_partner_id(self, cr, uid, ids, context=None):
|
def _check_partner_id(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
|
||||||
lines = self.browse(cr, uid, ids, context=context)
|
lines = self.browse(cr, uid, ids, context=context)
|
||||||
for l in lines:
|
for l in lines:
|
||||||
if l.account_id.type in ('receivable', 'payable') and not l.partner_id:
|
if l.account_id.type in ('receivable', 'payable') and not l.partner_id:
|
||||||
|
@ -849,7 +843,8 @@ class account_move_line(osv.osv):
|
||||||
@return: Returns a dict which contains new values, and context
|
@return: Returns a dict which contains new values, and context
|
||||||
"""
|
"""
|
||||||
res = {}
|
res = {}
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
period_pool = self.pool.get('account.period')
|
period_pool = self.pool.get('account.period')
|
||||||
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
|
pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
|
||||||
if pids:
|
if pids:
|
||||||
|
@ -866,7 +861,8 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||||
journal_pool = self.pool.get('account.journal')
|
journal_pool = self.pool.get('account.journal')
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
|
result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
|
||||||
if view_type != 'tree':
|
if view_type != 'tree':
|
||||||
#Remove the toolbar from the form view
|
#Remove the toolbar from the form view
|
||||||
|
@ -969,7 +965,8 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
def _check_moves(self, cr, uid, context=None):
|
def _check_moves(self, cr, uid, context=None):
|
||||||
# use the first move ever created for this journal and period
|
# use the first move ever created for this journal and period
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
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']))
|
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']))
|
||||||
res = cr.fetchone()
|
res = cr.fetchone()
|
||||||
if res:
|
if res:
|
||||||
|
@ -984,7 +981,6 @@ class account_move_line(osv.osv):
|
||||||
obj_move_line = self.pool.get('account.move.line')
|
obj_move_line = self.pool.get('account.move.line')
|
||||||
obj_move_rec = self.pool.get('account.move.reconcile')
|
obj_move_rec = self.pool.get('account.move.reconcile')
|
||||||
unlink_ids = []
|
unlink_ids = []
|
||||||
context = context or {}
|
|
||||||
if not move_ids:
|
if not move_ids:
|
||||||
return True
|
return True
|
||||||
recs = obj_move_line.read(cr, uid, move_ids, ['reconcile_id', 'reconcile_partial_id'])
|
recs = obj_move_line.read(cr, uid, move_ids, ['reconcile_id', 'reconcile_partial_id'])
|
||||||
|
@ -999,11 +995,12 @@ class account_move_line(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids, context=None, check=True):
|
def unlink(self, cr, uid, ids, context=None, check=True):
|
||||||
context = context or {}
|
if context is None:
|
||||||
|
context = {}
|
||||||
move_obj = self.pool.get('account.move')
|
move_obj = self.pool.get('account.move')
|
||||||
self._update_check(cr, uid, ids, context)
|
self._update_check(cr, uid, ids, context)
|
||||||
result = False
|
result = False
|
||||||
for line in self.browse(cr, uid, ids, context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
context['journal_id'] = line.journal_id.id
|
context['journal_id'] = line.journal_id.id
|
||||||
context['period_id'] = line.period_id.id
|
context['period_id'] = line.period_id.id
|
||||||
result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
|
result = super(account_move_line, self).unlink(cr, uid, [line.id], context=context)
|
||||||
|
@ -1032,9 +1029,9 @@ class account_move_line(osv.osv):
|
||||||
journal_id = context.get('journal_id', False)
|
journal_id = context.get('journal_id', False)
|
||||||
period_id = context.get('period_id', False)
|
period_id = context.get('period_id', False)
|
||||||
if journal_id:
|
if journal_id:
|
||||||
journal = journal_obj.browse(cr, uid, [journal_id], context=context)[0]
|
journal = journal_obj.browse(cr, uid, journal_id, context=context)
|
||||||
if journal.allow_date and period_id:
|
if journal.allow_date and period_id:
|
||||||
period = period_obj.browse(cr, uid, [period_id])[0]
|
period = period_obj.browse(cr, uid, period_id, context=context)
|
||||||
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'):
|
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'):
|
||||||
raise osv.except_osv(_('Error'),_('The date of your Journal Entry is not in the defined period!'))
|
raise osv.except_osv(_('Error'),_('The date of your Journal Entry is not in the defined period!'))
|
||||||
else:
|
else:
|
||||||
|
@ -1093,7 +1090,6 @@ class account_move_line(osv.osv):
|
||||||
jour_period_obj = self.pool.get('account.journal.period')
|
jour_period_obj = self.pool.get('account.journal.period')
|
||||||
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
|
cr.execute('SELECT state FROM account_journal_period WHERE journal_id = %s AND period_id = %s', (journal_id, period_id))
|
||||||
result = cr.fetchall()
|
result = cr.fetchall()
|
||||||
context = context or {}
|
|
||||||
for (state,) in result:
|
for (state,) in result:
|
||||||
if state == 'done':
|
if state == 'done':
|
||||||
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed journal.'))
|
raise osv.except_osv(_('Error !'), _('You can not add/modify entries in a closed journal.'))
|
||||||
|
@ -1109,7 +1105,6 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
def _update_check(self, cr, uid, ids, context=None):
|
def _update_check(self, cr, uid, ids, context=None):
|
||||||
done = {}
|
done = {}
|
||||||
context = context or {}
|
|
||||||
for line in self.browse(cr, uid, ids, context=context):
|
for line in self.browse(cr, uid, ids, context=context):
|
||||||
if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
|
if line.move_id.state <> 'draft' and (not line.journal_id.entry_posted):
|
||||||
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 !'))
|
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 !'))
|
||||||
|
|
|
@ -187,9 +187,6 @@ class account_invoice(osv.osv):
|
||||||
|
|
||||||
def _get_invoice_from_line(self, cr, uid, ids, context=None):
|
def _get_invoice_from_line(self, cr, uid, ids, context=None):
|
||||||
move = {}
|
move = {}
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
|
for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
|
||||||
if line.reconcile_partial_id:
|
if line.reconcile_partial_id:
|
||||||
for line2 in line.reconcile_partial_id.line_partial_ids:
|
for line2 in line.reconcile_partial_id.line_partial_ids:
|
||||||
|
@ -204,9 +201,6 @@ class account_invoice(osv.osv):
|
||||||
|
|
||||||
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
|
def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
|
||||||
move = {}
|
move = {}
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
|
for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
|
||||||
for line in r.line_partial_ids:
|
for line in r.line_partial_ids:
|
||||||
move[line.move_id.id] = True
|
move[line.move_id.id] = True
|
||||||
|
@ -678,8 +672,6 @@ class account_invoice(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def button_compute(self, cr, uid, ids, context=None, set_total=False):
|
def button_compute(self, cr, uid, ids, context=None, set_total=False):
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
self.button_reset_taxes(cr, uid, ids, context)
|
self.button_reset_taxes(cr, uid, ids, context)
|
||||||
for inv in self.browse(cr, uid, ids, context=context):
|
for inv in self.browse(cr, uid, ids, context=context):
|
||||||
if set_total:
|
if set_total:
|
||||||
|
@ -1357,7 +1349,7 @@ class account_invoice_line(osv.osv):
|
||||||
# Parse the value_reference field to get the ID of the account.account record
|
# Parse the value_reference field to get the ID of the account.account record
|
||||||
account_id = int (my_value[0]["value_reference"].split(",")[1])
|
account_id = int (my_value[0]["value_reference"].split(",")[1])
|
||||||
# Use the ID of the account.account record in the browse for the account.account record
|
# Use the ID of the account.account record in the browse for the account.account record
|
||||||
app_acc_in = account_obj.browse(cr, uid, [account_id], context=context)[0]
|
app_acc_in = account_obj.browse(cr, uid, account_id, context=context)
|
||||||
if not exp_pro_id:
|
if not exp_pro_id:
|
||||||
ex_acc = res.product_tmpl_id.property_account_expense
|
ex_acc = res.product_tmpl_id.property_account_expense
|
||||||
ex_acc_cate = res.categ_id.property_account_expense_categ
|
ex_acc_cate = res.categ_id.property_account_expense_categ
|
||||||
|
@ -1528,9 +1520,6 @@ class account_invoice_tax(osv.osv):
|
||||||
|
|
||||||
def _count_factor(self, cr, uid, ids, name, args, context=None):
|
def _count_factor(self, cr, uid, ids, name, args, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
for invoice_tax in self.browse(cr, uid, ids, context=context):
|
for invoice_tax in self.browse(cr, uid, ids, context=context):
|
||||||
res[invoice_tax.id] = {
|
res[invoice_tax.id] = {
|
||||||
'factor_base': 1.0,
|
'factor_base': 1.0,
|
||||||
|
@ -1597,9 +1586,6 @@ class account_invoice_tax(osv.osv):
|
||||||
}
|
}
|
||||||
def compute(self, cr, uid, invoice_id, context=None):
|
def compute(self, cr, uid, invoice_id, context=None):
|
||||||
tax_grouped = {}
|
tax_grouped = {}
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
tax_obj = self.pool.get('account.tax')
|
tax_obj = self.pool.get('account.tax')
|
||||||
cur_obj = self.pool.get('res.currency')
|
cur_obj = self.pool.get('res.currency')
|
||||||
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)
|
||||||
|
|
|
@ -35,9 +35,6 @@ class account_fiscal_position(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
|
def map_tax(self, cr, uid, fposition_id, taxes, context=None):
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
|
|
||||||
if not taxes:
|
if not taxes:
|
||||||
return []
|
return []
|
||||||
if not fposition_id:
|
if not fposition_id:
|
||||||
|
@ -55,8 +52,6 @@ class account_fiscal_position(osv.osv):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def map_account(self, cr, uid, fposition_id, account_id, context=None):
|
def map_account(self, cr, uid, fposition_id, account_id, context=None):
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
if not fposition_id:
|
if not fposition_id:
|
||||||
return account_id
|
return account_id
|
||||||
for pos in fposition_id.account_ids:
|
for pos in fposition_id.account_ids:
|
||||||
|
|
|
@ -30,8 +30,6 @@ class project_account_analytic_line(osv.osv_memory):
|
||||||
}
|
}
|
||||||
|
|
||||||
def action_open_window(self, cr, uid, ids, context=None):
|
def action_open_window(self, cr, uid, ids, context=None):
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
mod_obj =self.pool.get('ir.model.data')
|
mod_obj =self.pool.get('ir.model.data')
|
||||||
domain = []
|
domain = []
|
||||||
data = self.read(cr, uid, ids, [])[0]
|
data = self.read(cr, uid, ids, [])[0]
|
||||||
|
|
|
@ -28,8 +28,6 @@ import tools
|
||||||
from osv import fields,osv
|
from osv import fields,osv
|
||||||
|
|
||||||
def _code_get(self, cr, uid, context=None):
|
def _code_get(self, cr, uid, context=None):
|
||||||
if context is None:
|
|
||||||
context = {}
|
|
||||||
acc_type_obj = self.pool.get('account.account.type')
|
acc_type_obj = self.pool.get('account.account.type')
|
||||||
ids = acc_type_obj.search(cr, uid, [])
|
ids = acc_type_obj.search(cr, uid, [])
|
||||||
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
|
res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
|
||||||
|
@ -102,9 +100,7 @@ class report_aged_receivable(osv.osv):
|
||||||
|
|
||||||
def _calc_bal(self, cr, uid, ids, name, args, context=None):
|
def _calc_bal(self, cr, uid, ids, name, args, context=None):
|
||||||
res = {}
|
res = {}
|
||||||
if context is None:
|
for period in self.read(cr, uid, ids, ['name'], context=context):
|
||||||
context = {}
|
|
||||||
for period in self.read(cr,uid,ids,['name'],context=context):
|
|
||||||
date1,date2 = period['name'].split(' to ')
|
date1,date2 = period['name'].split(' to ')
|
||||||
cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
|
cr.execute("SELECT SUM(credit-debit) FROM account_move_line AS line, account_account as ac \
|
||||||
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
|
WHERE (line.account_id=ac.id) AND ac.type='receivable' \
|
||||||
|
|
|
@ -181,6 +181,7 @@ class auction_lots_send_aie(osv.osv_memory):
|
||||||
cr.execute('select name,aie_categ from auction_lot_category')
|
cr.execute('select name,aie_categ from auction_lot_category')
|
||||||
vals = dict(cr.fetchall())
|
vals = dict(cr.fetchall())
|
||||||
cr.close()
|
cr.close()
|
||||||
|
if context is None: context = {}
|
||||||
|
|
||||||
service = netsvc.LocalService("object_proxy")
|
service = netsvc.LocalService("object_proxy")
|
||||||
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'])
|
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'])
|
||||||
|
|
|
@ -369,7 +369,7 @@ class crm_case(object):
|
||||||
return self.remind_user(cr, uid, ids, context, attach,
|
return self.remind_user(cr, uid, ids, context, attach,
|
||||||
destination=False)
|
destination=False)
|
||||||
|
|
||||||
def remind_user(self, cr, uid, ids, context=None, attach=False,destination=True):
|
def remind_user(self, cr, uid, ids, context=None, attach=False, destination=True):
|
||||||
"""
|
"""
|
||||||
@param self: The object pointer
|
@param self: The object pointer
|
||||||
@param cr: the current row, from the database cursor,
|
@param cr: the current row, from the database cursor,
|
||||||
|
|
|
@ -36,7 +36,7 @@ class delivery_carrier(osv.osv):
|
||||||
if not order_id:
|
if not order_id:
|
||||||
res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
|
res = super(delivery_carrier, self).name_get(cr, uid, ids, context=context)
|
||||||
else:
|
else:
|
||||||
order = self.pool.get('sale.order').browse(cr, uid, [order_id], context=context)[0]
|
order = self.pool.get('sale.order').browse(cr, uid, order_id, context=context)
|
||||||
currency = order.pricelist_id.currency_id.name or ''
|
currency = order.pricelist_id.currency_id.name or ''
|
||||||
res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
|
res = [(r['id'], r['name']+' ('+(str(r['price']))+' '+currency+')') for r in self.read(cr, uid, ids, ['name', 'price'], context)]
|
||||||
return res
|
return res
|
||||||
|
@ -50,7 +50,7 @@ class delivery_carrier(osv.osv):
|
||||||
order_id=context.get('order_id',False)
|
order_id=context.get('order_id',False)
|
||||||
price=False
|
price=False
|
||||||
if order_id:
|
if order_id:
|
||||||
order = sale_obj.browse(cr, uid, [order_id], context=context)[0]
|
order = sale_obj.browse(cr, uid, order_id, context=context)
|
||||||
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
|
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
|
||||||
if carrier_grid:
|
if carrier_grid:
|
||||||
price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
|
price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
|
||||||
|
@ -70,7 +70,7 @@ class delivery_carrier(osv.osv):
|
||||||
'active': lambda *args:1
|
'active': lambda *args:1
|
||||||
}
|
}
|
||||||
def grid_get(self, cr, uid, ids, contact_id, context=None):
|
def grid_get(self, cr, uid, ids, contact_id, context=None):
|
||||||
contact = self.pool.get('res.partner.address').browse(cr, uid, [contact_id], context=context)[0]
|
contact = self.pool.get('res.partner.address').browse(cr, uid, contact_id, context=context)
|
||||||
for carrier in self.browse(cr, uid, ids, context=context):
|
for carrier in self.browse(cr, uid, ids, context=context):
|
||||||
for grid in carrier.grids_id:
|
for grid in carrier.grids_id:
|
||||||
get_id = lambda x: x.id
|
get_id = lambda x: x.id
|
||||||
|
|
|
@ -240,7 +240,7 @@ class mrp_bom(osv.osv):
|
||||||
@return: Dictionary of changed values
|
@return: Dictionary of changed values
|
||||||
"""
|
"""
|
||||||
if product_id:
|
if product_id:
|
||||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id], context=context)[0]
|
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||||
v = {'product_uom': prod.uom_id.id}
|
v = {'product_uom': prod.uom_id.id}
|
||||||
if not name:
|
if not name:
|
||||||
v['name'] = prod.name
|
v['name'] = prod.name
|
||||||
|
|
|
@ -89,7 +89,7 @@ class mrp_repair(osv.osv):
|
||||||
tax = self._amount_tax(cr, uid, ids, field_name, arg, context=context)
|
tax = self._amount_tax(cr, uid, ids, field_name, arg, context=context)
|
||||||
cur_obj = self.pool.get('res.currency')
|
cur_obj = self.pool.get('res.currency')
|
||||||
for id in ids:
|
for id in ids:
|
||||||
repair = self.browse(cr, uid, [id], context=context)[0]
|
repair = self.browse(cr, uid, id, context=context)
|
||||||
cur = repair.pricelist_id.currency_id
|
cur = repair.pricelist_id.currency_id
|
||||||
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
|
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -81,7 +81,7 @@ class process_process(osv.osv):
|
||||||
|
|
||||||
pool = pooler.get_pool(cr.dbname)
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
|
||||||
process = pool.get('process.process').browse(cr, uid, [id], context=context)[0]
|
process = pool.get('process.process').browse(cr, uid, id, context=context)
|
||||||
|
|
||||||
name = process.name
|
name = process.name
|
||||||
resource = None
|
resource = None
|
||||||
|
@ -95,8 +95,8 @@ class process_process(osv.osv):
|
||||||
states = dict(pool.get(res_model).fields_get(cr, uid, context=context).get('state', {}).get('selection', {}))
|
states = dict(pool.get(res_model).fields_get(cr, uid, context=context).get('state', {}).get('selection', {}))
|
||||||
|
|
||||||
if res_id:
|
if res_id:
|
||||||
current_object = pool.get(res_model).browse(cr, uid, [res_id], context=context)[0]
|
current_object = pool.get(res_model).browse(cr, uid, res_id, context=context)
|
||||||
current_user = pool.get('res.users').browse(cr, uid, [uid], context=context)[0]
|
current_user = pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||||
expr_context = Env(current_object, current_user)
|
expr_context = Env(current_object, current_user)
|
||||||
resource = current_object.name
|
resource = current_object.name
|
||||||
if 'state' in current_object:
|
if 'state' in current_object:
|
||||||
|
@ -188,7 +188,7 @@ class process_process(osv.osv):
|
||||||
|
|
||||||
nodes[nid]['res'] = resource = {'id': ref_id, 'model': ref_model}
|
nodes[nid]['res'] = resource = {'id': ref_id, 'model': ref_model}
|
||||||
|
|
||||||
refobj = pool.get(ref_model).browse(cr, uid, [ref_id], context=context)[0]
|
refobj = pool.get(ref_model).browse(cr, uid, ref_id, context=context)
|
||||||
fields = pool.get(ref_model).fields_get(cr, uid, context=context)
|
fields = pool.get(ref_model).fields_get(cr, uid, context=context)
|
||||||
|
|
||||||
# check for directory_id from inherited from document module
|
# check for directory_id from inherited from document module
|
||||||
|
@ -253,7 +253,7 @@ class process_process(osv.osv):
|
||||||
default = {}
|
default = {}
|
||||||
|
|
||||||
pool = pooler.get_pool(cr.dbname)
|
pool = pooler.get_pool(cr.dbname)
|
||||||
process = pool.get('process.process').browse(cr, uid, [id], context=context)[0]
|
process = pool.get('process.process').browse(cr, uid, id, context=context)
|
||||||
|
|
||||||
nodes = {}
|
nodes = {}
|
||||||
transitions = {}
|
transitions = {}
|
||||||
|
@ -370,7 +370,7 @@ class process_transition_action(osv.osv):
|
||||||
if not default:
|
if not default:
|
||||||
default = {}
|
default = {}
|
||||||
|
|
||||||
state = self.pool.get('process.transition.action').browse(cr, uid, [id], context=context)[0].state
|
state = self.pool.get('process.transition.action').browse(cr, uid, id, context=context).state
|
||||||
if state:
|
if state:
|
||||||
default['state'] = state
|
default['state'] = state
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,7 @@ class product_pricelist_version(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
# We desactivate duplicated pricelists, so that dates do not overlap
|
# We desactivate duplicated pricelists, so that dates do not overlap
|
||||||
def copy(self, cr, uid, id, default=None,context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
if not default: default= {}
|
if not default: default= {}
|
||||||
default['active'] = False
|
default['active'] = False
|
||||||
return super(product_pricelist_version, self).copy(cr, uid, id, default, context)
|
return super(product_pricelist_version, self).copy(cr, uid, id, default, context)
|
||||||
|
|
|
@ -460,7 +460,7 @@ class purchase_order(osv.osv):
|
||||||
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
|
||||||
return picking_id
|
return picking_id
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default=None,context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
if not default:
|
if not default:
|
||||||
default = {}
|
default = {}
|
||||||
default.update({
|
default.update({
|
||||||
|
|
|
@ -107,7 +107,7 @@ class purchase_requisition_line(osv.osv):
|
||||||
"""
|
"""
|
||||||
value = {'product_uom_id': ''}
|
value = {'product_uom_id': ''}
|
||||||
if product_id:
|
if product_id:
|
||||||
prod = self.pool.get('product.product').browse(cr, uid, [product_id], context=context)[0]
|
prod = self.pool.get('product.product').browse(cr, uid, product_id, context=context)
|
||||||
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
|
value = {'product_uom_id': prod.uom_id.id,'product_qty':1.0}
|
||||||
return {'value': value}
|
return {'value': value}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ class purchase_requisition_partner(osv.osv_memory):
|
||||||
acc_pos_obj = self.pool.get('account.fiscal.position')
|
acc_pos_obj = self.pool.get('account.fiscal.position')
|
||||||
partner_id = data[0]['partner_id']
|
partner_id = data[0]['partner_id']
|
||||||
|
|
||||||
supplier_data = partner_obj.browse(cr, uid,[ partner_id], context=context)[0]
|
supplier_data = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||||
|
|
||||||
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
|
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
|
||||||
list_line=[]
|
list_line=[]
|
||||||
|
|
|
@ -668,7 +668,7 @@ class stock_picking(osv.osv):
|
||||||
if default is None:
|
if default is None:
|
||||||
default = {}
|
default = {}
|
||||||
default = default.copy()
|
default = default.copy()
|
||||||
picking_obj = self.browse(cr, uid, [id], context=context)[0]
|
picking_obj = self.browse(cr, uid, id, context=context)
|
||||||
move_obj=self.pool.get('stock.move')
|
move_obj=self.pool.get('stock.move')
|
||||||
if ('name' not in default) or (picking_obj.name=='/'):
|
if ('name' not in default) or (picking_obj.name=='/'):
|
||||||
seq_obj_name = 'stock.picking.' + picking_obj.type
|
seq_obj_name = 'stock.picking.' + picking_obj.type
|
||||||
|
@ -677,7 +677,7 @@ class stock_picking(osv.osv):
|
||||||
default['backorder_id'] = False
|
default['backorder_id'] = False
|
||||||
res=super(stock_picking, self).copy(cr, uid, id, default, context)
|
res=super(stock_picking, self).copy(cr, uid, id, default, context)
|
||||||
if res:
|
if res:
|
||||||
picking_obj = self.browse(cr, uid, [res], context)[0]
|
picking_obj = self.browse(cr, uid, res, context=context)
|
||||||
for move in picking_obj.move_lines:
|
for move in picking_obj.move_lines:
|
||||||
move_obj.write(cr, uid, [move.id], {'tracking_id': False,'prodlot_id':False})
|
move_obj.write(cr, uid, [move.id], {'tracking_id': False,'prodlot_id':False})
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -86,7 +86,7 @@ class stock_fill_inventory(osv.osv_memory):
|
||||||
for location in res_location.keys():
|
for location in res_location.keys():
|
||||||
res = res_location[location]
|
res = res_location[location]
|
||||||
for product_id in res.keys():
|
for product_id in res.keys():
|
||||||
prod = product_obj.browse(cr, uid, [product_id], context=context)[0]
|
prod = product_obj.browse(cr, uid, product_id, context=context)
|
||||||
uom = prod.uom_id.id
|
uom = prod.uom_id.id
|
||||||
context.update(uom=uom, compute_child=False)
|
context.update(uom=uom, compute_child=False)
|
||||||
amount = stock_location_obj._product_get(cr, uid,
|
amount = stock_location_obj._product_get(cr, uid,
|
||||||
|
|
|
@ -94,7 +94,7 @@ class survey(osv.osv):
|
||||||
self.write(cr, uid, ids, {'state': 'cancel' })
|
self.write(cr, uid, ids, {'state': 'cancel' })
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default=None,context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
||||||
|
|
||||||
def action_print_survey(self, cr, uid, ids, context=None):
|
def action_print_survey(self, cr, uid, ids, context=None):
|
||||||
|
@ -631,7 +631,7 @@ class survey_response(osv.osv):
|
||||||
res.append((record['id'], name))
|
res.append((record['id'], name))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def copy(self, cr, uid, id, default=None,context=None):
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
raise osv.except_osv(_('Warning !'),_('You cannot duplicate the resource!'))
|
||||||
|
|
||||||
survey_response()
|
survey_response()
|
||||||
|
|
Loading…
Reference in New Issue