[MERGE]: Merge with lp:openobject-trunk-dev-addons2
bzr revid: ksa@tinyerp.co.in-20110217052111-lt9dztgezvcxgvwj
This commit is contained in:
commit
19030ec02c
|
@ -144,9 +144,6 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
form = self.read(cr, uid, ids, [])[0]
|
||||
for m2o_field in ['journal_id','period_id','writeoff_acc_id']:
|
||||
if form[m2o_field] and isinstance(form[m2o_field], tuple):
|
||||
form[m2o_field] = form[m2o_field][0]
|
||||
max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0
|
||||
power = form['power']
|
||||
allow_write_off = form['allow_write_off']
|
||||
|
@ -255,4 +252,4 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
|
||||
account_automatic_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -45,8 +45,8 @@ class account_change_currency(osv.osv_memory):
|
|||
obj_currency = self.pool.get('res.currency')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids)[0]
|
||||
new_currency = data.currency_id.id
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
new_currency = data['currency_id']
|
||||
|
||||
invoice = obj_inv.browse(cr, uid, context['active_id'], context=context)
|
||||
if invoice.currency_id.id == new_currency:
|
||||
|
@ -76,4 +76,4 @@ class account_change_currency(osv.osv_memory):
|
|||
|
||||
account_change_currency()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -79,17 +79,17 @@ class account_chart(osv.osv_memory):
|
|||
fy_obj = self.pool.get('account.fiscalyear')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_tree')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['periods'] = []
|
||||
if data.period_from and data.period_to:
|
||||
result['periods'] = period_obj.build_ctx_periods(cr, uid, data.period_from.id, data.period_to.id)
|
||||
result['context'] = str({'fiscalyear': data.fiscalyear.id, 'periods': result['periods'], \
|
||||
'state': data.target_move})
|
||||
if data.fiscalyear:
|
||||
result['name'] += ':' + fy_obj.read(cr, uid, [data.fiscalyear.id], context=context)[0]['code']
|
||||
if data['period_from'] and data['period_to']:
|
||||
result['periods'] = period_obj.build_ctx_periods(cr, uid, data['period_from'], data['period_to'])
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \
|
||||
'state': data['target_move']})
|
||||
if data['fiscalyear']:
|
||||
result['name'] += ':' + fy_obj.read(cr, uid, [data['fiscalyear']], context=context)[0]['code']
|
||||
return result
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -56,10 +56,7 @@ class account_fiscalyear_close(osv.osv_memory):
|
|||
obj_acc_account = self.pool.get('account.account')
|
||||
obj_acc_journal_period = self.pool.get('account.journal.period')
|
||||
|
||||
data = self.read(cr, uid, ids, context=context)
|
||||
for m2o_field in ['fy_id','fy2_id','journal_id','period_id']:
|
||||
if isinstance(data[0][m2o_field], tuple):
|
||||
data[0][m2o_field] = data[0][m2o_field][0]
|
||||
data = self.read(cr, uid, ids, context=context)
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
|
|
|
@ -40,8 +40,8 @@ class account_fiscalyear_close_state(osv.osv_memory):
|
|||
@param ids: List of Account fiscalyear close state’s IDs
|
||||
|
||||
"""
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
fy_id = data.fy_id.id
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
fy_id = data['fy_id']
|
||||
|
||||
cr.execute('UPDATE account_journal_period ' \
|
||||
'SET state = %s ' \
|
||||
|
@ -61,4 +61,4 @@ class account_fiscalyear_close_state(osv.osv_memory):
|
|||
|
||||
account_fiscalyear_close_state()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -95,8 +95,6 @@ class account_invoice_refund(osv.osv_memory):
|
|||
description = False
|
||||
company = res_users_obj.browse(cr, uid, uid, context=context).company_id
|
||||
journal_id = form.get('journal_id', False)
|
||||
if isinstance(journal_id, tuple):
|
||||
journal_id = journal_id[0]
|
||||
for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context):
|
||||
if inv.state in ['draft', 'proforma2', 'cancel']:
|
||||
raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
|
||||
|
@ -104,8 +102,6 @@ class account_invoice_refund(osv.osv_memory):
|
|||
raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))
|
||||
if form['period']:
|
||||
period = form['period']
|
||||
if isinstance(period, tuple):
|
||||
period = period[0]
|
||||
else:
|
||||
period = inv.period_id and inv.period_id.id or False
|
||||
|
||||
|
@ -221,4 +217,4 @@ class account_invoice_refund(osv.osv_memory):
|
|||
|
||||
account_invoice_refund()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -41,15 +41,15 @@ class account_move_bank_reconcile(osv.osv_memory):
|
|||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
cr.execute('select default_credit_account_id \
|
||||
from account_journal where id=%s', (data.journal_id.id,))
|
||||
from account_journal where id=%s', (data['journal_id'],))
|
||||
account_id = cr.fetchone()[0]
|
||||
if not account_id:
|
||||
raise osv.except_osv(_('Error'), _('You have to define \
|
||||
the bank account\nin the journal definition for reconciliation.'))
|
||||
return {
|
||||
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data.journal_id.id, account_id),
|
||||
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id),
|
||||
'name': _('Standard Encoding'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
|
@ -61,4 +61,4 @@ the bank account\nin the journal definition for reconciliation.'))
|
|||
|
||||
account_move_bank_reconcile()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -39,9 +39,9 @@ class account_move_line_reconcile_select(osv.osv_memory):
|
|||
@return: dictionary of Open account move line window for reconcile on given account id
|
||||
|
||||
"""
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
return {
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data.account_id.id,
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'],
|
||||
'name': _('Reconciliation'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
|
@ -52,4 +52,4 @@ class account_move_line_reconcile_select(osv.osv_memory):
|
|||
|
||||
account_move_line_reconcile_select()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -28,9 +28,9 @@ class account_move_line_unreconcile_select(osv.osv_memory):
|
|||
'account_id': fields.many2one('account.account','Account',required=True),
|
||||
}
|
||||
def action_open_window(self, cr, uid, ids, context=None):
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
return {
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data.account_id.id,
|
||||
'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'],
|
||||
'name': 'Unreconciliation',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
|
@ -41,4 +41,4 @@ class account_move_line_unreconcile_select(osv.osv_memory):
|
|||
|
||||
account_move_line_unreconcile_select()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -152,13 +152,13 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
|
|||
period_obj = self.pool.get('account.period')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids,context=context)[0]
|
||||
account_id = data.writeoff_acc_id.id
|
||||
context['date_p'] = data.date_p
|
||||
journal_id = data.journal_id.id
|
||||
context['comment'] = data.comment
|
||||
if data.analytic_id:
|
||||
context['analytic_id'] = data.analytic_id.id
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
account_id = data['writeoff_acc_id']
|
||||
context['date_p'] = data['date_p']
|
||||
journal_id = data['journal_id']
|
||||
context['comment'] = data['comment']
|
||||
if data['analytic_id']:
|
||||
context['analytic_id'] = data['analytic_id']
|
||||
if context['date_p']:
|
||||
date = context['date_p']
|
||||
|
||||
|
@ -173,4 +173,4 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
|
|||
|
||||
account_move_line_reconcile_writeoff()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -54,20 +54,20 @@ class account_tax_chart(osv.osv_memory):
|
|||
period_obj = self.pool.get('account.period')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_tax_code_tree')
|
||||
id = result and result[1] or False
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
if data.period_id:
|
||||
fiscalyear_id = period_obj.read(cr, uid, [data.period_id.id], context=context)[0]['fiscalyear_id'][0]
|
||||
result['context'] = str({'period_id': data.period_id.id, \
|
||||
if data['period_id']:
|
||||
fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0]
|
||||
result['context'] = str({'period_id': data['period_id'], \
|
||||
'fiscalyear_id': fiscalyear_id, \
|
||||
'state': data.target_move})
|
||||
'state': data['target_move']})
|
||||
else:
|
||||
result['context'] = str({'state': data.target_move})
|
||||
result['context'] = str({'state': data['target_move']})
|
||||
|
||||
if data.period_id:
|
||||
period_code = period_obj.read(cr, uid, [data.period_id.id], context=context)[0]['code']
|
||||
if data['period_id']:
|
||||
period_code = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['code']
|
||||
result['name'] += period_code and (':' + period_code) or ''
|
||||
return result
|
||||
|
||||
|
@ -78,4 +78,4 @@ class account_tax_chart(osv.osv_memory):
|
|||
|
||||
account_tax_chart()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -45,8 +45,6 @@ class account_crossovered_analytic(osv.osv_memory):
|
|||
acc_ids = [x[0] for x in res]
|
||||
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
if isinstance(data['ref'],tuple):
|
||||
data['ref'] = data['ref'][0]
|
||||
|
||||
obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context)
|
||||
name = obj_acc.name
|
||||
|
@ -74,4 +72,4 @@ class account_crossovered_analytic(osv.osv_memory):
|
|||
|
||||
account_crossovered_analytic()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -69,14 +69,14 @@ class account_coda_import(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.browse(cr, uid, ids)[0]
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
codafile = data.coda
|
||||
journal_code = journal_obj.browse(cr, uid, data.journal_id.id, context=context).code
|
||||
codafile = data['coda']
|
||||
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code
|
||||
|
||||
period = account_period_obj.find(cr, uid, context=context)[0]
|
||||
def_pay_acc = data.def_payable.id
|
||||
def_rec_acc = data.def_receivable.id
|
||||
def_pay_acc = data['def_payable']
|
||||
def_rec_acc = data['def_receivable']
|
||||
|
||||
err_log = "Errors:\n------\n"
|
||||
nb_err=0
|
||||
|
@ -96,7 +96,7 @@ class account_coda_import(osv.osv_memory):
|
|||
bank_statement["bank_statement_line"]={}
|
||||
bank_statement_lines = {}
|
||||
bank_statement['date'] = str2date(line[5:11])
|
||||
bank_statement['journal_id']=data.journal_id.id
|
||||
bank_statement['journal_id']=data['journal_id']
|
||||
period_id = account_period_obj.search(cr, uid, [('date_start', '<=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d"))), ('date_stop', '>=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d")))])
|
||||
bank_statement['period_id'] = period_id and period_id[0] or False
|
||||
bank_statement['state']='draft'
|
||||
|
@ -144,7 +144,7 @@ class account_coda_import(osv.osv_memory):
|
|||
bank_statement["bank_statement_line"]=bank_statement_lines
|
||||
elif line[1] == '2':
|
||||
st_line_name = line[2:6]
|
||||
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
|
||||
bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']})
|
||||
|
||||
elif line[1] == '3':
|
||||
# movement data record 3.1
|
||||
|
@ -165,7 +165,7 @@ class account_coda_import(osv.osv_memory):
|
|||
else:
|
||||
nb_err += 1
|
||||
err_log += _('The bank account %s is not defined for the partner %s.\n')%(cntry_number, contry_name)
|
||||
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
|
||||
bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']})
|
||||
|
||||
bank_statement["bank_statement_line"]=bank_statement_lines
|
||||
elif line[0]=='3':
|
||||
|
@ -296,7 +296,7 @@ class account_coda_import(osv.osv_memory):
|
|||
'name': codafile,
|
||||
'statement_ids': [(6, 0, bkst_list,)],
|
||||
'note': str_log1+str_not+std_log+err_log,
|
||||
'journal_id': data.journal_id.id,
|
||||
'journal_id': data['journal_id'],
|
||||
'date': time.strftime("%Y-%m-%d"),
|
||||
'user_id': uid,
|
||||
})
|
||||
|
@ -336,4 +336,4 @@ class account_coda_import(osv.osv_memory):
|
|||
|
||||
account_coda_import()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -48,10 +48,10 @@ class account_followup_print(osv.osv_memory):
|
|||
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'followup_id': data.followup_id.id, 'date':data.date})
|
||||
context.update({'followup_id': data['followup_id'], 'date':data['date']})
|
||||
return {
|
||||
'name': _('Select Partners'),
|
||||
'view_type': 'form',
|
||||
|
|
|
@ -37,10 +37,7 @@ class account_invoice_with_message(report_sxw.rml_parse):
|
|||
self.context = context
|
||||
|
||||
def spcl_msg(self, form):
|
||||
msg_id = form['message']
|
||||
if isinstance(msg_id, (tuple,list)):
|
||||
msg_id = msg_id[0]
|
||||
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, msg_id)
|
||||
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message'])
|
||||
msg = account_msg_data.msg
|
||||
return msg
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class job2phonecall(osv.osv_memory):
|
|||
phonecall_case_obj = self.pool.get('crm.phonecall')
|
||||
if context is None:
|
||||
context = {}
|
||||
form = self.browse(cr, uid, ids, context=context)[0]
|
||||
form = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter')
|
||||
res = mod_obj.read(cr, uid, result, ['res_id'], context=context)
|
||||
# Select the view
|
||||
|
@ -85,10 +85,10 @@ class job2phonecall(osv.osv_memory):
|
|||
#TODO: Take other info from job
|
||||
new_phonecall_id = phonecall_case_obj.create(cr, uid, {
|
||||
'name': job.name,
|
||||
'user_id': form.user_id.id,
|
||||
'categ_id': form.category_id.id,
|
||||
'description': form.note,
|
||||
'date': form.deadline,
|
||||
'user_id': form['user_id'],
|
||||
'categ_id': form['category_id'],
|
||||
'description': form['note'],
|
||||
'date': form['deadline'],
|
||||
'description': job.description,
|
||||
'partner_id': job.partner_id.id,
|
||||
'partner_address_id': job.partner_address_id.id,
|
||||
|
|
|
@ -63,13 +63,13 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
|
||||
account_ids = {}
|
||||
for line in self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context=context):
|
||||
account_ids[line.account_id.id] = True
|
||||
|
||||
account_ids = account_ids.keys() #data.accounts
|
||||
account_ids = account_ids.keys() #data['accounts']
|
||||
for account in analytic_account_obj.browse(cr, uid, account_ids, context=context):
|
||||
partner = account.partner_id
|
||||
if (not partner) or not (account.pricelist_id):
|
||||
|
@ -121,17 +121,17 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
factor_name = ''
|
||||
factor = invoice_factor_obj.browse(cr, uid, factor_id, context2)
|
||||
|
||||
if not data.product:
|
||||
if not data['product']:
|
||||
if factor.customer_name:
|
||||
factor_name = product.name+' - '+factor.customer_name
|
||||
else:
|
||||
factor_name = product.name
|
||||
else:
|
||||
factor_name = product_obj.name_get(cr, uid, [data.product.id], context=context)[0][1]
|
||||
factor_name = product_obj.name_get(cr, uid, [data['product']], context=context)[0][1]
|
||||
|
||||
if account.pricelist_id:
|
||||
pl = account.pricelist_id.id
|
||||
price = pro_price_obj.price_get(cr,uid,[pl], data.product.id or product_id, qty or 1.0, account.partner_id.id)[pl]
|
||||
price = pro_price_obj.price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
|
||||
else:
|
||||
price = 0.0
|
||||
|
||||
|
@ -145,7 +145,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
'invoice_line_tax_id': [(6,0,tax )],
|
||||
'invoice_id': last_invoice,
|
||||
'name': factor_name,
|
||||
'product_id': data.product.id or product_id,
|
||||
'product_id': data['product'] or product_id,
|
||||
'invoice_line_tax_id': [(6,0,tax)],
|
||||
'uos_id': product.uom_id.id,
|
||||
'account_id': account_id,
|
||||
|
@ -162,14 +162,14 @@ class hr_timesheet_invoice_create(osv.osv_memory):
|
|||
for line in line_ids:
|
||||
# set invoice_line_note
|
||||
details = []
|
||||
if data.date:
|
||||
if data['date']:
|
||||
details.append(line['date'])
|
||||
if data.time:
|
||||
if data['time']:
|
||||
if line['product_uom_id']:
|
||||
details.append("%s %s" % (line['unit_amount'], product_uom_obj.browse(cr, uid, [line['product_uom_id']],context2)[0].name))
|
||||
else:
|
||||
details.append("%s" % (line['unit_amount'], ))
|
||||
if data.name:
|
||||
if data['name']:
|
||||
details.append(line['name'])
|
||||
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class lunch_order_confirm(osv.osv_memory):
|
|||
data = context and context.get('active_ids', []) or []
|
||||
order_ref = self.pool.get('lunch.order')
|
||||
|
||||
for confirm_obj in self.browse(cr, uid, ids):
|
||||
order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context)
|
||||
for confirm_obj in self.read(cr, uid, ids):
|
||||
order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
lunch_order_confirm()
|
||||
|
|
|
@ -119,11 +119,12 @@ class mrp_production_workcenter_line(osv.osv):
|
|||
@return: Nothing
|
||||
"""
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
prod_obj_pool = self.pool.get('mrp.production')
|
||||
oper_obj = self.browse(cr, uid, ids)[0]
|
||||
prod_obj = oper_obj.production_id
|
||||
if action == 'start':
|
||||
if prod_obj.state =='confirmed':
|
||||
self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id])
|
||||
prod_obj_pool.force_production(cr, uid, [prod_obj.id])
|
||||
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
|
||||
elif prod_obj.state =='ready':
|
||||
wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr)
|
||||
|
@ -139,6 +140,9 @@ class mrp_production_workcenter_line(osv.osv):
|
|||
if line.state != 'done':
|
||||
flag = False
|
||||
if flag:
|
||||
for production in prod_obj_pool.browse(cr, uid, [prod_obj.id], context= None):
|
||||
if production.move_lines or production.move_created_ids:
|
||||
prod_obj_pool.action_produce(cr,uid, production.id, production.product_qty, 'consume_produce', context = None)
|
||||
wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr)
|
||||
return
|
||||
|
||||
|
@ -244,10 +248,12 @@ class mrp_production(osv.osv):
|
|||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr)
|
||||
return super(mrp_production,self).action_in_production(cr, uid, ids)
|
||||
|
||||
def action_cancel(self, cr, uid, ids):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
""" Cancels work order if production order is canceled.
|
||||
@return: Super method
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
|
|
|
@ -148,9 +148,6 @@ class pos_make_payment(osv.osv_memory):
|
|||
order = order_obj.browse(cr, uid, active_id, context=context)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
for m2o_field in ['product_id','pricelist_id','partner_id']:
|
||||
if data[m2o_field] and isinstance(data[m2o_field], (list,tuple)):
|
||||
data[m2o_field] = data[m2o_field][0]
|
||||
if data['is_acc']:
|
||||
amount = self.pool.get('product.product').browse(cr, uid, data['product_id'], context=context).list_price
|
||||
|
||||
|
|
|
@ -353,8 +353,8 @@ class add_product(osv.osv_memory):
|
|||
data = return_boj.read(cr,uid,return_id,[])[0]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
self_data = self.browse(cr, uid, ids)[0]
|
||||
order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context)
|
||||
self_data = self.read(cr, uid, ids)[0]
|
||||
order_obj.add_product(cr, uid, active_ids[0], self_data['product_id'], self_data['quantity'], context=context)
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
|
||||
prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
|
||||
|
|
|
@ -139,7 +139,7 @@ class product_uom(osv.osv):
|
|||
context = {}
|
||||
if from_unit.category_id.id <> to_unit.category_id.id:
|
||||
if context.get('raise-exception', True):
|
||||
raise osv.except_osv(_('Error !'), _('Conversion from Product UoM m to Default UoM PCE is not possible as they both belong to different Category!.'))
|
||||
raise osv.except_osv(_('Error !'), _('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name,to_unit.name,))
|
||||
else:
|
||||
return qty
|
||||
amount = qty / from_unit.factor
|
||||
|
|
|
@ -53,8 +53,6 @@ class product_price_list(osv.osv_memory):
|
|||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
|
||||
res = res and res[0] or {}
|
||||
if isinstance(res['price_list'], (tuple,list)):
|
||||
res['price_list'] = res['price_list'][0]
|
||||
datas['form'] = res
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
|
|
|
@ -80,6 +80,9 @@
|
|||
<field name="expected_margin"/>
|
||||
<field name="total_margin_rate" widget="progressbar"/>
|
||||
<field name="expected_margin_rate" widget="progressbar"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="uom_id" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -105,8 +105,6 @@ class project_task_delegate(osv.osv_memory):
|
|||
task_id = context.get('active_id', False)
|
||||
task_pool = self.pool.get('project.task')
|
||||
delegate_data = self.read(cr, uid, ids, context=context)[0]
|
||||
if isinstance(delegate_data['user_id'], tuple):
|
||||
delegate_data['user_id'] = delegate_data['user_id'][0]
|
||||
delegate_data['name'] = tools.ustr(delegate_data['name'])
|
||||
task_pool.do_delegate(cr, uid, task_id, delegate_data, context=context)
|
||||
return {}
|
||||
|
|
|
@ -50,10 +50,10 @@ class project_timebox_fill(osv.osv_memory):
|
|||
def process(self, cr, uid, ids, context=None):
|
||||
if not ids:
|
||||
return {}
|
||||
data = self.browse(cr, uid, ids, context=context)
|
||||
if not data[0].task_ids:
|
||||
data = self.read(cr, uid, ids, [], context=context)
|
||||
if not data[0]['task_ids']:
|
||||
return {}
|
||||
self.pool.get('project.task').write(cr, uid, [x.id for x in data[0].task_ids], {'timebox_id':data[0].timebox_to_id.id})
|
||||
self.pool.get('project.task').write(cr, uid, data[0]['task_ids'], {'timebox_id':data[0]['timebox_to_id']})
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
project_timebox_fill()
|
||||
|
|
|
@ -45,12 +45,12 @@ class project_compute_phases(osv.osv_memory):
|
|||
Compute the phases for scheduling.
|
||||
"""
|
||||
project_pool = self.pool.get('project.project')
|
||||
data = self.browse(cr, uid, ids, context=context)[0]
|
||||
if not data.project_id and data.target_project == 'one':
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
if not data['project_id'] and data['target_project'] == 'one':
|
||||
raise osv.except_osv(_('Error!'), _('Please Specify Project to be schedule'))
|
||||
|
||||
if data.project_id: # If project mentioned find its phases
|
||||
project_ids = [data.project_id.id]
|
||||
if data['project_id']: # If project mentioned find its phases
|
||||
project_ids = [data['project_id']]
|
||||
else: # Else take all the draft,open,pending states phases
|
||||
project_ids = project_pool.search(cr, uid, [], context=context)
|
||||
|
||||
|
@ -69,7 +69,7 @@ class project_compute_phases(osv.osv_memory):
|
|||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['target'] = 'current'
|
||||
result['context'] = {"search_default_project_id":data.project_id.id or False, "default_project_id":data.project_id.id or False, "search_default_responsible_id":uid, "search_default_current": 1}
|
||||
result['context'] = {"search_default_project_id":data['project_id'], "default_project_id":data['project_id'], "search_default_responsible_id":uid, "search_default_current": 1}
|
||||
return result
|
||||
|
||||
project_compute_phases()
|
||||
|
|
|
@ -37,8 +37,8 @@ class project_compute_tasks(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
context['compute_by'] = 'project'
|
||||
data = self.browse(cr, uid, ids)[0]
|
||||
project_id = data.project_id.id
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
project_id = data['project_id']
|
||||
project_pool.schedule_tasks(cr, uid, [project_id], context=context)
|
||||
return self._open_task_list(cr, uid, data, context=context)
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class purchase_order(osv.osv):
|
|||
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"),
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
|
||||
'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]",
|
||||
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
|
||||
help="Put an address if you want to deliver directly from the supplier to the customer." \
|
||||
"In this case, it will remove the warehouse link and set the customer location."
|
||||
|
@ -665,7 +665,6 @@ class purchase_order_line(osv.osv):
|
|||
'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
|
||||
res = {}
|
||||
prod= self.pool.get('product.product').browse(cr, uid, product)
|
||||
|
||||
product_uom_pool = self.pool.get('product.uom')
|
||||
lang=False
|
||||
if partner_id:
|
||||
|
@ -681,6 +680,11 @@ class purchase_order_line(osv.osv):
|
|||
date_order = time.strftime('%Y-%m-%d')
|
||||
qty = qty or 1.0
|
||||
seller_delay = 0
|
||||
if uom:
|
||||
uom1_cat = prod.uom_id.category_id.id
|
||||
uom2_cat = product_uom_pool.browse(cr, uid, uom).category_id.id
|
||||
if uom1_cat != uom2_cat:
|
||||
uom = False
|
||||
|
||||
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id], context=context)[0][1]
|
||||
res = {}
|
||||
|
@ -707,14 +711,13 @@ class purchase_order_line(osv.osv):
|
|||
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),
|
||||
'date_planned': date_planned or dt,'notes': notes or prod.description_purchase,
|
||||
'product_qty': qty,
|
||||
'product_uom': uom}})
|
||||
'product_uom': prod.uom_id.id}})
|
||||
domain = {}
|
||||
|
||||
taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id))
|
||||
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
|
||||
res['value']['taxes_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
|
||||
res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id'])
|
||||
res2 = self.pool.get('product.uom').read(cr, uid, [prod.uom_id.id], ['category_id'])
|
||||
res3 = prod.uom_id.category_id.id
|
||||
domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]}
|
||||
if res2[0]['category_id'][0] != res3:
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
groups="group_purchase_manager"
|
||||
parent="base.menu_purchase_root" sequence="100"/>
|
||||
|
||||
<menuitem
|
||||
<menuitem
|
||||
id="menu_purchase_config_pricelist" name="Pricelists"
|
||||
parent="menu_purchase_config_purchase" sequence="50"/>
|
||||
|
||||
|
@ -29,22 +29,22 @@
|
|||
parent="menu_purchase_config_pricelist" sequence="2"
|
||||
groups="base.group_extended"/>
|
||||
|
||||
<menuitem
|
||||
<menuitem
|
||||
id="menu_product_in_config_purchase" name="Product"
|
||||
parent="menu_purchase_config_purchase" sequence="30"/>
|
||||
|
||||
<menuitem
|
||||
action="product.product_category_action_form" id="menu_product_category_config_purchase"
|
||||
parent="purchase.menu_product_in_config_purchase" sequence="10"/>
|
||||
|
||||
<menuitem
|
||||
|
||||
<menuitem
|
||||
id="menu_purchase_unit_measure_purchase" name="Units of Measure"
|
||||
parent="purchase.menu_product_in_config_purchase" sequence="20"/>
|
||||
|
||||
<menuitem
|
||||
action="product.product_uom_categ_form_action" id="menu_purchase_uom_categ_form_action"
|
||||
parent="menu_purchase_unit_measure_purchase" sequence="30"/>
|
||||
|
||||
|
||||
<menuitem
|
||||
action="product.product_uom_form_action" id="menu_purchase_uom_form_action"
|
||||
parent="menu_purchase_unit_measure_purchase" sequence="30"/>
|
||||
|
@ -216,7 +216,7 @@
|
|||
<field name="date_approve"/>
|
||||
<separator string="Invoices" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="invoice_ids" groups="base.group_extended" nolabel="1" colspan="4"/>
|
||||
<field name="invoice_ids" groups="base.group_extended" nolabel="1" colspan="4" context="{'type':'in_invoice'}"/>
|
||||
</page>
|
||||
<page string="Notes">
|
||||
<field colspan="4" name="notes" nolabel="1"/>
|
||||
|
|
|
@ -98,9 +98,9 @@ class stock_move_consume(osv.osv_memory):
|
|||
context = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context['active_ids']
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids):
|
||||
move_obj.action_consume(cr, uid, move_ids,
|
||||
data.product_qty, data.location_id.id,
|
||||
data['product_qty'], data['location_id'],
|
||||
context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
@ -159,9 +159,9 @@ class stock_move_scrap(osv.osv_memory):
|
|||
context = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
move_ids = context['active_ids']
|
||||
for data in self.browse(cr, uid, ids):
|
||||
for data in self.read(cr, uid, ids):
|
||||
move_obj.action_scrap(cr, uid, move_ids,
|
||||
data.product_qty, data.location_id.id,
|
||||
data['product_qty'], data['location_id'],
|
||||
context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
|
Loading…
Reference in New Issue