[Merge] : Merge with lp:~openerp/openobject-addons/trunk-fix-osvmem-read

bzr revid: rha@tinyerp.com-20110207062804-o766jmppnvjwi7hj
This commit is contained in:
rha@tinyerp.com
2011-02-07 11:58:04 +05:30
42 changed files with 325 additions and 282 deletions
+7 -1
View File
@@ -94,7 +94,7 @@ class account_invoice(osv.osv):
if invoice.move_id:
for m in invoice.move_id.line_id:
if m.account_id.type in ('receivable','payable'):
result[invoice.id] = m.amount_residual_currency
result[invoice.id] += m.amount_residual_currency
return result
# Give Journal Items related to the payment reconciled to this invoice
@@ -353,6 +353,8 @@ class account_invoice(osv.osv):
raise orm.except_orm(_('Unknown Error'), str(e))
def confirm_paid(self, cr, uid, ids, context=None):
if context is None:
context = {}
self.write(cr, uid, ids, {'state':'paid'}, context=context)
for inv_id, name in self.name_get(cr, uid, ids, context=context):
message = _("Invoice '%s' is paid.") % name
@@ -360,6 +362,8 @@ class account_invoice(osv.osv):
return True
def unlink(self, cr, uid, ids, context=None):
if context is None:
context = {}
invoices = self.read(cr, uid, ids, ['state'], context=context)
unlink_ids = []
for t in invoices:
@@ -598,6 +602,8 @@ class account_invoice(osv.osv):
return res
def copy(self, cr, uid, id, default={}, context=None):
if context is None:
context = {}
default.update({
'state':'draft',
'number':False,
@@ -144,6 +144,9 @@ 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']
@@ -252,4 +255,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.read(cr, uid, ids)[0]
new_currency = data['currency_id']
data = self.browse(cr, uid, ids)[0]
new_currency = data.currency_id.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:
+7 -7
View File
@@ -79,17 +79,17 @@ class account_chart(osv.osv_memory):
fy_obj = self.pool.get('account.fiscalyear')
if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
data = self.browse(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'], 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']
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']
return result
_defaults = {
@@ -56,7 +56,10 @@ 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)
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]
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.read(cr, uid, ids, context=context):
fy_id = data['fy_id']
for data in self.browse(cr, uid, ids, context=context):
fy_id = data.fy_id.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,6 +95,8 @@ 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))
@@ -102,6 +104,8 @@ 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
@@ -217,4 +221,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.read(cr, uid, ids, context=context)[0]
data = self.browse(cr, uid, ids, context=context)[0]
cr.execute('select default_credit_account_id \
from account_journal where id=%s', (data['journal_id'],))
from account_journal where id=%s', (data.journal_id.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'], account_id),
'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data.journal_id.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.read(cr, uid, ids, context=context)[0]
data = self.browse(cr, uid, ids, context=context)[0]
return {
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'],
'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data.account_id.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.read(cr, uid, ids, context=context)[0]
data = self.browse(cr, uid, ids, context=context)[0]
return {
'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'],
'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data.account_id.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:
+8 -8
View File
@@ -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.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']
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
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:
+9 -9
View File
@@ -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.read(cr, uid, ids, [], context=context)[0]
data = self.browse(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']], context=context)[0]['fiscalyear_id'][0]
result['context'] = str({'period_id': data['period_id'], \
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, \
'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']], context=context)[0]['code']
if data.period_id:
period_code = period_obj.read(cr, uid, [data.period_id.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,6 +45,8 @@ 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
@@ -72,4 +74,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.read(cr, uid, ids)[0]
data = self.browse(cr, uid, ids)[0]
codafile = data['coda']
journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code
codafile = data.coda
journal_code = journal_obj.browse(cr, uid, data.journal_id.id, context=context).code
period = account_period_obj.find(cr, uid, context=context)[0]
def_pay_acc = data['def_payable']
def_rec_acc = data['def_receivable']
def_pay_acc = data.def_payable.id
def_rec_acc = data.def_receivable.id
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']
bank_statement['journal_id']=data.journal_id.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']})
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
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']})
bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id})
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'],
'journal_id': data.journal_id.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.read(cr, uid, ids, [], context=context)[0]
data = self.browse(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'], 'date':data['date']})
context.update({'followup_id': data.followup_id.id, 'date':data.date})
return {
'name': _('Select Partners'),
'view_type': 'form',
@@ -37,7 +37,10 @@ class account_invoice_with_message(report_sxw.rml_parse):
self.context = context
def spcl_msg(self, form):
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message'])
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)
msg = account_msg_data.msg
return msg
+2 -2
View File
@@ -306,7 +306,7 @@ class payment_line(osv.osv):
if id.move_line_id:
res[id.id] = id.move_line_id.date_maturity
else:
res[id.id] = ""
res[id.id] = False
return res
def _get_ml_created_date(self, cr, uid, ids, *a):
@@ -315,7 +315,7 @@ class payment_line(osv.osv):
if id.move_line_id:
res[id.id] = id.move_line_id.date_created
else:
res[id.id] = ""
res[id.id] = False
return res
_columns = {
@@ -108,7 +108,7 @@
<field name="date_scheduled" select="1" attrs="{'readonly':[('date_prefered','!=','fixed')]}" />
<button colspan="2" name="%(action_create_payment_order)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}" icon="gtk-find"/>
</group>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id}" >
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1" default_get="{'order_id': active_id or False}" >
<form string="Payment Line">
<notebook>
<page string="Payment">
@@ -179,6 +179,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
if context is None:
context = {}
def make_call_old(cr, uid, ids, vals, context=context):
if context is None:
context = {}
if isinstance(ids, (str, int, long)):
ids = [ids]
if not context.get('action'):
+4 -2
View File
@@ -124,11 +124,13 @@
<form string="Stage">
<separator string="Stage Definition" colspan="4"/>
<field name="name" select="1"/>
<field name="type" invisible="1" />
<field name="type" groups="base.group_extended" />
<field name="sequence"/>
<field name="probability"/>
<field name="on_change"/>
<group colspan="4" col="2" >
<field name="on_change"/>
</group>
<separator string="Requirements" colspan="4"/>
<field name="requirements" nolabel="1" colspan="4"/>
<field name="section_ids" invisible="1" />
+4 -2
View File
@@ -70,8 +70,10 @@ class crm_lead2opportunity(osv.osv_memory):
cr, uid, opportunity_view_tree, context=context).res_id
lead = leads.browse(cr, uid, record_id, context=context)
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
if(lead.section_id):
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1), ('section_ids','=', lead.section_id.id)])
else:
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
for this in self.browse(cr, uid, ids, context=context):
vals ={
'planned_revenue': this.planned_revenue,
+1 -1
View File
@@ -75,7 +75,7 @@ class hr_attendance(osv.osv):
LIMIT 2 '''
cr.execute(sql,(id,id))
atts = cr.fetchall()
if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])):
if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (len(atts)==2 and atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])):
return False
return True
@@ -69,7 +69,7 @@ class job2phonecall(osv.osv_memory):
phonecall_case_obj = self.pool.get('crm.phonecall')
if context is None:
context = {}
form = self.read(cr, uid, ids, [], context=context)[0]
form = self.browse(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'],
'categ_id': form['category_id'],
'description': form['note'],
'date': form['deadline'],
'user_id': form.user_id.id,
'categ_id': form.category_id.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.read(cr, uid, ids, [], context=context)[0]
data = self.browse(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']], context=context)[0][1]
factor_name = product_obj.name_get(cr, uid, [data.product.id], context=context)[0][1]
if account.pricelist_id:
pl = account.pricelist_id.id
price = pro_price_obj.price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
price = pro_price_obj.price_get(cr,uid,[pl], data.product.id 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'] or product_id,
'product_id': data.product.id 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)))
+2 -2
View File
@@ -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.read(cr, uid, ids):
order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context)
for confirm_obj in self.browse(cr, uid, ids):
order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context)
return {'type': 'ir.actions.act_window_close'}
lunch_order_confirm()
@@ -148,6 +148,9 @@ 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
+2 -2
View File
@@ -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.read(cr, uid, ids)[0]
order_obj.add_product(cr, uid, active_ids[0], self_data['product_id'], self_data['quantity'], context=context)
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)
for order_id in order_obj.browse(cr, uid, active_ids, context=context):
prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')])
+1 -1
View File
@@ -567,7 +567,7 @@ class product_product(osv.osv):
ptrn=re.compile('(\[(.*?)\])')
res = ptrn.search(name)
if res:
ids = self.search(cr, user, [('default_code','ilike',res.group(2))]+ args, limit=limit, context=context)
ids = self.search(cr, user, [('default_code','=', res.group(2))] + args, limit=limit, context=context)
else:
ids = self.search(cr, user, args, limit=limit, context=context)
result = self.name_get(cr, user, ids, context=context)
+2
View File
@@ -53,6 +53,8 @@ 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',
@@ -105,6 +105,8 @@ 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.read(cr, uid, ids, [], context=context)
if not data[0]['task_ids']:
data = self.browse(cr, uid, ids, context=context)
if not data[0].task_ids:
return {}
self.pool.get('project.task').write(cr, uid, data[0]['task_ids'], {'timebox_id':data[0]['timebox_to_id']})
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})
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.read(cr, uid, ids, [], context=context)[0]
if not data['project_id'] and data['target_project'] == 'one':
data = self.browse(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']]
if data.project_id: # If project mentioned find its phases
project_ids = [data.project_id.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'], "default_project_id":data['project_id'], "search_default_responsible_id":uid, "search_default_current": 1}
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}
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.read(cr, uid, ids, [])[0]
project_id = data['project_id']
data = self.browse(cr, uid, ids)[0]
project_id = data.project_id.id
project_pool.schedule_tasks(cr, uid, [project_id], context=context)
return self._open_task_list(cr, uid, data, context=context)
@@ -8,7 +8,7 @@
<field name="name">Project_Planning</field>
<field name="business_days">20</field>
<field name="date_from" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="date_to" eval="time.strftime('%Y-%m-30 15:23:00')"/>
<field name="date_to" eval="time.strftime('%Y-%m-28 15:00:00')"/>
<field name="state">open</field>
<field name="user_id" ref="project.res_users_project_manager"/>
</record>
@@ -92,7 +92,7 @@
-
!record {model: project.task, id: project_task_getalltimesheetrecords0}:
work_ids:
- date: !eval time.strftime('%Y-06-%d %H:%M:%S')
- date: !eval time.strftime('%Y-07-%d %H:%M:%S')
hours: 10.0
name: Get work calendar of all employees
user_id: res_users_hrmanager0
+4 -4
View File
@@ -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.read(cr, uid, ids):
for data in self.browse(cr, uid, ids):
move_obj.action_consume(cr, uid, move_ids,
data['product_qty'], data['location_id'],
data.product_qty, data.location_id.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.read(cr, uid, ids):
for data in self.browse(cr, uid, ids):
move_obj.action_scrap(cr, uid, move_ids,
data['product_qty'], data['location_id'],
data.product_qty, data.location_id.id,
context=context)
return {'type': 'ir.actions.act_window_close'}
Binary file not shown.
@@ -2,126 +2,134 @@
function config_close()
{
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
//set the value of the configuration fields
function config_change_load()
{
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
}
}
}
function config_change_load_web()
{
//var s = getServer();
//var s = getServer();
weburl = getWebServerURL();
webport = getwebPort();
var urlport = weburl+':'+webport;
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
}
}
}
function config_ok()
{
if (document.getElementById('txtcurl').value == '')
{
if (document.getElementById('txtcurl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
function config_ok_web()
{
if (document.getElementById('txtcweburl').value == '')
{
if (document.getElementById('txtcweburl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcwebport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setWebServerURL("http://"+document.getElementById('txtcweburl').value +":" + document.getElementById('txtcwebport').value);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
}
if (document.getElementById('txtcwebport').value == '' && !document.getElementById('lblssl').checked)
{
alert("You Must Enter Port!")
return false;
}
var protocol = "http://";
var port = document.getElementById('txtcwebport').value
if(document.getElementById('lblssl').checked) {
protocol = "https://";
if(port == '') {
port = 443
}
}
setWebServerURL(protocol + document.getElementById('txtcweburl').value +":" + port);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
@@ -139,89 +147,89 @@ function openConfigChangeweb()
function appendDbList()
{
setServerService('xmlrpc/db');
getDbList('DBlist');
setServerService('xmlrpc/db');
getDbList('DBlist');
}
//set the database list in the listbox in configuration window
function setDb()
{
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
}
//stores the value of configuration fields in preferences
function okClick()
{
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
}
//deletes the value of the selected value in the listbox in configuraton menu
function deleteDocument(){
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
}
//function to add the image file for the checkbox
function addFile(){
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
}
@@ -2,25 +2,29 @@
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/config_change.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/loaddata.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/static.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/overlay.js"></script>
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
</hbox>
<groupbox id="gpData" width="200">
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox>
<checkbox id="lblssl" label="SSL (https)" checked="false"/>
</hbox>
</groupbox>
<hbox align="right">
@@ -612,7 +612,6 @@ function createMenuItem_db(aLabel) {
//xmlrpc request handler for getting the list of database
var listDbHandler = {
onResult: function(client, context, result) {
setconnect_server("true")
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var arrMethodList = result.QueryInterface(Components.interfaces.nsISupportsArray);
// Set the number of results
@@ -625,7 +624,7 @@ var listDbHandler = {
var database = ""
if (count > 0)
{
setDBList("true")
setDBList("true");
var label = document.getElementById("database_option");
var vbox = document.createElement("vbox");
var hbox = document.createElement("hbox");
@@ -658,7 +657,7 @@ var listDbHandler = {
}
else
{
setDBList("false")
setDBList("false");
}
// Loop through the results, adding items to the list
if (count)
@@ -682,22 +681,18 @@ var listDbHandler = {
onFault: function (client, ctxt, fault) {
setDBList("false");
},
onError: function (client, ctxt, status, errorMsg) {
if(status == 0) {
setconnect_server("true");
setDBList("false");
}
setDBList("false");
}
};
//function to get the database list
function getDbList(argControl)
{
setDBList("false")
setconnect_server("false")
setDBList("false");
setconnect_server("true");
// Enable correct security
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
// Get the instance of the XML-RPC client
@@ -1844,7 +1839,6 @@ function testConnection(){
function testConnection_web(){
var branchobj = getPref();
weburl = getWebServerURL();
// window.open(weburl, "", "chrome","resizable=yes,scrollbars=yes,status=yes");
var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(weburl);
@@ -1876,6 +1870,7 @@ var listcreateLoginHandler = {
//function to check the login information
function createConnection(){
setconnect_server("true");
var branchobj = getPref();
setServerService('xmlrpc/common');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
@@ -1,5 +1,7 @@
<!ENTITY lblurl.label "Server: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblssl.label "Use SLL ? ">
<!ENTITY lblheading.label "Openerp Connection">
<!ENTITY imagecancel.value "chrome://openerp_plugin/skin/Error.gif">
<!ENTITY imageok.value "chrome://openerp_plugin/skin/Success.gif">