[IMP][REF] Sql-injection changes, remove print statement, some space improvement.
bzr revid: vra@tinyerp.com-20100616115139-cql5oiqf622spa6p
This commit is contained in:
parent
3fcdccbeca
commit
bf8d2a73c0
|
@ -1332,7 +1332,7 @@ class account_tax_code(osv.osv):
|
|||
account_move AS move \
|
||||
LEFT JOIN account_invoice invoice ON \
|
||||
(invoice.move_id = move.id) \
|
||||
WHERE line.tax_code_id in %s '+where+' \
|
||||
WHERE line.tax_code_id IN %s '+where+' \
|
||||
AND move.id = line.move_id \
|
||||
AND ((invoice.state = \'paid\') \
|
||||
OR (invoice.id IS NULL)) \
|
||||
|
@ -1341,7 +1341,7 @@ class account_tax_code(osv.osv):
|
|||
else:
|
||||
cr.execute('SELECT line.tax_code_id, sum(line.tax_amount) \
|
||||
FROM account_move_line AS line \
|
||||
WHERE line.tax_code_id in %s '+where+' \
|
||||
WHERE line.tax_code_id IN %s '+where+' \
|
||||
GROUP BY line.tax_code_id',
|
||||
(parent_ids,)+where_params)
|
||||
res=dict(cr.fetchall())
|
||||
|
@ -1364,7 +1364,7 @@ class account_tax_code(osv.osv):
|
|||
if fiscalyear_id:
|
||||
pids = map(lambda x: str(x.id), self.pool.get('account.fiscalyear').browse(cr, uid, fiscalyear_id).period_ids)
|
||||
if pids:
|
||||
where = ' and period_id in %s'
|
||||
where = ' and period_id IN %s'
|
||||
where_params = (tuple(pids),)
|
||||
return self._sum(cr, uid, ids, name, args, context,
|
||||
where=where, where_params=where_params)
|
||||
|
@ -1782,7 +1782,7 @@ class account_model(osv.osv):
|
|||
'ref': fields.char('Reference', size=64),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
|
||||
'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'),
|
||||
'legend' :fields.text('Legend',readonly=True,size=100),
|
||||
'legend' :fields.text('Legend', readonly=True, size=100),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -1792,7 +1792,7 @@ class account_model(osv.osv):
|
|||
move_ids = []
|
||||
for model in self.browse(cr, uid, ids, context):
|
||||
context.update({'date':datas['date']})
|
||||
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date',False))
|
||||
period_id = self.pool.get('account.period').find(cr, uid, dt=context.get('date', False))
|
||||
if not period_id:
|
||||
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
|
@ -1994,9 +1994,9 @@ class account_account_template(osv.osv):
|
|||
'reconcile': fields.boolean('Allow Reconciliation', help="Check this option if you want the user to reconcile entries in this account."),
|
||||
'shortcut': fields.char('Shortcut', size=12),
|
||||
'note': fields.text('Note'),
|
||||
'parent_id': fields.many2one('account.account.template','Parent Account Template', ondelete='cascade'),
|
||||
'child_parent_ids':fields.one2many('account.account.template','parent_id','Children'),
|
||||
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel','account_id','tax_id', 'Default Taxes'),
|
||||
'parent_id': fields.many2one('account.account.template', 'Parent Account Template', ondelete='cascade'),
|
||||
'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
|
||||
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
|
||||
'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
|
||||
}
|
||||
|
||||
|
@ -2036,14 +2036,14 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
|||
acc_obj=self.pool.get('account.account')
|
||||
tmpl_obj=self.pool.get('account.account.template')
|
||||
#print "Searching for ",context
|
||||
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']],['parent_id'])
|
||||
tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id'])
|
||||
if not tids or not tids[0]['parent_id']:
|
||||
return False
|
||||
ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]],['code'])
|
||||
ptids = tmpl_obj.read(cr, uid, [tids[0]['parent_id'][0]], ['code'])
|
||||
res = None
|
||||
if not ptids or not ptids[0]['code']:
|
||||
raise osv.except_osv(_('Error !'), _('Cannot locate parent code for template account!'))
|
||||
res = acc_obj.search(cr,uid,[('code','=',ptids[0]['code'])])
|
||||
res = acc_obj.search(cr, uid, [('code','=',ptids[0]['code'])])
|
||||
|
||||
return res and res[0] or False
|
||||
|
||||
|
@ -2057,9 +2057,9 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
|||
def action_create(self,cr,uid,ids,context=None):
|
||||
acc_obj=self.pool.get('account.account')
|
||||
tmpl_obj=self.pool.get('account.account.template')
|
||||
data= self.read(cr,uid,ids)
|
||||
company_id = acc_obj.read(cr,uid,[data[0]['cparent_id']],['company_id'])[0]['company_id'][0]
|
||||
account_template = tmpl_obj.browse(cr,uid,context['tmpl_ids'])
|
||||
data= self.read(cr, uid, ids)
|
||||
company_id = acc_obj.read(cr, uid, [data[0]['cparent_id']], ['company_id'])[0]['company_id'][0]
|
||||
account_template = tmpl_obj.browse(cr, uid, context['tmpl_ids'])
|
||||
#tax_ids = []
|
||||
#for tax in account_template.tax_ids:
|
||||
# tax_ids.append(tax_template_ref[tax.id])
|
||||
|
@ -2078,10 +2078,10 @@ class account_add_tmpl_wizard(osv.osv_memory):
|
|||
'company_id': company_id,
|
||||
}
|
||||
# print "Creating:", vals
|
||||
new_account = acc_obj.create(cr,uid,vals)
|
||||
new_account = acc_obj.create(cr, uid, vals)
|
||||
return {'type':'state', 'state': 'end' }
|
||||
|
||||
def action_cancel(self,cr,uid,ids,context=None):
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return { 'type': 'state', 'state': 'end' }
|
||||
|
||||
account_add_tmpl_wizard()
|
||||
|
@ -2279,11 +2279,11 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
_inherit = 'res.config'
|
||||
|
||||
_columns = {
|
||||
'company_id':fields.many2one('res.company','Company',required=True),
|
||||
'chart_template_id': fields.many2one('account.chart.template','Chart Template',required=True),
|
||||
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts',required=True),
|
||||
'code_digits':fields.integer('# of Digits',required=True,help="No. of Digits to use for account code"),
|
||||
'seq_journal':fields.boolean('Separated Journal Sequences',help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True),
|
||||
'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts', required=True),
|
||||
'code_digits':fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
|
||||
'seq_journal':fields.boolean('Separated Journal Sequences', help="Check this box if you want to use a different sequence for each created journal. Otherwise, all will use the same sequence."),
|
||||
}
|
||||
|
||||
def _get_chart(self, cr, uid, context={}):
|
||||
|
@ -2292,14 +2292,14 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
return ids[0]
|
||||
return False
|
||||
_defaults = {
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr,uid,[uid],c)[0].company_id.id,
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id,
|
||||
'chart_template_id': _get_chart,
|
||||
'code_digits': lambda *a:6,
|
||||
'seq_journal': True
|
||||
}
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
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_tax = self.pool.get('account.tax')
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
|
@ -2331,7 +2331,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'company_id': company_id,
|
||||
'sign': tax_code_template.sign,
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals)
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals)
|
||||
#recording the new tax code to do the mapping
|
||||
tax_code_template_ref[tax_code_template.id] = new_tax_code
|
||||
|
||||
|
@ -2364,7 +2364,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'company_id': company_id,
|
||||
'type_tax_use': tax.type_tax_use
|
||||
}
|
||||
new_tax = obj_acc_tax.create(cr,uid,vals_tax)
|
||||
new_tax = obj_acc_tax.create(cr, uid, vals_tax)
|
||||
#as the accounts have not been created yet, we have to wait before filling these fields
|
||||
todo_dict[new_tax] = {
|
||||
'account_collected_id': tax.account_collected_id and tax.account_collected_id.id or False,
|
||||
|
@ -2402,7 +2402,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
'tax_ids': [(6,0,tax_ids)],
|
||||
'company_id': company_id,
|
||||
}
|
||||
new_account = obj_acc.create(cr,uid,vals)
|
||||
new_account = obj_acc.create(cr, uid, vals)
|
||||
acc_template_ref[account_template.id] = new_account
|
||||
#reactivate the parent_store functionnality on account_account
|
||||
self.pool._init = False
|
||||
|
@ -2418,11 +2418,11 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
# Creating Journals
|
||||
vals_journal={}
|
||||
view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0]
|
||||
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
|
||||
seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0]
|
||||
|
||||
if obj_multi.seq_journal:
|
||||
seq_id_sale = obj_sequence.search(cr,uid,[('name','=','Sale Journal')])[0]
|
||||
seq_id_purchase = obj_sequence.search(cr,uid,[('name','=','Purchase Journal')])[0]
|
||||
seq_id_sale = obj_sequence.search(cr, uid, [('name','=','Sale Journal')])[0]
|
||||
seq_id_purchase = obj_sequence.search(cr, uid, [('name','=','Purchase Journal')])[0]
|
||||
else:
|
||||
seq_id_sale = seq_id
|
||||
seq_id_purchase = seq_id
|
||||
|
@ -2454,8 +2454,8 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
obj_journal.create(cr,uid,vals_journal)
|
||||
|
||||
# Bank Journals
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Cash Journal View')])[0]
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Multi-Currency Cash Journal View')])[0]
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Cash Journal View')])[0]
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Multi-Currency Cash Journal View')])[0]
|
||||
ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id
|
||||
|
||||
current_num = 1
|
||||
|
@ -2533,7 +2533,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
|
|||
#create the property
|
||||
property_obj.create(cr, uid, vals)
|
||||
|
||||
fp_ids = obj_fiscal_position_template.search(cr, uid,[('chart_template_id', '=', obj_multi.chart_template_id.id)])
|
||||
fp_ids = obj_fiscal_position_template.search(cr, uid, [('chart_template_id', '=', obj_multi.chart_template_id.id)])
|
||||
|
||||
if fp_ids:
|
||||
for position in obj_fiscal_position_template.browse(cr, uid, fp_ids):
|
||||
|
|
|
@ -92,9 +92,9 @@ class account_analytic_line(osv.osv):
|
|||
company_id=company_obj._company_default_get(cr, uid, 'account.analytic.line', context)
|
||||
|
||||
# Compute based on pricetype
|
||||
pricetype=self.pool.get('product.price.type').browse(cr,uid,company_obj.browse(cr,uid,company_id).property_valuation_price_type.id)
|
||||
pricetype=self.pool.get('product.price.type').browse(cr, uid, company_obj.browse(cr,uid,company_id).property_valuation_price_type.id)
|
||||
# Take the company currency as the reference one
|
||||
context['currency_id']=company_obj.browse(cr,uid,company_id).currency_id.id
|
||||
context['currency_id']=company_obj.browse(cr, uid, company_id).currency_id.id
|
||||
amount_unit=prod.price_get(pricetype.field, context)[prod.id]
|
||||
amount=amount_unit*unit_amount or 1.0
|
||||
return {'value': {
|
||||
|
|
|
@ -32,7 +32,7 @@ class account_bank_statement(osv.osv):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
model_data_ids = mod_obj.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice')], context=context)
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_statement_from_invoice')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
context.update({'statement_id': ids[0]})
|
||||
return {
|
||||
|
|
|
@ -66,9 +66,9 @@ class account_move_line(osv.osv):
|
|||
#the query have to be build with no reference to periods but thanks to the creation date
|
||||
if context.get('periods',False):
|
||||
#if one or more period are given, use them
|
||||
fiscalperiod_ids = fiscalperiod_obj.search(cr,uid,[('id','in',context['periods'])])
|
||||
fiscalperiod_ids = fiscalperiod_obj.search(cr, uid, [('id','in',context['periods'])])
|
||||
else:
|
||||
fiscalperiod_ids = self.pool.get('account.period').search(cr,uid,[('fiscalyear_id','in',fiscalyear_ids)])
|
||||
fiscalperiod_ids = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id','in',fiscalyear_ids)])
|
||||
|
||||
|
||||
|
||||
|
@ -87,7 +87,7 @@ class account_move_line(osv.osv):
|
|||
#add to 'res' a new clause containing the creation date criterion
|
||||
count = 1
|
||||
res += " AND ("
|
||||
periods = self.pool.get('account.period').read(cr,uid,p_ids,['date_start','date_stop'])
|
||||
periods = self.pool.get('account.period').read(cr, uid, p_ids, ['date_start','date_stop'])
|
||||
for period in periods:
|
||||
if count != 1:
|
||||
res += " OR "
|
||||
|
@ -150,7 +150,7 @@ class account_move_line(osv.osv):
|
|||
for item in i[2]:
|
||||
data[item]=i[2][item]
|
||||
if context['journal']:
|
||||
journal_obj=self.pool.get('account.journal').browse(cr,uid,context['journal'])
|
||||
journal_obj=self.pool.get('account.journal').browse(cr, uid, context['journal'])
|
||||
if journal_obj.type == 'purchase':
|
||||
if total_new>0:
|
||||
account = journal_obj.default_credit_account_id
|
||||
|
@ -300,7 +300,7 @@ class account_move_line(osv.osv):
|
|||
cursor.execute('SELECT l.id, i.id ' \
|
||||
'FROM account_move_line l, account_invoice i ' \
|
||||
'WHERE l.move_id = i.move_id ' \
|
||||
'AND l.id in %s',
|
||||
'AND l.id IN %s',
|
||||
(tuple(ids),))
|
||||
invoice_ids = []
|
||||
for line_id, invoice_id in cursor.fetchall():
|
||||
|
@ -334,7 +334,7 @@ class account_move_line(osv.osv):
|
|||
return []
|
||||
where = ' and '.join(map(lambda x: '(abs(sum(debit-credit))'+x[1]+str(x[2])+')',args))
|
||||
cursor.execute('select id, sum(debit-credit) from account_move_line \
|
||||
group by id,debit,credit having '+where)
|
||||
group by id, debit, credit having '+where)
|
||||
res = cursor.fetchall()
|
||||
if not len(res):
|
||||
return [('id', '=', '0')]
|
||||
|
@ -368,7 +368,7 @@ class account_move_line(osv.osv):
|
|||
else:
|
||||
qu1.append('(i.id %s %s)' % (x[1], '%s'))
|
||||
qu2.append(x[2])
|
||||
elif x[1] == 'in':
|
||||
elif x[1] == 'IN':
|
||||
if len(x[2]) > 0:
|
||||
qu1.append('(i.id in (%s))' % (','.join(['%s'] * len(x[2]))))
|
||||
qu2 += x[2]
|
||||
|
@ -434,8 +434,8 @@ class account_move_line(osv.osv):
|
|||
'account_tax_id':fields.many2one('account.tax', 'Tax'),
|
||||
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
#TODO: remove this
|
||||
'amount_taxed':fields.float("Taxed Amount",digits_compute=dp.get_precision('Account')),
|
||||
'company_id': fields.related('account_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
|
||||
'amount_taxed':fields.float("Taxed Amount", digits_compute=dp.get_precision('Account')),
|
||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True)
|
||||
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,7 @@ class account_move_line(osv.osv):
|
|||
'currency_id': _get_currency,
|
||||
'journal_id': lambda self, cr, uid, c: c.get('journal_id', False),
|
||||
'period_id': lambda self, cr, uid, c: c.get('period_id', False),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
|
||||
'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.move.line', context=c)
|
||||
}
|
||||
_order = "date desc,id desc"
|
||||
_sql_constraints = [
|
||||
|
@ -813,9 +813,9 @@ class account_move_line(osv.osv):
|
|||
else:
|
||||
journal_id = context['journal_id']
|
||||
period_id = context['period_id']
|
||||
journal = self.pool.get('account.journal').browse(cr,uid,[journal_id])[0]
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])[0]
|
||||
if journal.allow_date:
|
||||
period = self.pool.get('account.period').browse(cr,uid,[period_id])[0]
|
||||
period = self.pool.get('account.period').browse(cr, uid, [period_id])[0]
|
||||
if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') or not time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
|
||||
raise osv.except_osv(_('Error'),_('The date of your Ledger Posting is not in the defined period !'))
|
||||
else:
|
||||
|
|
|
@ -99,7 +99,7 @@ class account_installer(osv.osv_memory):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
obj_multi = self.pool.get('account.chart.template').browse(cr,uid, id)
|
||||
obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id)
|
||||
|
||||
obj_acc = self.pool.get('account.account')
|
||||
obj_acc_tax = self.pool.get('account.tax')
|
||||
|
@ -108,7 +108,7 @@ class account_installer(osv.osv_memory):
|
|||
obj_acc_template = self.pool.get('account.account.template')
|
||||
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
|
||||
obj_fiscal_position = self.pool.get('account.fiscal.position')
|
||||
company_id = self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id
|
||||
seq_journal = True
|
||||
|
||||
# Creating Account
|
||||
|
@ -133,7 +133,7 @@ class account_installer(osv.osv_memory):
|
|||
'company_id': company_id.id,
|
||||
'sign': tax_code_template.sign,
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals)
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals)
|
||||
#recording the new tax code to do the mapping
|
||||
tax_code_template_ref[tax_code_template.id] = new_tax_code
|
||||
|
||||
|
@ -166,7 +166,7 @@ class account_installer(osv.osv_memory):
|
|||
'company_id': company_id.id,
|
||||
'type_tax_use': tax.type_tax_use
|
||||
}
|
||||
new_tax = obj_acc_tax.create(cr,uid,vals_tax)
|
||||
new_tax = obj_acc_tax.create(cr, uid, vals_tax)
|
||||
#as the accounts have not been created yet, we have to wait before filling these fields
|
||||
todo_dict[new_tax] = {
|
||||
'account_collected_id': tax.account_collected_id and tax.account_collected_id.id or False,
|
||||
|
@ -204,7 +204,7 @@ class account_installer(osv.osv_memory):
|
|||
'tax_ids': [(6,0,tax_ids)],
|
||||
'company_id': company_id.id,
|
||||
}
|
||||
new_account = obj_acc.create(cr,uid,vals)
|
||||
new_account = obj_acc.create(cr, uid, vals)
|
||||
acc_template_ref[account_template.id] = new_account
|
||||
if account_template.name == 'Bank Current Account':
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Cash Journal View')])[0]
|
||||
|
@ -328,8 +328,8 @@ class account_installer(osv.osv_memory):
|
|||
obj_journal.create(cr,uid,vals_journal)
|
||||
|
||||
# Bank Journals
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Cash Journal View')])[0]
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Multi-Currency Cash Journal View')])[0]
|
||||
view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Cash Journal View')])[0]
|
||||
view_id_cur = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Multi-Currency Cash Journal View')])[0]
|
||||
ref_acc_bank = obj_multi.bank_account_view_id
|
||||
|
||||
|
||||
|
@ -426,7 +426,7 @@ class account_installer(osv.osv_memory):
|
|||
'sign': 1,
|
||||
'parent_id':sal_tax_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code)
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
sales_tax = obj_tax.create(cr, uid,
|
||||
{'name':'VAT%s%%'%(s_tax*100),
|
||||
'description':'VAT%s%%'%(s_tax*100),
|
||||
|
@ -445,7 +445,7 @@ class account_installer(osv.osv_memory):
|
|||
'sign': 1,
|
||||
'parent_id':pur_tax_parent_id
|
||||
}
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr,uid,vals_tax_code)
|
||||
new_tax_code = self.pool.get('account.tax.code').create(cr, uid, vals_tax_code)
|
||||
purchase_tax = obj_tax.create(cr, uid,
|
||||
{'name':'VAT%s%%'%(p_tax*100),
|
||||
'description':'VAT%s%%'%(p_tax*100),
|
||||
|
@ -457,7 +457,7 @@ class account_installer(osv.osv_memory):
|
|||
tax_val.update({'supplier_taxes_id':[(6,0,[purchase_tax])]})
|
||||
default_tax.append(('supplier_taxes_id',purchase_tax))
|
||||
if len(tax_val):
|
||||
product_ids = obj_product.search(cr,uid, [])
|
||||
product_ids = obj_product.search(cr, uid, [])
|
||||
for product in obj_product.browse(cr, uid, product_ids):
|
||||
obj_product.write(cr, uid, product.id, tax_val)
|
||||
for name, value in default_tax:
|
||||
|
|
|
@ -32,7 +32,7 @@ from tools.translate import _
|
|||
class account_invoice(osv.osv):
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for invoice in self.browse(cr,uid,ids, context=context):
|
||||
for invoice in self.browse(cr, uid, ids, context=context):
|
||||
res[invoice.id] = {
|
||||
'amount_untaxed': 0.0,
|
||||
'amount_tax': 0.0,
|
||||
|
@ -112,12 +112,12 @@ class account_invoice(osv.osv):
|
|||
context_unreconciled.update({'date':lines.date})
|
||||
# If amount currency setted, compute for debit and credit in company currency
|
||||
if lines.amount_currency < 0:
|
||||
credit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False,context=context_unreconciled))
|
||||
credit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False, context=context_unreconciled))
|
||||
elif lines.amount_currency > 0:
|
||||
debit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False,context=context_unreconciled))
|
||||
debit_tmp=abs(cur_obj.compute(cr, uid, lines.currency_id.id, inv.company_id.currency_id.id, lines.amount_currency, round=False, context=context_unreconciled))
|
||||
# Then, recomput into invoice currency to avoid rounding trouble !
|
||||
debit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, debit_tmp, round=False,context=context)
|
||||
credit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, credit_tmp, round=False,context=context)
|
||||
debit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, debit_tmp, round=False, context=context)
|
||||
credit += cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id, credit_tmp, round=False, context=context)
|
||||
else:
|
||||
debit+=debit_tmp
|
||||
credit+=credit_tmp
|
||||
|
@ -131,19 +131,19 @@ class account_invoice(osv.osv):
|
|||
amount = debit-credit
|
||||
result = inv.amount_total - amount
|
||||
# Use is_zero function to avoid rounding trouble => should be fixed into ORM
|
||||
res[inv.id] = not self.pool.get('res.currency').is_zero(cr, uid, inv.company_id.currency_id,result) and result or 0.0
|
||||
res[inv.id] = not self.pool.get('res.currency').is_zero(cr, uid, inv.company_id.currency_id, result) and result or 0.0
|
||||
|
||||
return res
|
||||
|
||||
def _get_lines(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for id in ids:
|
||||
move_lines = self.move_line_id_payment_get(cr,uid,[id])
|
||||
move_lines = self.move_line_id_payment_get(cr, uid, [id])
|
||||
if not move_lines:
|
||||
res[id] = []
|
||||
continue
|
||||
res[id] = []
|
||||
data_lines = self.pool.get('account.move.line').browse(cr,uid,move_lines)
|
||||
data_lines = self.pool.get('account.move.line').browse(cr, uid, move_lines)
|
||||
partial_ids = []# Keeps the track of ids where partial payments are done with payment terms
|
||||
for line in data_lines:
|
||||
ids_line = []
|
||||
|
@ -219,7 +219,7 @@ class account_invoice(osv.osv):
|
|||
_order = "number"
|
||||
_log_create = True
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64, select=True,readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice."),
|
||||
'type': fields.selection([
|
||||
('out_invoice','Customer Invoice'),
|
||||
|
@ -247,8 +247,8 @@ class account_invoice(osv.osv):
|
|||
\n* The \'Open\' state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
|
||||
\n* The \'Done\' state is set automatically when invoice is paid.\
|
||||
\n* The \'Cancelled\' state is used when user cancel invoice.'),
|
||||
'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}, help="Keep empty to use the current date"),
|
||||
'date_due': fields.date('Due Date', states={'open':[('readonly',True)],'close':[('readonly',True)]},
|
||||
'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)], 'close':[('readonly',True)]}, help="Keep empty to use the current date"),
|
||||
'date_due': fields.date('Due Date', states={'open':[('readonly',True)], 'close':[('readonly',True)]},
|
||||
help="If you use payment terms, the due date will be computed automatically at the generation "\
|
||||
"of accounting entries. If you keep the payment term and the due date empty, it means direct payment. The payment term may compute several due dates, for example 50% now, 50% in one month."),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, readonly=True, required=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -265,7 +265,7 @@ class account_invoice(osv.osv):
|
|||
'tax_line': fields.one2many('account.invoice.tax', 'invoice_id', 'Tax Lines', readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
||||
'move_id': fields.many2one('account.move', 'Invoice Movement', readonly=True, help="Links to the automatically generated Ledger Postings."),
|
||||
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'),string='Untaxed',
|
||||
'amount_untaxed': fields.function(_amount_all, method=True, digits_compute=dp.get_precision('Account'), string='Untaxed',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
|
@ -287,7 +287,7 @@ class account_invoice(osv.osv):
|
|||
},
|
||||
multi='all'),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True,readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True),
|
||||
'check_total': fields.float('Total', digits_compute=dp.get_precision('Account'), states={'open':[('readonly',True)],'close':[('readonly',True)]}),
|
||||
'reconciled': fields.function(_reconciled, method=True, string='Paid/Reconciled', type='boolean',
|
||||
|
@ -298,8 +298,8 @@ class account_invoice(osv.osv):
|
|||
}, help="The Ledger Postings of the invoice have been reconciled with Ledger Postings of the payment(s)."),
|
||||
'partner_bank': fields.many2one('res.partner.bank', 'Bank Account',
|
||||
help='The bank account to pay to or to be paid from'),
|
||||
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Entry Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'),string='Residual',
|
||||
'move_lines':fields.function(_get_lines , method=True, type='many2many', relation='account.move.line', string='Entry Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, ['invoice_line'], 50),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 50),
|
||||
|
@ -322,7 +322,7 @@ class account_invoice(osv.osv):
|
|||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c),
|
||||
'reference_type': lambda *a: 'none',
|
||||
'check_total': lambda *a: 0.0,
|
||||
'user_id': lambda s,cr,u,c: u,
|
||||
'user_id': lambda s, cr, u, c: u,
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
|
@ -339,7 +339,7 @@ class account_invoice(osv.osv):
|
|||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'paid'}, context=context)
|
||||
for (id,name) in self.name_get(cr, uid, ids):
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
message = _('Document ') + " '" + name + "' "+ _("has been paid.")
|
||||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
@ -390,8 +390,8 @@ class account_invoice(osv.osv):
|
|||
if not rec_res_id and not pay_res_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
_('Can not find account chart for this company, Please Create account.'))
|
||||
rec_obj_acc=self.pool.get('account.account').browse(cr,uid,[rec_res_id])
|
||||
pay_obj_acc=self.pool.get('account.account').browse(cr,uid,[pay_res_id])
|
||||
rec_obj_acc=self.pool.get('account.account').browse(cr, uid, [rec_res_id])
|
||||
pay_obj_acc=self.pool.get('account.account').browse(cr, uid, [pay_res_id])
|
||||
p.property_account_receivable = rec_obj_acc[0]
|
||||
p.property_account_payable = pay_obj_acc[0]
|
||||
|
||||
|
@ -419,7 +419,7 @@ class account_invoice(osv.osv):
|
|||
if payment_term != partner_payment_term:
|
||||
if partner_payment_term:
|
||||
to_update = self.onchange_payment_term_date_invoice(
|
||||
cr,uid,ids,partner_payment_term,date_invoice)
|
||||
cr, uid, ids, partner_payment_term, date_invoice)
|
||||
result['value'].update(to_update['value'])
|
||||
else:
|
||||
result['value']['date_due'] = False
|
||||
|
@ -471,14 +471,14 @@ class account_invoice(osv.osv):
|
|||
partner_obj = self.pool.get('res.partner').browse(cr,uid,part_id)
|
||||
if partner_obj.property_account_payable and partner_obj.property_account_receivable:
|
||||
if partner_obj.property_account_payable.company_id.id != company_id and partner_obj.property_account_receivable.company_id.id != company_id:
|
||||
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
rec_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_receivable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
pay_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_payable'),('res_id','=','res.partner,'+str(part_id)+''),('company_id','=',company_id)])
|
||||
if not rec_pro_id:
|
||||
rec_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_receivable'),('company_id','=',company_id)])
|
||||
rec_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_receivable'),('company_id','=',company_id)])
|
||||
if not pay_pro_id:
|
||||
pay_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_payable'),('company_id','=',company_id)])
|
||||
rec_line_data = self.pool.get('ir.property').read(cr,uid,rec_pro_id,['name','value','res_id'])
|
||||
pay_line_data = self.pool.get('ir.property').read(cr,uid,pay_pro_id,['name','value','res_id'])
|
||||
pay_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_payable'),('company_id','=',company_id)])
|
||||
rec_line_data = self.pool.get('ir.property').read(cr, uid, rec_pro_id, ['name','value','res_id'])
|
||||
pay_line_data = self.pool.get('ir.property').read(cr, uid, pay_pro_id, ['name','value','res_id'])
|
||||
rec_res_id = rec_line_data and int(rec_line_data[0]['value'].split(',')[1]) or False
|
||||
pay_res_id = pay_line_data and int(pay_line_data[0]['value'].split(',')[1]) or False
|
||||
if not rec_res_id and not rec_res_id:
|
||||
|
@ -495,15 +495,15 @@ class account_invoice(osv.osv):
|
|||
for line in inv_obj[0].invoice_line:
|
||||
if line.account_id:
|
||||
if line.account_id.company_id.id != company_id:
|
||||
result_id = self.pool.get('account.account').search(cr,uid,[('name','=',line.account_id.name),('company_id','=',company_id)])
|
||||
result_id = self.pool.get('account.account').search(cr, uid, [('name','=',line.account_id.name),('company_id','=',company_id)])
|
||||
if not result_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
_('Can not find account chart for this company in invoice line account, Please Create account.'))
|
||||
r_id = self.pool.get('account.invoice.line').write(cr,uid,[line.id],{'account_id': result_id[0]})
|
||||
r_id = self.pool.get('account.invoice.line').write(cr, uid, [line.id], {'account_id': result_id[0]})
|
||||
else:
|
||||
if invoice_line:
|
||||
for inv_line in invoice_line:
|
||||
obj_l = self.pool.get('account.account').browse(cr,uid,inv_line[2]['account_id'])
|
||||
obj_l = self.pool.get('account.account').browse(cr, uid, inv_line[2]['account_id'])
|
||||
if obj_l.company_id.id != company_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
_('invoice line account company is not match with invoice company.'))
|
||||
|
@ -602,7 +602,7 @@ class account_invoice(osv.osv):
|
|||
ait_obj = self.pool.get('account.invoice.tax')
|
||||
for id in ids:
|
||||
cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,))
|
||||
partner = self.browse(cr, uid, id,context=context).partner_id
|
||||
partner = self.browse(cr, uid, id, context=context).partner_id
|
||||
if partner.lang:
|
||||
context.update({'lang': partner.lang})
|
||||
for taxe in ait_obj.compute(cr, uid, id, context=context).values():
|
||||
|
@ -852,7 +852,7 @@ class account_invoice(osv.osv):
|
|||
move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date}
|
||||
period_id=inv.period_id and inv.period_id.id or False
|
||||
if not period_id:
|
||||
period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
|
||||
period_ids= self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
|
||||
if len(period_ids):
|
||||
period_id=period_ids[0]
|
||||
if period_id:
|
||||
|
@ -940,7 +940,7 @@ class account_invoice(osv.osv):
|
|||
raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
|
||||
|
||||
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
|
||||
self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
|
||||
self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice')
|
||||
return True
|
||||
|
||||
###################
|
||||
|
@ -1117,7 +1117,7 @@ class account_invoice(osv.osv):
|
|||
if invoice.move_id:
|
||||
move_ids.append(invoice.move_id.id)
|
||||
cr.execute('SELECT id FROM account_move_line '\
|
||||
'WHERE move_id in %s',
|
||||
'WHERE move_id IN %s',
|
||||
((move_id, invoice.move_id.id),))
|
||||
lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) )
|
||||
for l in lines+invoice.payment_ids:
|
||||
|
@ -1135,7 +1135,7 @@ class account_invoice(osv.osv):
|
|||
account_invoice()
|
||||
|
||||
class account_invoice_line(osv.osv):
|
||||
def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict):
|
||||
def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
|
||||
res = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
|
@ -1220,12 +1220,12 @@ class account_invoice_line(osv.osv):
|
|||
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||
|
||||
if company_id:
|
||||
in_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
|
||||
in_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_income'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
|
||||
if not in_pro_id:
|
||||
in_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_income_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
|
||||
exp_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_expense'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
|
||||
in_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_income_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
|
||||
exp_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_expense'),('res_id','=','product.template,'+str(res.product_tmpl_id.id)+''),('company_id','=',company_id)])
|
||||
if not exp_pro_id:
|
||||
exp_pro_id = self.pool.get('ir.property').search(cr,uid,[('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
|
||||
exp_pro_id = self.pool.get('ir.property').search(cr, uid, [('name','=','property_account_expense_categ'),('res_id','=','product.template,'+str(res.categ_id.id)+''),('company_id','=',company_id)])
|
||||
|
||||
if not in_pro_id:
|
||||
in_acc = res.product_tmpl_id.property_account_income
|
||||
|
@ -1235,7 +1235,7 @@ class account_invoice_line(osv.osv):
|
|||
else:
|
||||
app_acc_in = in_acc_cate
|
||||
else:
|
||||
app_acc_in = self.pool.get('account.account').browse(cr,uid,in_pro_id)[0]
|
||||
app_acc_in = self.pool.get('account.account').browse(cr, uid, in_pro_id)[0]
|
||||
if not exp_pro_id:
|
||||
ex_acc = res.product_tmpl_id.property_account_expense
|
||||
ex_acc_cate = res.categ_id.property_account_expense_categ
|
||||
|
@ -1244,7 +1244,7 @@ class account_invoice_line(osv.osv):
|
|||
else:
|
||||
app_acc_exp = ex_acc_cate
|
||||
else:
|
||||
app_acc_exp = self.pool.get('account.account').browse(cr,uid,exp_pro_id)[0]
|
||||
app_acc_exp = self.pool.get('account.account').browse(cr, uid, exp_pro_id)[0]
|
||||
if not in_pro_id and not exp_pro_id:
|
||||
in_acc = res.product_tmpl_id.property_account_income
|
||||
in_acc_cate = res.categ_id.property_account_income_categ
|
||||
|
@ -1260,13 +1260,13 @@ class account_invoice_line(osv.osv):
|
|||
# app_acc_in = self.pool.get('account.account').browse(cr,uid,in_pro_id)[0]
|
||||
# app_acc_exp = self.pool.get('account.account').browse(cr,uid,exp_pro_id)[0]
|
||||
if app_acc_in.company_id.id != company_id and app_acc_exp.company_id.id != company_id:
|
||||
in_res_id=self.pool.get('account.account').search(cr,uid,[('name','=',app_acc_in.name),('company_id','=',company_id)])
|
||||
exp_res_id=self.pool.get('account.account').search(cr,uid,[('name','=',app_acc_exp.name),('company_id','=',company_id)])
|
||||
in_res_id=self.pool.get('account.account').search(cr, uid, [('name','=',app_acc_in.name),('company_id','=',company_id)])
|
||||
exp_res_id=self.pool.get('account.account').search(cr, uid, [('name','=',app_acc_exp.name),('company_id','=',company_id)])
|
||||
if not in_res_id and not exp_res_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
_('Can not find account chart for this company, Please Create account.'))
|
||||
in_obj_acc=self.pool.get('account.account').browse(cr,uid,in_res_id)
|
||||
exp_obj_acc=self.pool.get('account.account').browse(cr,uid,exp_res_id)
|
||||
in_obj_acc=self.pool.get('account.account').browse(cr, uid, in_res_id)
|
||||
exp_obj_acc=self.pool.get('account.account').browse(cr, uid, exp_res_id)
|
||||
if in_acc or ex_acc:
|
||||
res.product_tmpl_id.property_account_income = in_obj_acc[0]
|
||||
res.product_tmpl_id.property_account_expense = exp_obj_acc[0]
|
||||
|
@ -1290,10 +1290,10 @@ class account_invoice_line(osv.osv):
|
|||
taxep=None
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
if type in ('out_invoice', 'out_refund'):
|
||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
||||
taxes = res.taxes_id and res.taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
else:
|
||||
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid,a).tax_ids or False)
|
||||
taxes = res.supplier_taxes_id and res.supplier_taxes_id or (a and self.pool.get('account.account').browse(cr, uid, a).tax_ids or False)
|
||||
tax_id = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes)
|
||||
if type in ('in_invoice', 'in_refund'):
|
||||
to_update = self.product_id_change_unit_price_inv(cr, uid, tax_id, price_unit or res.standard_price, qty, address_invoice_id, product, partner_id, context=context)
|
||||
|
@ -1414,25 +1414,25 @@ class account_invoice_tax(osv.osv):
|
|||
'base_amount': fields.float('Base Code Amount', digits_compute=dp.get_precision('Account')),
|
||||
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
|
||||
'tax_amount': fields.float('Tax Code Amount', digits_compute=dp.get_precision('Account')),
|
||||
'company_id': fields.related('account_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
|
||||
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True),
|
||||
}
|
||||
|
||||
def base_change(self, cr, uid, ids, base,currency_id=False,company_id=False,date_invoice=False):
|
||||
def base_change(self, cr, uid, ids, base, currency_id=False, company_id=False, date_invoice=False):
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
company_obj = self.pool.get('res.company')
|
||||
company_currency=False
|
||||
if company_id:
|
||||
company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0]
|
||||
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
|
||||
if currency_id and company_currency:
|
||||
base = cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
|
||||
return {'value': {'base_amount':base}}
|
||||
|
||||
def amount_change(self, cr, uid, ids, amount,currency_id=False,company_id=False,date_invoice=False):
|
||||
def amount_change(self, cr, uid, ids, amount, currency_id=False, company_id=False, date_invoice=False):
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
company_obj = self.pool.get('res.company')
|
||||
company_currency=False
|
||||
if company_id:
|
||||
company_currency = company_obj.read(cr,uid,[company_id],['currency_id'])[0]['currency_id'][0]
|
||||
company_currency = company_obj.read(cr, uid, [company_id], ['currency_id'])[0]['currency_id'][0]
|
||||
if currency_id and company_currency:
|
||||
amount = cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
|
||||
return {'value': {'tax_amount':amount}}
|
||||
|
|
|
@ -116,26 +116,26 @@ class res_partner(osv.osv):
|
|||
return res
|
||||
|
||||
def _asset_difference_search(self, cr, uid, obj, name, type, args, context=None):
|
||||
if not len(args):
|
||||
return []
|
||||
having_values = tuple(map(itemgetter(2), args))
|
||||
where = ' AND '.join(
|
||||
map(lambda x: '(SUM(debit-credit) %(operator)s %%s)' % {
|
||||
'operator':x[1]},args))
|
||||
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
||||
cr.execute(('SELECT partner_id FROM account_move_line l '\
|
||||
'WHERE account_id IN '\
|
||||
'(SELECT id FROM account_account '\
|
||||
'WHERE type=%s AND active) '\
|
||||
'AND reconcile_id IS NULL '\
|
||||
'AND '+query+' '\
|
||||
'AND partner_id IS NOT NULL '\
|
||||
'GROUP BY partner_id HAVING '+where),
|
||||
(type,) + having_values)
|
||||
res = cr.fetchall()
|
||||
if not len(res):
|
||||
return [('id','=','0')]
|
||||
return [('id','in',map(itemgetter(0), res))]
|
||||
if not len(args):
|
||||
return []
|
||||
having_values = tuple(map(itemgetter(2), args))
|
||||
where = ' AND '.join(
|
||||
map(lambda x: '(SUM(debit-credit) %(operator)s %%s)' % {
|
||||
'operator':x[1]},args))
|
||||
query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
|
||||
cr.execute(('SELECT partner_id FROM account_move_line l '\
|
||||
'WHERE account_id IN '\
|
||||
'(SELECT id FROM account_account '\
|
||||
'WHERE type=%s AND active) '\
|
||||
'AND reconcile_id IS NULL '\
|
||||
'AND '+query+' '\
|
||||
'AND partner_id IS NOT NULL '\
|
||||
'GROUP BY partner_id HAVING '+where),
|
||||
(type,) + having_values)
|
||||
res = cr.fetchall()
|
||||
if not len(res):
|
||||
return [('id','=','0')]
|
||||
return [('id','in',map(itemgetter(0), res))]
|
||||
|
||||
def _credit_search(self, cr, uid, obj, name, args, context):
|
||||
return self._asset_difference_search(cr, uid, obj, name, 'receivable', args, context=context)
|
||||
|
|
|
@ -46,7 +46,7 @@ class account_journal(osv.osv):
|
|||
_inherit="account.journal"
|
||||
|
||||
_columns = {
|
||||
'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal'),
|
||||
'analytic_journal_id':fields.many2one('account.analytic.journal', 'Analytic Journal'),
|
||||
}
|
||||
account_journal()
|
||||
|
||||
|
|
|
@ -75,10 +75,10 @@ class account_analytic_balance(report_sxw.rml_parse):
|
|||
sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity \
|
||||
FROM account_analytic_line AS aal, account_account AS aa \
|
||||
WHERE (aal.general_account_id=aa.id) \
|
||||
AND (aal.account_id in aal.account_id in %s)\
|
||||
AND (aal.account_id IN aal.account_id IN %s)\
|
||||
AND (date>=%s) AND (date<=%s) AND aa.active \
|
||||
GROUP BY aal.general_account_id, aa.name, aa.code, aal.code \
|
||||
ORDER BY aal.code", (tuple(ids),date1, date2))
|
||||
ORDER BY aal.code", (tuple(ids), date1, date2))
|
||||
res = self.cr.dictfetchall()
|
||||
|
||||
for r in res:
|
||||
|
@ -105,14 +105,14 @@ class account_analytic_balance(report_sxw.rml_parse):
|
|||
query_params = (tuple(ids), date1, date2)
|
||||
if option == "credit" :
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \
|
||||
WHERE account_id in %s AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
elif option == "debit" :
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \
|
||||
WHERE account_id in %s\
|
||||
WHERE account_id IN %s\
|
||||
AND date>=%s AND date<=%s AND amount>0",query_params)
|
||||
elif option == "quantity" :
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \
|
||||
WHERE account_id in %s\
|
||||
WHERE account_id IN %s\
|
||||
AND date>=%s AND date<=%s",query_params)
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
|
@ -135,13 +135,13 @@ class account_analytic_balance(report_sxw.rml_parse):
|
|||
query_params = (tuple(ids2), date1, date2)
|
||||
if option == "debit" :
|
||||
self.cr.execute("SELECT sum(amount) FROM account_analytic_line \
|
||||
WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount>0",query_params)
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params)
|
||||
elif option == "credit" :
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line \
|
||||
WHERE account_id =ANY(%s) AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
|
||||
elif option == "quantity" :
|
||||
self.cr.execute("SELECT sum(unit_amount) FROM account_analytic_line \
|
||||
WHERE account_id =ANY(%s)AND date>=%s AND date<=%s",query_params)
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse):
|
|||
ids = map(lambda x: x.id, accounts)
|
||||
if not len(ids):
|
||||
return 0.0
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id in %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_balance(self, accounts, date1, date2):
|
||||
|
|
|
@ -98,14 +98,14 @@ class account_inverted_analytic_balance(report_sxw.rml_parse):
|
|||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT sum(amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id in %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids),date1, date2,))
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self, accounts, date1, date2):
|
||||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT -sum(amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id in %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_balance(self, accounts, date1, date2):
|
||||
|
@ -117,7 +117,7 @@ class account_inverted_analytic_balance(report_sxw.rml_parse):
|
|||
ids = map(lambda x: x.id, accounts)
|
||||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id in %s AND date>=%s AND date<=%s", (tuple(ids),date1, date2,))
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s", (tuple(ids),date1, date2,))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.inverted.balance', 'account.analytic.account', 'addons/account/project/report/inverted_analytic_balance.rml',parser=account_inverted_analytic_balance, header=False)
|
||||
|
|
|
@ -52,7 +52,7 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
|||
WHERE (aal.account_id=%s) AND (aal.date>=%s) \
|
||||
AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
|
||||
AND aa.active \
|
||||
AND (aal.journal_id in %s ) \
|
||||
AND (aal.journal_id IN %s ) \
|
||||
GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
|
||||
(account_id, date1, date2, tuple(journal_ids)))
|
||||
res = self.cr.dictfetchall()
|
||||
|
@ -96,8 +96,8 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
|||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id = %s AND date >= %s AND date <= %s \
|
||||
AND journal_id =ANY(%s)",
|
||||
(account_id, date1, date2,journal_ids,))
|
||||
AND journal_id IN %s",
|
||||
(account_id, date1, date2, tuple(journal_ids),))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_quantity(self, accounts, date1, date2, journals):
|
||||
|
@ -107,14 +107,14 @@ class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
|
|||
if not journals:
|
||||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id =ANY(%s) AND date>=%s AND date<=%s",
|
||||
(ids, date1, date2,))
|
||||
WHERE account_id IN %s AND date>=%s AND date<=%s",
|
||||
(tuple(ids), date1, date2,))
|
||||
else:
|
||||
journal_ids = journals
|
||||
self.cr.execute("SELECT sum(unit_amount) \
|
||||
FROM account_analytic_line \
|
||||
WHERE account_id =ANY(%s) AND date >= %s AND date <= %s \
|
||||
AND journal_id =ANY(%s)",(ids, date1, date2, journal_ids))
|
||||
WHERE account_id IN %s AND date >= %s AND date <= %s \
|
||||
AND journal_id IN %s",(tuple(ids), date1, date2, tuple(journal_ids)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.quantity_cost_ledger',
|
||||
|
|
|
@ -29,7 +29,7 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
|
|||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True),
|
||||
'journal': fields.many2many('account.analytic.journal', 'ledger_journal_rel','ledger_id', 'Journal_id','Journals'),
|
||||
'journal': fields.many2many('account.analytic.journal', 'ledger_journal_rel', 'ledger_id', 'Journal_id', 'Journals'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -38,8 +38,8 @@ class account_account_report(osv.osv):
|
|||
('closed', 'Closed'),
|
||||
], 'Internal Type', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'currency_mode': fields.selection([('current', 'At Date'), ('average', 'Average Rate')], 'Outgoing Currencies Rate',readonly=True),
|
||||
'user_type': fields.many2one('account.account.type', 'Account Type',readonly=True),
|
||||
'currency_mode': fields.selection([('current', 'At Date'), ('average', 'Average Rate')], 'Outgoing Currencies Rate', readonly=True),
|
||||
'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'amount_total': fields.float('Total Amount', readonly=True),
|
||||
'credit': fields.float('Credit', readonly=True),
|
||||
|
|
|
@ -28,21 +28,21 @@ class analytic_report(osv.osv):
|
|||
_auto = False
|
||||
_columns = {
|
||||
'date_start': fields.date('Date Start', readonly=True),
|
||||
'date_end': fields.date('Date End',readonly=True),
|
||||
'date_end': fields.date('Date End', readonly=True),
|
||||
'name' : fields.char('Analytic Account', size=128, readonly=True),
|
||||
'partner_id' : fields.many2one('res.partner', 'Associated Partner',readonly=True),
|
||||
'partner_id' : fields.many2one('res.partner', 'Associated Partner', readonly=True),
|
||||
'journal_id' : fields.many2one('account.analytic.journal', 'Analytic Journal', readonly=True),
|
||||
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', readonly=True),
|
||||
'user_id' : fields.many2one('res.users', 'Account Manager',readonly=True),
|
||||
'product_id' : fields.many2one('product.product', 'Product',readonly=True),
|
||||
'total_quantity': fields.float('# Total Quantity',readonly=True),
|
||||
'debit' : fields.float('Debit',readonly=True),
|
||||
'credit' : fields.float('Credit',readonly=True),
|
||||
'balance' : fields.float('Balance',readonly=True),
|
||||
'user_id' : fields.many2one('res.users', 'Account Manager', readonly=True),
|
||||
'product_id' : fields.many2one('product.product', 'Product', readonly=True),
|
||||
'total_quantity': fields.float('# Total Quantity', readonly=True),
|
||||
'debit' : fields.float('Debit', readonly=True),
|
||||
'credit' : fields.float('Credit', readonly=True),
|
||||
'balance' : fields.float('Balance', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'nbr':fields.integer('# of Lines', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', readonly=True),
|
||||
|
|
|
@ -68,14 +68,14 @@ class account_balance(report_sxw.rml_parse):
|
|||
result=''
|
||||
if form.has_key('periods') and form['periods']:
|
||||
period_ids = form['periods']
|
||||
per_ids = self.pool.get('account.period').browse(self.cr,self.uid,form['periods'])
|
||||
per_ids = self.pool.get('account.period').browse(self.cr, self.uid, form['periods'])
|
||||
for r in per_ids:
|
||||
if r == per_ids[len(per_ids)-1]:
|
||||
result+=r.name+". "
|
||||
else:
|
||||
result+=r.name+", "
|
||||
else:
|
||||
fy_obj = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,form['fiscalyear'])
|
||||
fy_obj = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear'])
|
||||
res = fy_obj.period_ids
|
||||
len_res = len(res)
|
||||
for r in res:
|
||||
|
@ -118,7 +118,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
child_ids = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, ids, ctx)
|
||||
if child_ids:
|
||||
ids = child_ids
|
||||
accounts = self.pool.get('account.account').read(self.cr, self.uid, ids,['type','code','name','debit','credit','balance','parent_id'], ctx)
|
||||
accounts = self.pool.get('account.account').read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id'], ctx)
|
||||
for account in accounts:
|
||||
if account['id'] in done:
|
||||
continue
|
||||
|
|
|
@ -351,7 +351,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
|
||||
if perc==1:
|
||||
if form['select_account']!=False:
|
||||
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid,form['select_account'],ctx.copy())
|
||||
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid, form['select_account'], ctx.copy())
|
||||
if ref_ac.balance<>0.00:
|
||||
ref_bal=ref_ac.balance
|
||||
else:
|
||||
|
@ -365,7 +365,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
total_for_perc=[]
|
||||
# if perc==1:
|
||||
self.done_total=1
|
||||
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
|
||||
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
|
||||
self.done_total=0
|
||||
|
||||
for t1 in range(0,len(form['fiscalyear'])):
|
||||
|
@ -376,13 +376,13 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
# self.result_total = {}
|
||||
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
|
||||
years["year"+str(temp)]=fy[0][1][12:16]
|
||||
|
||||
return [years]
|
||||
|
||||
|
||||
def linesForTotal(self,form,ids={},doneAccount={},level=1):
|
||||
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
|
||||
if self.done_total==1:
|
||||
self.done_total==1
|
||||
else:
|
||||
|
@ -443,7 +443,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||
ids2.sort()
|
||||
|
||||
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2],doneAccount,level+1)
|
||||
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2], doneAccount, level+1)
|
||||
|
||||
return [self.result_total]
|
||||
|
||||
|
@ -462,7 +462,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner']=form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
|
||||
if len(tmp1):
|
||||
accounts.append(tmp1)
|
||||
|
@ -598,12 +598,12 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
|
||||
return result
|
||||
|
||||
def get_years(self,form):
|
||||
def get_years(self, form):
|
||||
result =[]
|
||||
res={}
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
for temp in range(0, len(form['fiscalyear'])):
|
||||
res={}
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
|
||||
res['year']=fy[0][1]
|
||||
res['last_str']=temp
|
||||
|
||||
|
@ -611,7 +611,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
self.linesForYear(form)
|
||||
return result
|
||||
|
||||
def get_lines(self,year_dict,form):
|
||||
def get_lines(self, year_dict, form):
|
||||
final_result = []
|
||||
line_l =[]
|
||||
res = {}
|
||||
|
@ -643,7 +643,7 @@ class account_balance_landscape(rml_parse.rml_parse):
|
|||
final_result.append(res)
|
||||
return final_result
|
||||
|
||||
def cal_total(self,year_dict):
|
||||
def cal_total(self, year_dict):
|
||||
total_l = self.result_total
|
||||
if total_l:
|
||||
for k,v in total_l.items():
|
||||
|
|
|
@ -33,18 +33,18 @@ class account_entries_report(osv.osv):
|
|||
'date_maturity': fields.date('Date Maturity', readonly=True),
|
||||
'nbr':fields.integer('# of Entries', readonly=True),
|
||||
'nbl':fields.integer('# of Lines', readonly=True),
|
||||
'amount': fields.float('Amount',readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'ref': fields.char('Reference', size=64,readonly=True),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
'ref': fields.char('Reference', size=64, readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Period', readonly=True),
|
||||
'account_id': fields.many2one('account.account', 'Account', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State',readonly=True,
|
||||
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'State', readonly=True,
|
||||
help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'),
|
||||
'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True,
|
||||
help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'),
|
||||
|
|
|
@ -33,16 +33,16 @@ class account_invoice_report(osv.osv):
|
|||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'product_qty':fields.float('Qty', readonly=True),
|
||||
'uom_name': fields.char('Default UoM', size=128, readonly=True),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')],readonly=True),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',readonly=True),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term', readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], readonly=True),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
|
||||
'categ_id': fields.many2one('product.category','Category of Product', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal',readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
|
||||
|
|
|
@ -207,15 +207,15 @@ class report_account_type_sales(osv.osv):
|
|||
_description = "Report of the Sales by Account Type"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year',size=64,required=False, readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period',readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product',readonly=True),
|
||||
'name': fields.char('Year', size=64, required=False, readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'user_type': fields.many2one('account.account.type', 'Account Type', readonly=True),
|
||||
'amount_total': fields.float('Total', readonly=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
}
|
||||
_order = 'name desc,amount_total desc'
|
||||
|
||||
|
@ -249,15 +249,15 @@ class report_account_sales(osv.osv):
|
|||
_description = "Report of the Sales by Account"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year',size=64,required=False, readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period',readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product',readonly=True),
|
||||
'name': fields.char('Year', size=64, required=False, readonly=True),
|
||||
'period_id': fields.many2one('account.period', 'Force Period', readonly=True),
|
||||
'product_id': fields.many2one('product.product', 'Product', readonly=True),
|
||||
'quantity': fields.float('Quantity', readonly=True),
|
||||
'account_id': fields.many2one('account.account', 'Account', readonly=True),
|
||||
'amount_total': fields.float('Total', readonly=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')], 'Month', readonly=True),
|
||||
}
|
||||
_order = 'name desc,amount_total desc'
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
ids_final = []
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
if ids_journal_period:
|
||||
self.cr.execute('select a.code, a.name, sum(debit) as debit, sum(credit) as credit from account_move_line l left join account_account a on (l.account_id=a.id) where l.period_id=%s and l.journal_id=%s and l.state<>\'draft\' group by a.id, a.code, a.name, l.journal_id, l.period_id', (period, journal))
|
||||
res = self.cr.dictfetchall()
|
||||
|
|
|
@ -320,7 +320,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
# return super(account_balance,self).repeatIn(lst, name, nodes_parent=False)
|
||||
#end
|
||||
|
||||
def linesForYear(self,form):
|
||||
def linesForYear(self, form):
|
||||
temp=0
|
||||
years={}
|
||||
|
||||
|
@ -351,7 +351,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
|
||||
if perc==1:
|
||||
if form['select_account']!=False:
|
||||
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid,form['select_account'],ctx.copy())
|
||||
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid, form['select_account'], ctx.copy())
|
||||
if ref_ac.balance<>0.00:
|
||||
ref_bal=ref_ac.balance
|
||||
else:
|
||||
|
@ -365,7 +365,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
total_for_perc=[]
|
||||
# if perc==1:
|
||||
self.done_total=1
|
||||
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
|
||||
self.total_for_perc=self.linesForTotal(form, ids={}, doneAccount={}, level=1)
|
||||
self.done_total=0
|
||||
|
||||
for t1 in range(0,len(form['fiscalyear'])):
|
||||
|
@ -376,13 +376,13 @@ class account_balance(report_sxw.rml_parse):
|
|||
# self.result_total = {}
|
||||
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
|
||||
years["year"+str(temp)]=fy[0][1][12:16]
|
||||
|
||||
return [years]
|
||||
|
||||
|
||||
def linesForTotal(self,form,ids={},doneAccount={},level=1):
|
||||
def linesForTotal(self, form, ids={}, doneAccount={}, level=1):
|
||||
if self.done_total==1:
|
||||
self.done_total==1
|
||||
else:
|
||||
|
@ -440,7 +440,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||
ids2.sort()
|
||||
|
||||
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2],doneAccount,level+1)
|
||||
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2], doneAccount, level+1)
|
||||
|
||||
return [self.result_total]
|
||||
|
||||
|
@ -459,7 +459,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
ctx['periods'] = form['periods']
|
||||
ctx['period_manner']=form['period_manner']
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
|
||||
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||
|
||||
if len(tmp1):
|
||||
accounts.append(tmp1)
|
||||
|
@ -594,12 +594,12 @@ class account_balance(report_sxw.rml_parse):
|
|||
|
||||
return result
|
||||
|
||||
def get_years(self,form):
|
||||
def get_years(self, form):
|
||||
result =[]
|
||||
res={}
|
||||
for temp in range(0,len(form['fiscalyear'])):
|
||||
res={}
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][temp])
|
||||
fy=self.pool.get('account.fiscalyear').name_get(self.cr, self.uid, form['fiscalyear'][temp])
|
||||
res['year']=fy[0][1]
|
||||
res['last_str']=temp
|
||||
|
||||
|
@ -607,7 +607,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
self.linesForYear(form)
|
||||
return result
|
||||
|
||||
def get_lines(self,year_dict,form):
|
||||
def get_lines(self, year_dict, form):
|
||||
final_result = []
|
||||
line_l =[]
|
||||
res = {}
|
||||
|
@ -639,7 +639,7 @@ class account_balance(report_sxw.rml_parse):
|
|||
final_result.append(res)
|
||||
return final_result
|
||||
|
||||
def cal_total(self,year_dict):
|
||||
def cal_total(self, year_dict):
|
||||
total_l = self.result_total
|
||||
if total_l:
|
||||
for k,v in total_l.items():
|
||||
|
|
|
@ -65,7 +65,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
ids_final = []
|
||||
for journal in journal_id:
|
||||
for period in period_id:
|
||||
ids_journal_period = self.pool.get('account.journal.period').search(self.cr,self.uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
ids_journal_period = self.pool.get('account.journal.period').search(self.cr, self.uid, [('journal_id','=',journal),('period_id','=',period)])
|
||||
if ids_journal_period:
|
||||
ids_final.append(ids_journal_period[0])
|
||||
data_jour_period = self.pool.get('account.journal.period').browse(self.cr, self.uid, ids_final)
|
||||
|
@ -91,7 +91,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
return lines_data
|
||||
if not self.journal_ids:
|
||||
return []
|
||||
print " self.journal_ids >>. " , self.journal_ids
|
||||
|
||||
self.cr.execute('SELECT j.code, j.name, '
|
||||
'SUM(l.debit) AS debit, SUM(l.credit) AS credit '
|
||||
'FROM account_move_line l '
|
||||
|
@ -103,7 +103,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
res = self.cr.dictfetchall()
|
||||
return res
|
||||
|
||||
def _sum_debit_period(self, period_id,journal_id=None):
|
||||
def _sum_debit_period(self, period_id, journal_id=None):
|
||||
journals = journal_id or self.journal_ids
|
||||
if not journals:
|
||||
return 0.0
|
||||
|
@ -113,7 +113,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
(period_id, tuple(journals)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit_period(self, period_id,journal_id=None):
|
||||
def _sum_credit_period(self, period_id, journal_id=None):
|
||||
journals = journal_id or self.journal_ids
|
||||
if not journals:
|
||||
return 0.0
|
||||
|
@ -123,7 +123,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
(period_id, tuple(journals)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_debit(self,period_id=None,journal_id=None):
|
||||
def _sum_debit(self, period_id=None, journal_id=None):
|
||||
journals = journal_id or self.journal_ids
|
||||
periods = period_id or self.period_ids
|
||||
if not (journals and periods):
|
||||
|
@ -135,7 +135,7 @@ class journal_print(report_sxw.rml_parse):
|
|||
(tuple(periods), tuple(journals)))
|
||||
return self.cr.fetchone()[0] or 0.0
|
||||
|
||||
def _sum_credit(self,period_id=None,journal_id=None):
|
||||
def _sum_credit(self, period_id=None, journal_id=None):
|
||||
periods = period_id or self.period_ids
|
||||
journals = journal_id or self.journal_ids
|
||||
if not (periods and journals):
|
||||
|
|
|
@ -70,7 +70,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
})
|
||||
self.context = context
|
||||
|
||||
def get_min_date(self,form):
|
||||
def get_min_date(self, form):
|
||||
|
||||
## Get max born from account_fiscal year
|
||||
#
|
||||
|
@ -158,7 +158,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
## We will make the test for period or date
|
||||
## We will now make the test
|
||||
#
|
||||
ctx['state'] = form['context'].get('state','all')
|
||||
ctx['state'] = form['context'].get('state', 'all')
|
||||
if form.has_key('fiscalyear'):
|
||||
ctx['fiscalyear'] = form['fiscalyear']
|
||||
ctx['periods'] = form['periods']
|
||||
|
@ -173,10 +173,10 @@ class general_ledger(rml_parse.rml_parse):
|
|||
if account and account.child_consol_ids: # add ids of consolidated childs also of selected account
|
||||
ctx['consolidate_childs'] = True
|
||||
ctx['account_id'] = account.id
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
ids_acc = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])], context=ctx)
|
||||
for child_id in ids_acc:
|
||||
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
|
||||
sold_account = self._sum_solde_account(child_account,form)
|
||||
sold_account = self._sum_solde_account(child_account, form)
|
||||
self.sold_accounts[child_account.id] = sold_account
|
||||
if form['display_account'] == 'bal_mouvement':
|
||||
if child_account.type != 'view' \
|
||||
|
@ -209,7 +209,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s "\
|
||||
"AND l.date < %s AND l.date > %s"
|
||||
self.cr.execute(SOLDEINIT, (move.id, self.borne_date['max_date'],self.borne_date['min_date']))
|
||||
self.cr.execute(SOLDEINIT, (move.id, self.borne_date['max_date'], self.borne_date['min_date']))
|
||||
resultat = self.cr.dictfetchall()
|
||||
if resultat[0] :
|
||||
if resultat[0]['sum_debit'] == None:
|
||||
|
@ -275,7 +275,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
for l in res:
|
||||
l['move']=l['move_name']
|
||||
if l['invoice_id']:
|
||||
l['ref'] = '%s: %s'%(inv_types[l['invoice_type']],l['invoice_number'])
|
||||
l['ref'] = '%s: %s'%(inv_types[l['invoice_type']], l['invoice_number'])
|
||||
l['partner'] = l['partner_name'] or ''
|
||||
account_sum = l['debit'] - l ['credit']
|
||||
#c = time.strptime(l['date'],"%Y-%m-%d")
|
||||
|
@ -308,7 +308,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s "%(account.id,self.query))
|
||||
"WHERE l.account_id = %s AND %s "%(account.id, self.query))
|
||||
## Add solde init to the result
|
||||
#
|
||||
sum_credit = self.cr.fetchone()[0] or 0.0
|
||||
|
@ -322,7 +322,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
def _sum_solde_account(self, account, form):
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id = %s AND %s"%(account.id,self.query))
|
||||
"WHERE l.account_id = %s AND %s"%(account.id, self.query))
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
if form.get('soldeinit', False):
|
||||
sum_solde += account.init_debit - account.init_credit
|
||||
|
@ -334,7 +334,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
return 0.0
|
||||
self.cr.execute("SELECT sum(debit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in %s AND "+self.query,
|
||||
"WHERE l.account_id IN %s AND "+self.query,
|
||||
(tuple(self.child_ids),))
|
||||
sum_debit = self.cr.fetchone()[0] or 0.0
|
||||
return sum_debit
|
||||
|
@ -344,7 +344,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
return 0.0
|
||||
self.cr.execute("SELECT sum(credit) "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in %s AND "+self.query,
|
||||
"WHERE l.account_id IN %s AND "+self.query,
|
||||
(tuple(self.child_ids),))
|
||||
## Add solde init to the result
|
||||
#
|
||||
|
@ -356,7 +356,7 @@ class general_ledger(rml_parse.rml_parse):
|
|||
return 0.0
|
||||
self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
|
||||
"FROM account_move_line l "\
|
||||
"WHERE l.account_id in %s AND "+self.query,
|
||||
"WHERE l.account_id IN %s AND "+self.query,
|
||||
(tuple(self.child_ids),))
|
||||
sum_solde = self.cr.fetchone()[0] or 0.0
|
||||
return sum_solde
|
||||
|
|
|
@ -51,7 +51,7 @@ class Overdue(report_sxw.rml_parse):
|
|||
'country_id' : False,
|
||||
}
|
||||
if adr_id:
|
||||
result = res_partner_address.read(self.cr, self.uid, [adr_id],context=self.context.copy())
|
||||
result = res_partner_address.read(self.cr, self.uid, [adr_id], context=self.context.copy())
|
||||
result[0]['country_id'] = result[0]['country_id'] and result[0]['country_id'][1] or False
|
||||
return result
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
#
|
||||
# Date Management
|
||||
#
|
||||
def date_range(self,start,end):
|
||||
def date_range(self, start, end):
|
||||
if not start or not end:
|
||||
return []
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
|
||||
|
@ -62,7 +62,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
full_str_date.append(str(date))
|
||||
return full_str_date
|
||||
|
||||
def transform_period_into_date_array(self,data):
|
||||
def transform_period_into_date_array(self, data):
|
||||
## Get All Period Date
|
||||
#
|
||||
# If we have no period we will take all perdio in the FiscalYear.
|
||||
|
@ -73,17 +73,17 @@ class partner_balance(report_sxw.rml_parse):
|
|||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop)
|
||||
self.date_lst = date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
|
||||
def transform_date_into_date_array(self,data):
|
||||
return_array = self.date_range(data['form']['date1'],data['form']['date2'])
|
||||
def transform_date_into_date_array(self, data):
|
||||
return_array = self.date_range(data['form']['date1'], data['form']['date2'])
|
||||
self.date_lst = return_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_both_into_date_array(self,data):
|
||||
def transform_both_into_date_array(self, data):
|
||||
final_date_array = []
|
||||
date_start_date = data['form']['date1']
|
||||
date_stop_date = data['form']['date2']
|
||||
|
@ -95,7 +95,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
if periods_id:
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop)
|
||||
period_start_date = date_array[0]
|
||||
period_stop_date = date_array[-1]
|
||||
|
||||
|
@ -109,15 +109,15 @@ class partner_balance(report_sxw.rml_parse):
|
|||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
final_date_array = final_date_array + self.date_range(start_date,stop_date)
|
||||
final_date_array = final_date_array + self.date_range(start_date, stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
else :
|
||||
final_date_array = final_date_array + self.date_range(date_start_date,date_stop_date)
|
||||
final_date_array = final_date_array + self.date_range(date_start_date, date_stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_none_into_date_array(self,data):
|
||||
def transform_none_into_date_array(self, data):
|
||||
|
||||
sql = "SELECT min(date) as start_date from account_move_line"
|
||||
self.cr.execute(sql)
|
||||
|
@ -129,12 +129,12 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
|
||||
array = []
|
||||
array = array + self.date_range(start_date,stop_date)
|
||||
array = array + self.date_range(start_date, stop_date)
|
||||
self.date_lst = array
|
||||
self.date_lst.sort()
|
||||
|
||||
|
||||
def comma_me(self,amount):
|
||||
def comma_me(self, amount):
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
|
@ -182,7 +182,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
"ON (a.type = t.code) " \
|
||||
"WHERE a.company_id = %s " \
|
||||
"AND a.type IN %s " \
|
||||
"AND a.active", (data['form']['company_id'],self.ACCOUNT_TYPE))
|
||||
"AND a.active", (data['form']['company_id'], self.ACCOUNT_TYPE))
|
||||
self.account_ids = [a for (a,) in self.cr.fetchall()]
|
||||
|
||||
super(partner_balance, self).set_context(objects, data, ids, report_type)
|
||||
|
@ -224,7 +224,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
## We will now compute Total
|
||||
return self._add_subtotal(full_account)
|
||||
|
||||
def _add_subtotal(self,cleanarray):
|
||||
def _add_subtotal(self, cleanarray):
|
||||
i=0
|
||||
completearray = []
|
||||
tot_debit = 0.0
|
||||
|
@ -343,7 +343,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
return completearray
|
||||
|
||||
|
||||
def _sum_debit(self,data):
|
||||
def _sum_debit(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -361,7 +361,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
return result_tmp
|
||||
|
||||
def _sum_credit(self,data):
|
||||
def _sum_credit(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -380,7 +380,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
return result_tmp
|
||||
|
||||
def _sum_litige(self,data):
|
||||
def _sum_litige(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -399,7 +399,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
return result_tmp
|
||||
|
||||
def _sum_sdebit(self,data):
|
||||
def _sum_sdebit(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -425,7 +425,7 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
return result_tmp
|
||||
|
||||
def _sum_scredit(self,data):
|
||||
def _sum_scredit(self, data):
|
||||
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
|
@ -454,11 +454,11 @@ class partner_balance(report_sxw.rml_parse):
|
|||
|
||||
return result_tmp
|
||||
|
||||
def _solde_balance_debit(self,data):
|
||||
def _solde_balance_debit(self, data):
|
||||
debit, credit = self._sum_debit(data), self._sum_credit(data)
|
||||
return debit > credit and debit - credit
|
||||
|
||||
def _solde_balance_credit(self,data):
|
||||
def _solde_balance_credit(self, data):
|
||||
debit, credit = self._sum_debit(data), self._sum_credit(data)
|
||||
return credit > debit and credit - debit
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
'get_currency': self._get_currency,
|
||||
'comma_me' : self.comma_me,
|
||||
})
|
||||
def date_range(self,start,end):
|
||||
def date_range(self, start, end):
|
||||
if not start or not end:
|
||||
return []
|
||||
start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
|
||||
|
@ -57,7 +57,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
return full_str_date
|
||||
|
||||
#
|
||||
def transform_period_into_date_array(self,data):
|
||||
def transform_period_into_date_array(self, data):
|
||||
## Get All Period Date
|
||||
if not data['form']['periods']:
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
|
@ -66,12 +66,12 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop)
|
||||
self.date_lst = date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_date_into_date_array(self,data):
|
||||
return_array = self.date_range(data['form']['date1'],data['form']['date2'])
|
||||
return_array = self.date_range(data['form']['date1'], data['form']['date2'])
|
||||
self.date_lst = return_array
|
||||
self.date_lst.sort()
|
||||
|
||||
|
@ -84,7 +84,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
date_array = date_array + self.date_range(period_obj.date_start, period_obj.date_stop)
|
||||
|
||||
period_start_date = date_array[0]
|
||||
date_start_date = data['form']['date1']
|
||||
|
@ -105,7 +105,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_none_into_date_array(self,data):
|
||||
def transform_none_into_date_array(self, data):
|
||||
sql = "SELECT min(date) as start_date from account_move_line"
|
||||
self.cr.execute(sql)
|
||||
start_date = self.cr.fetchone()[0]
|
||||
|
@ -118,7 +118,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.date_lst.sort()
|
||||
|
||||
|
||||
def comma_me(self,amount):
|
||||
def comma_me(self, amount):
|
||||
if type(amount) is float :
|
||||
amount = str('%.2f'%amount)
|
||||
else :
|
||||
|
@ -143,7 +143,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
## Si on imprime depuis les partenaires
|
||||
if ids:
|
||||
#PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")"
|
||||
PARTNER_REQUEST = "AND line.partner_id =ANY(%s)" %ids
|
||||
PARTNER_REQUEST = "AND line.partner_id IN %s",(tuple(ids),)
|
||||
# Transformation des date
|
||||
#
|
||||
#
|
||||
|
@ -179,8 +179,8 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"LEFT JOIN account_account_type t " \
|
||||
"ON (a.type=t.code) " \
|
||||
"WHERE a.company_id = %s " \
|
||||
'AND a.type =ANY(%s)' \
|
||||
"AND a.active", (data['form']['company_id'],self.ACCOUNT_TYPE,))
|
||||
'AND a.type IN %s' \
|
||||
"AND a.active", (data['form']['company_id'],tuple(self.ACCOUNT_TYPE)))
|
||||
self.account_ids = [a for (a,) in self.cr.fetchall()]
|
||||
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -196,11 +196,11 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"AND line.date >= %s " \
|
||||
"AND line.date <= %s " \
|
||||
"AND line.reconcile_id IS NULL " \
|
||||
"AND line.account_id =ANY(%s)" \
|
||||
"AND line.account_id IN %s" \
|
||||
" " + PARTNER_REQUEST + " " \
|
||||
"AND account.company_id = %s " \
|
||||
"AND account.active " ,
|
||||
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],self.account_ids,data['form']['company_id'],))
|
||||
(self.date_lst[0],self.date_lst[len(self.date_lst)-1],tuple(self.account_ids),data['form']['company_id'],))
|
||||
# else:
|
||||
#
|
||||
# self.cr.execute(
|
||||
|
@ -261,11 +261,11 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"LEFT JOIN account_journal j " \
|
||||
"ON (l.journal_id = j.id) " \
|
||||
"WHERE l.partner_id = %s " \
|
||||
"AND l.account_id =ANY(%s)"\
|
||||
"AND l.account_id IN %s"\
|
||||
"AND l.date IN (" + self.date_lst_string + ")"
|
||||
" " + RECONCILE_TAG + " "\
|
||||
"ORDER BY l.id",
|
||||
(partner.id,self.account_ids,))
|
||||
(partner.id, tuple(self.account_ids),))
|
||||
res = self.cr.dictfetchall()
|
||||
sum = 0.0
|
||||
for r in res:
|
||||
|
@ -275,7 +275,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
|
||||
return full_account
|
||||
|
||||
def _sum_debit_partner(self, partner,data):
|
||||
def _sum_debit_partner(self, partner, data):
|
||||
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
|
@ -288,10 +288,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id = %s " \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"AND account_id IN %s" \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(partner.id, self.account_ids,self.date_lst[0],))
|
||||
(partner.id, tuple(self.account_ids), self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
@ -303,10 +303,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id = %s " \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"AND account_id IN %s" \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ")" ,
|
||||
(partner.id,self.account_ids,))
|
||||
(partner.id,tuple(self.account_ids),))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
|
@ -315,7 +315,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
def _sum_credit_partner(self, partner,data):
|
||||
def _sum_credit_partner(self, partner, data):
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
result_tmp = 0.0
|
||||
if data['form']['reconcil'] :
|
||||
|
@ -327,10 +327,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id=%s " \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"AND account_id IN %s" \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(partner.id,self.account_ids,self.date_lst[0],))
|
||||
(partner.id, tuple(self.account_ids), self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
@ -342,10 +342,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id=%s " \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"AND account_id IN %s" \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ")",
|
||||
(partner.id,self.account_ids,))
|
||||
(partner.id, tuple(self.account_ids),))
|
||||
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
|
@ -354,7 +354,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
result_tmp = result_tmp + 0.0
|
||||
return result_tmp
|
||||
|
||||
def _sum_debit(self,data):
|
||||
def _sum_debit(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -367,11 +367,11 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id =ANY(%s)" \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"WHERE partner_id IN %s" \
|
||||
"AND account_id IN %s" \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(self.partner_ids,self.account_ids,self.date_lst[0],))
|
||||
(tuple(self.partner_ids), tuple(self.account_ids), self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
@ -382,10 +382,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.cr.execute(
|
||||
"SELECT sum(debit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id =ANY(%s)" \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"WHERE partner_id IN %s" \
|
||||
"AND account_id IN %s" \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ")",(self.partner_ids,self.account_ids,))
|
||||
"AND date IN (" + self.date_lst_string + ")",(tuple(self.partner_ids), tuple(self.account_ids),))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
@ -395,7 +395,7 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
return result_tmp
|
||||
|
||||
|
||||
def _sum_credit(self,data):
|
||||
def _sum_credit(self, data):
|
||||
if not self.ids:
|
||||
return 0.0
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
|
@ -408,11 +408,11 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id =ANY(%s)" \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"WHERE partner_id IN %s" \
|
||||
"AND account_id IN %s" \
|
||||
"AND reconcile_id IS NULL " \
|
||||
"AND date < %s " ,
|
||||
(self.partner_ids,self.account_ids,self.date_lst[0],))
|
||||
(tuple(self.partner_ids), tuple(self.account_ids), self.date_lst[0],))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
@ -423,10 +423,10 @@ class third_party_ledger(rml_parse.rml_parse):
|
|||
self.cr.execute(
|
||||
"SELECT sum(credit) " \
|
||||
"FROM account_move_line " \
|
||||
"WHERE partner_id =ANY(%s)" \
|
||||
"AND account_id =ANY(%s)" \
|
||||
"WHERE partner_id IN %s" \
|
||||
"AND account_id IN %s" \
|
||||
" " + RECONCILE_TAG + " " \
|
||||
"AND date IN (" + self.date_lst_string + ")",(self.partner_ids,self.account_ids,))
|
||||
"AND date IN (" + self.date_lst_string + ")",(tuple(self.partner_ids), tuple(self.account_ids),))
|
||||
contemp = self.cr.fetchone()
|
||||
if contemp != None:
|
||||
result_tmp = contemp[0] or 0.0
|
||||
|
|
|
@ -36,10 +36,10 @@ class report_voucher_move(report_sxw.rml_parse):
|
|||
})
|
||||
self.user=uid
|
||||
|
||||
def convert(self,amount):
|
||||
user_id = self.pool.get('res.users').browse(self.cr, self.user,[self.user])[0]
|
||||
def convert(self, amount):
|
||||
user_id = self.pool.get('res.users').browse(self.cr, self.user, [self.user])[0]
|
||||
cur = user_id.company_id.currency_id.name
|
||||
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
|
||||
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
|
||||
return amt_en
|
||||
|
||||
def debit(self, move_ids):
|
||||
|
|
|
@ -214,7 +214,7 @@ class account_automatic_reconcile(osv.osv_memory):
|
|||
|
||||
# add the number of transactions for partners who have only one
|
||||
# unreconciled transactions to the unreconciled count
|
||||
partner_filter = partner_ids and 'AND partner_id not in (%s)' % ','.join(map(str, filter(None, partner_ids))) or ''
|
||||
partner_filter = partner_ids and 'AND partner_id NOT IN %s',(tuple(partner_ids),) or ''
|
||||
cr.execute(
|
||||
"SELECT count(*) " \
|
||||
"FROM account_move_line " \
|
||||
|
|
|
@ -53,12 +53,12 @@ class account_chart(osv.osv_memory):
|
|||
act_obj = self.pool.get('ir.actions.act_window')
|
||||
data = self.read(cr, uid, ids, [], context=context)[0]
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'],context=context)[0]['res_id']
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'], context=context)[0]['res_id']
|
||||
result = act_obj.read(cr, uid, [id], context=context)[0]
|
||||
result['context'] = str({'fiscalyear': data['fiscalyear'], \
|
||||
'state': data['target_move']})
|
||||
if data['fiscalyear']:
|
||||
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']],context=context)[0]['code']
|
||||
result['name'] += ':' + self.pool.get('account.fiscalyear').read(cr, uid, [data['fiscalyear']], context=context)[0]['code']
|
||||
return result
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -43,7 +43,7 @@ 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):
|
||||
for data in self.read(cr, uid, ids, context=context):
|
||||
if not data['sure']:
|
||||
raise osv.except_osv(_('UserError'), _('Closing of states \
|
||||
cancelled, please check the box !'))
|
||||
|
|
|
@ -61,7 +61,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
date = False
|
||||
period = False
|
||||
description = False
|
||||
for inv in inv_obj.browse(cr, uid, context['active_ids'],context=context):
|
||||
for inv in inv_obj.browse(cr, uid, context['active_ids'], context=context):
|
||||
if inv.state in ['draft', 'proforma2', 'cancel']:
|
||||
raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode))
|
||||
if form['period'] :
|
||||
|
@ -81,7 +81,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
from account_period where date(%s)
|
||||
between date_start AND date_stop \
|
||||
and company_id = %s limit 1 """,
|
||||
(date, self.pool.get('res.users').browse(cr, uid, uid,context=context).company_id.id,))
|
||||
(date, self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id,))
|
||||
else:
|
||||
cr.execute("""SELECT id
|
||||
from account_period where date(%s)
|
||||
|
@ -102,7 +102,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
_('No Period found on Invoice!'))
|
||||
|
||||
refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description)
|
||||
refund = inv_obj.browse(cr, uid, refund_id[0],context=context)
|
||||
refund = inv_obj.browse(cr, uid, refund_id[0], context=context)
|
||||
inv_obj.write(cr, uid, [refund.id], {'date_due': date,
|
||||
'check_total': inv.check_total})
|
||||
inv_obj.button_compute(cr, uid, refund_id)
|
||||
|
@ -118,7 +118,7 @@ class account_invoice_refund(osv.osv_memory):
|
|||
reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
|
||||
wf_service.trg_validate(uid, 'account.invoice', \
|
||||
refund.id, 'invoice_open', cr)
|
||||
refund = inv_obj.browse(cr, uid, refund_id[0],context=context)
|
||||
refund = inv_obj.browse(cr, uid, refund_id[0], context=context)
|
||||
for tmpline in refund.move_id.line_id :
|
||||
if tmpline.account_id.id == inv.account_id.id :
|
||||
to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
|
||||
|
@ -136,13 +136,13 @@ class account_invoice_refund(osv.osv_memory):
|
|||
'partner_insite', 'partner_contact',
|
||||
'partner_ref', 'payment_term', 'account_id',
|
||||
'currency_id', 'invoice_line', 'tax_line',
|
||||
'journal_id', 'period_id'],context=context)
|
||||
'journal_id', 'period_id'], context=context)
|
||||
invoice = invoice[0]
|
||||
del invoice['id']
|
||||
invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'],context=context)
|
||||
invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'], context=context)
|
||||
invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
|
||||
tax_lines = self.pool.get('account.invoice.tax').read(
|
||||
cr, uid, invoice['tax_line'],context=context)
|
||||
cr, uid, invoice['tax_line'], context=context)
|
||||
tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
|
||||
|
||||
invoice.update({
|
||||
|
@ -176,8 +176,8 @@ class account_invoice_refund(osv.osv_memory):
|
|||
else:
|
||||
xml_id = 'action_invoice_tree4'
|
||||
result = mod_obj._get_id(cr, uid, 'account', xml_id)
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'],context=context)['res_id']
|
||||
result = act_obj.read(cr, uid, id,context=context)
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)['res_id']
|
||||
result = act_obj.read(cr, uid, id, context=context)
|
||||
result['res_id'] = created_inv
|
||||
return result
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ class account_move_bank_reconcile(osv.osv_memory):
|
|||
@param ids: account move bank reconcile’s ID or list of IDs
|
||||
@return: dictionary of Open account move line on given journal_id.
|
||||
"""
|
||||
data = self.read(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'],))
|
||||
account_id = cr.fetchone()[0]
|
||||
|
|
|
@ -35,7 +35,7 @@ class account_open_closed_fiscalyear(osv.osv_memory):
|
|||
if not data_fyear.end_journal_period_id:
|
||||
raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year'))
|
||||
period_journal = data_fyear.end_journal_period_id
|
||||
ids_move = self.pool.get('account.move').search(cr,uid,[('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
|
||||
ids_move = self.pool.get('account.move').search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
|
||||
if ids_move:
|
||||
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))
|
||||
return {}
|
||||
|
|
|
@ -142,7 +142,7 @@ class account_invoice_pay(osv.osv_memory):
|
|||
cur_obj = self.pool.get('res.currency')
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
writeoff_account_id = False
|
||||
writeoff_journal_id = False
|
||||
comment = False
|
||||
|
|
|
@ -45,9 +45,9 @@ class account_move_line_reconcile(osv.osv_memory):
|
|||
_description = 'Account move line reconcile'
|
||||
_columns = {
|
||||
'trans_nbr': fields.integer('# of Transaction', readonly=True),
|
||||
'credit': fields.float('Credit amount',readonly=True),
|
||||
'debit': fields.float('Debit amount',readonly=True),
|
||||
'writeoff': fields.float('Write-Off amount',readonly=True),
|
||||
'credit': fields.float('Credit amount', readonly=True),
|
||||
'debit': fields.float('Debit amount', readonly=True),
|
||||
'writeoff': fields.float('Write-Off amount', readonly=True),
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
|
|
|
@ -41,7 +41,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
|||
currency_obj = self.pool.get('res.currency')
|
||||
statement_reconcile_obj = self.pool.get('account.bank.statement.reconcile')
|
||||
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
line_ids = data['line_ids']
|
||||
line_date = time.strftime('%Y-%m-%d')
|
||||
|
||||
|
@ -98,8 +98,8 @@ class account_statement_from_invoice(osv.osv_memory):
|
|||
_description = "Entries by Statement from Invoices"
|
||||
_columns = {
|
||||
'date': fields.date('Date payment',required=True),
|
||||
'journal_ids': fields.many2many('account.journal','account_journal_relation','account_id','journal_id','Journal'),
|
||||
'line_ids': fields.many2many('account.move.line','account_move_line_relation','move_id','line_id','Invoices'),
|
||||
'journal_ids': fields.many2many('account.journal', 'account_journal_relation', 'account_id', 'journal_id', 'Journal'),
|
||||
'line_ids': fields.many2many('account.move.line', 'account_move_line_relation', 'move_id', 'line_id', 'Invoices'),
|
||||
}
|
||||
_defaults = {
|
||||
'date':lambda *a: time.strftime('%Y-%m-%d'),
|
||||
|
@ -113,7 +113,7 @@ class account_statement_from_invoice(osv.osv_memory):
|
|||
mod_obj = self.pool.get('ir.model.data')
|
||||
statement_id = 'statement_id' in context and context['statement_id']
|
||||
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
statement = statement_obj.browse(cr, uid, statement_id, context=context)
|
||||
args_move_line = []
|
||||
repeated_move_line_ids = []
|
||||
|
@ -126,7 +126,7 @@ class account_statement_from_invoice(osv.osv_memory):
|
|||
args_move_line.append(('partner_id','=',st_line.partner_id.id))
|
||||
args_move_line.append(('account_id','=',st_line.account_id.id))
|
||||
|
||||
move_line_id = line_obj.search(cr, uid, args_move_line,context=context)
|
||||
move_line_id = line_obj.search(cr, uid, args_move_line, context=context)
|
||||
if move_line_id:
|
||||
repeated_move_line_ids += move_line_id
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class account_use_model(osv.osv_memory):
|
|||
_name = 'account.use.model'
|
||||
_description = 'Use model'
|
||||
_columns = {
|
||||
'model': fields.many2many('account.model', 'account_use_model_relation','account_id','model_id','Account Model'),
|
||||
'model': fields.many2many('account.model', 'account_use_model_relation', 'account_id', 'model_id', 'Account Model'),
|
||||
}
|
||||
|
||||
def create_entries(self, cr, uid, ids, context=None):
|
||||
|
@ -41,12 +41,12 @@ class account_use_model(osv.osv_memory):
|
|||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
data = self.read(cr, uid, ids, context=context)[0]
|
||||
record_id = context and context.get('model_line', False) or False
|
||||
if record_id:
|
||||
data_model = account_model_obj.browse(cr,uid,data['model'])
|
||||
data_model = account_model_obj.browse(cr, uid, data['model'])
|
||||
else:
|
||||
data_model = account_model_obj.browse(cr,uid,context['active_ids'])
|
||||
data_model = account_model_obj.browse(cr, uid, context['active_ids'])
|
||||
move_ids = []
|
||||
for model in data_model:
|
||||
period_id = account_period_obj.find(cr, uid, context=context)
|
||||
|
|
|
@ -183,7 +183,7 @@ class account_analytic_account(osv.osv):
|
|||
on (hr.id=a.to_invoice) \
|
||||
where account_analytic_line.account_id IN %s \
|
||||
and a.to_invoice IS NOT NULL \
|
||||
and account_analytic_journal.type in ('purchase','general')
|
||||
and account_analytic_journal.type IN ('purchase','general')
|
||||
GROUP BY account_analytic_line.account_id""",(parent_ids,))
|
||||
for account_id, sum in cr.fetchall():
|
||||
res2[account_id] = round(sum,2)
|
||||
|
@ -485,9 +485,9 @@ class account_analytic_account_summary_user(osv.osv):
|
|||
for i in range(0, len(ids), cr.IN_MAX):
|
||||
sub_ids = ids[i:i+cr.IN_MAX]
|
||||
if d1:
|
||||
cr.execute('select %s from \"%s\" where id in (%s) ' \
|
||||
'and account_id in (%s) ' \
|
||||
'and "user" in (%s) and %s order by %s' % \
|
||||
cr.execute('select %s from \"%s\" where id IN (%s) ' \
|
||||
'and account_id IN (%s) ' \
|
||||
'and "user" IN (%s) and %s order by %s' % \
|
||||
(','.join(fields_pre2 + ['id']), self._table,
|
||||
','.join([str(x) for x in sub_ids]),
|
||||
','.join([str(x/max_user - (x%max_user == 0 and 1 or 0)) for x in sub_ids]),
|
||||
|
@ -497,9 +497,9 @@ class account_analytic_account_summary_user(osv.osv):
|
|||
raise except_orm(_('AccessError'),
|
||||
_('You try to bypass an access rule (Document type: %s).') % self._description)
|
||||
else:
|
||||
cr.execute('select %s from \"%s\" where id in (%s) ' \
|
||||
'and account_id in (%s) ' \
|
||||
'and "user" in (%s) order by %s' % \
|
||||
cr.execute('select %s from \"%s\" where id IN (%s) ' \
|
||||
'and account_id IN (%s) ' \
|
||||
'and "user" IN (%s) order by %s' % \
|
||||
(','.join(fields_pre2 + ['id']), self._table,
|
||||
','.join([str(x) for x in sub_ids]),
|
||||
','.join([str(x/max_user - (x%max_user == 0 and 1 or 0)) for x in sub_ids]),
|
||||
|
@ -661,9 +661,9 @@ class account_analytic_account_summary_month(osv.osv):
|
|||
for i in range(0, len(ids), cr.IN_MAX):
|
||||
sub_ids = ids[i:i+cr.IN_MAX]
|
||||
if d1:
|
||||
cr.execute('select %s from \"%s\" where id in (%s) ' \
|
||||
'and account_id in (%s) ' \
|
||||
'and month_id in (%s) and %s order by %s' % \
|
||||
cr.execute('select %s from \"%s\" where id IN (%s) ' \
|
||||
'and account_id IN (%s) ' \
|
||||
'and month_id IN (%s) and %s order by %s' % \
|
||||
(','.join(fields_pre2 + ['id']), self._table,
|
||||
','.join([str(x) for x in sub_ids]),
|
||||
','.join([str(x)[:-6] for x in sub_ids]),
|
||||
|
@ -673,9 +673,9 @@ class account_analytic_account_summary_month(osv.osv):
|
|||
raise except_orm(_('AccessError'),
|
||||
_('You try to bypass an access rule (Document type: %s).') % self._description)
|
||||
else:
|
||||
cr.execute('select %s from \"%s\" where id in (%s) ' \
|
||||
'and account_id in (%s) ' \
|
||||
'and month_id in (%s) order by %s' % \
|
||||
cr.execute('select %s from \"%s\" where id IN (%s) ' \
|
||||
'and account_id IN (%s) ' \
|
||||
'and month_id IN (%s) order by %s' % \
|
||||
(','.join(fields_pre2 + ['id']), self._table,
|
||||
','.join([str(x) for x in sub_ids]),
|
||||
','.join([str(x)[:-6] for x in sub_ids]),
|
||||
|
|
|
@ -83,16 +83,16 @@ class account_analytic_plan_instance(osv.osv):
|
|||
_name='account.analytic.plan.instance'
|
||||
_description = 'Analytic Plan Instance'
|
||||
_columns={
|
||||
'name':fields.char('Analytic Distribution',size=64),
|
||||
'code':fields.char('Distribution Code',size=16),
|
||||
'name':fields.char('Analytic Distribution', size=64),
|
||||
'code':fields.char('Distribution Code', size=16),
|
||||
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal' ),
|
||||
'account_ids':fields.one2many('account.analytic.plan.instance.line','plan_id','Account Id'),
|
||||
'account1_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account1 Id'),
|
||||
'account2_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account2 Id'),
|
||||
'account3_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account3 Id'),
|
||||
'account4_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account4 Id'),
|
||||
'account5_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account5 Id'),
|
||||
'account6_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account6 Id'),
|
||||
'account_ids':fields.one2many('account.analytic.plan.instance.line', 'plan_id', 'Account Id'),
|
||||
'account1_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account1 Id'),
|
||||
'account2_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account2 Id'),
|
||||
'account3_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account3 Id'),
|
||||
'account4_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account4 Id'),
|
||||
'account5_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account5 Id'),
|
||||
'account6_ids':one2many_mod2('account.analytic.plan.instance.line', 'plan_id', 'Account6 Id'),
|
||||
'plan_id':fields.many2one('account.analytic.plan', "Model's Plan"),
|
||||
}
|
||||
|
||||
|
@ -184,21 +184,21 @@ class account_analytic_plan_instance(osv.osv):
|
|||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context and 'journal_id' in context:
|
||||
journal= self.pool.get('account.journal').browse(cr,uid,context['journal_id'])
|
||||
journal= self.pool.get('account.journal').browse(cr, uid, context['journal_id'])
|
||||
|
||||
pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)])
|
||||
if pids:
|
||||
raise osv.except_osv(_('Error'), _('A model having this name and code already exists !'))
|
||||
|
||||
res = self.pool.get('account.analytic.plan.line').search(cr,uid,[('plan_id','=',journal.plan_id.id)])
|
||||
res = self.pool.get('account.analytic.plan.line').search(cr, uid, [('plan_id','=',journal.plan_id.id)])
|
||||
for i in res:
|
||||
total_per_plan = 0
|
||||
item = self.pool.get('account.analytic.plan.line').browse(cr,uid,i)
|
||||
item = self.pool.get('account.analytic.plan.line').browse(cr, uid, i)
|
||||
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
||||
for l in temp_list:
|
||||
if vals.has_key(l):
|
||||
for tempo in vals[l]:
|
||||
if self.pool.get('account.analytic.account').search(cr,uid,[('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||
if self.pool.get('account.analytic.account').search(cr, uid, [('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||
total_per_plan += tempo[2]['rate']
|
||||
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||
raise osv.except_osv(_('Value Error') ,_('The Total Should be Between %s and %s') % (str(item.min_required), str(item.max_required)))
|
||||
|
@ -206,13 +206,13 @@ class account_analytic_plan_instance(osv.osv):
|
|||
return super(account_analytic_plan_instance, self).create(cr, uid, vals, context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context={}, check=True, update_check=True):
|
||||
this = self.browse(cr,uid,ids[0])
|
||||
this = self.browse(cr, uid, ids[0])
|
||||
if this.plan_id and not vals.has_key('plan_id'):
|
||||
#this instance is a model, so we have to create a new plan instance instead of modifying it
|
||||
#copy the existing model
|
||||
temp_id = self.copy(cr, uid, this.id, None, context)
|
||||
#get the list of the invoice line that were linked to the model
|
||||
list = self.pool.get('account.invoice.line').search(cr,uid,[('analytics_id','=',this.id)])
|
||||
list = self.pool.get('account.invoice.line').search(cr, uid, [('analytics_id','=',this.id)])
|
||||
#make them link to the copy
|
||||
self.pool.get('account.invoice.line').write(cr, uid, list, {'analytics_id':temp_id}, context)
|
||||
|
||||
|
@ -230,8 +230,8 @@ class account_analytic_plan_instance_line(osv.osv):
|
|||
_name='account.analytic.plan.instance.line'
|
||||
_description = 'Analytic Instance Line'
|
||||
_columns={
|
||||
'plan_id':fields.many2one('account.analytic.plan.instance','Plan Id'),
|
||||
'analytic_account_id':fields.many2one('account.analytic.account','Analytic Account', required=True),
|
||||
'plan_id':fields.many2one('account.analytic.plan.instance', 'Plan Id'),
|
||||
'analytic_account_id':fields.many2one('account.analytic.account', 'Analytic Account', required=True),
|
||||
'rate':fields.float('Rate (%)', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -252,7 +252,7 @@ class account_journal(osv.osv):
|
|||
_inherit='account.journal'
|
||||
_name='account.journal'
|
||||
_columns = {
|
||||
'plan_id':fields.many2one('account.analytic.plan','Analytic Plans'),
|
||||
'plan_id':fields.many2one('account.analytic.plan', 'Analytic Plans'),
|
||||
}
|
||||
account_journal()
|
||||
|
||||
|
@ -260,7 +260,7 @@ class account_invoice_line(osv.osv):
|
|||
_inherit='account.invoice.line'
|
||||
_name='account.invoice.line'
|
||||
_columns = {
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
|
@ -286,7 +286,7 @@ class account_move_line(osv.osv):
|
|||
_inherit='account.move.line'
|
||||
_name='account.move.line'
|
||||
_columns = {
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
||||
}
|
||||
|
||||
def _default_get_move_form_hook(self, cursor, user, data):
|
||||
|
@ -355,7 +355,7 @@ class account_invoice(osv.osv):
|
|||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
obj_move_line=self.pool.get('account.analytic.plan.instance').browse(cr,uid,il['analytics_id'])
|
||||
obj_move_line=self.pool.get('account.analytic.plan.instance').browse(cr, uid, il['analytics_id'])
|
||||
amount_calc=cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
||||
qty=il['quantity']
|
||||
il['analytic_lines']=[]
|
||||
|
|
|
@ -37,7 +37,7 @@ class analytic_plan_create_model(osv.osv_memory):
|
|||
raise osv.except_osv(_('Error'), _('No analytic plan defined !'))
|
||||
plan_obj.write(cr, uid, [context['active_id']], {'plan_id':pids[0]})
|
||||
|
||||
model_data_ids = mod_obj.search(cr,uid,[('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context)
|
||||
model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'),('name', '=', 'view_analytic_plan_create_model')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'name': _('Distribution Model Saved'),
|
||||
|
|
|
@ -157,17 +157,17 @@ class account_invoice(osv.osv):
|
|||
def _refund_cleanup_lines(self, cr, uid, lines):
|
||||
for line in lines:
|
||||
inv_id = line['invoice_id']
|
||||
inv_obj = self.browse(cr,uid,inv_id[0])
|
||||
inv_obj = self.browse(cr, uid, inv_id[0])
|
||||
if inv_obj.type == 'in_invoice':
|
||||
if line.get('product_id',False):
|
||||
product_obj = self.pool.get('product.product').browse(cr,uid,line['product_id'][0])
|
||||
product_obj = self.pool.get('product.product').browse(cr, uid, line['product_id'][0])
|
||||
oa = product_obj.product_tmpl_id.property_stock_account_output and product_obj.product_tmpl_id.property_stock_account_output.id
|
||||
if not oa:
|
||||
oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
|
||||
if oa:
|
||||
fpos = inv_obj.fiscal_position or False
|
||||
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
|
||||
account_data = self.pool.get('account.account').read(cr,uid,[a],['name'])[0]
|
||||
account_data = self.pool.get('account.account').read(cr, uid, [a], ['name'])[0]
|
||||
line.update({'account_id': (account_data['id'],account_data['name'])})
|
||||
res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines)
|
||||
return res
|
||||
|
|
|
@ -72,7 +72,7 @@ class account_budget_post_dotation(osv.osv):
|
|||
res={}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
if line.period_id:
|
||||
obj_period=self.pool.get('account.period').browse(cr, uid,line.period_id.id)
|
||||
obj_period=self.pool.get('account.period').browse(cr, uid, line.period_id.id)
|
||||
|
||||
total_days=strToDate(obj_period.date_stop) - strToDate(obj_period.date_start)
|
||||
budget_id=line.post_id and line.post_id.id or False
|
||||
|
@ -84,7 +84,7 @@ class account_budget_post_dotation(osv.osv):
|
|||
|
||||
tot_planned=0.00
|
||||
for record in res1:
|
||||
obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid,record[0])
|
||||
obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid, record[0])
|
||||
count_days = min(strToDate(obj_period.date_stop),strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from))
|
||||
days_in_period = count_days.days +1
|
||||
count_days = strToDate(obj_lines.date_to) - strToDate(obj_lines.date_from)
|
||||
|
@ -102,7 +102,7 @@ class account_budget_post_dotation(osv.osv):
|
|||
'post_id': fields.many2one('account.budget.post', 'Item', select=True),
|
||||
'period_id': fields.many2one('account.period', 'Period'),
|
||||
'amount': fields.float('Amount', digits=(16,2)),
|
||||
'tot_planned':fields.function(_tot_planned,method=True, string='Total Planned Amount',type='float',store=True),
|
||||
'tot_planned':fields.function(_tot_planned, method=True, string='Total Planned Amount', type='float', store=True),
|
||||
}
|
||||
|
||||
account_budget_post_dotation()
|
||||
|
@ -114,12 +114,12 @@ class crossovered_budget(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.char('Name', size=50, required=True,states={'done':[('readonly',True)]}),
|
||||
'code': fields.char('Code', size=20, required=True,states={'done':[('readonly',True)]}),
|
||||
'creating_user_id': fields.many2one('res.users','Responsible User'),
|
||||
'validating_user_id': fields.many2one('res.users','Validate User', readonly=True),
|
||||
'date_from': fields.date('Start Date',required=True,states={'done':[('readonly',True)]}),
|
||||
'date_to': fields.date('End Date',required=True,states={'done':[('readonly',True)]}),
|
||||
'creating_user_id': fields.many2one('res.users', 'Responsible User'),
|
||||
'validating_user_id': fields.many2one('res.users', 'Validate User', readonly=True),
|
||||
'date_from': fields.date('Start Date', required=True, states={'done':[('readonly',True)]}),
|
||||
'date_to': fields.date('End Date', required=True, states={'done':[('readonly',True)]}),
|
||||
'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'Status', select=True, required=True, readonly=True),
|
||||
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines',states={'done':[('readonly',True)]} ),
|
||||
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines', states={'done':[('readonly',True)]} ),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -186,10 +186,10 @@ class crossovered_budget_lines(osv.osv):
|
|||
res[line.id] = result
|
||||
return res
|
||||
|
||||
def _prac(self, cr, uid, ids,name,args,context):
|
||||
def _prac(self, cr, uid, ids, name, args, context):
|
||||
res={}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
res[line.id]=self._prac_amt(cr,uid,[line.id],context=context)[line.id]
|
||||
res[line.id]=self._prac_amt(cr, uid, [line.id], context=context)[line.id]
|
||||
|
||||
return res
|
||||
|
||||
|
@ -223,14 +223,14 @@ class crossovered_budget_lines(osv.osv):
|
|||
res[line.id]=theo_amt
|
||||
return res
|
||||
|
||||
def _theo(self, cr, uid, ids,name,args,context):
|
||||
def _theo(self, cr, uid, ids, name, args, context):
|
||||
res={}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
res[line.id]=self._theo_amt(cr,uid,[line.id],context=context)[line.id]
|
||||
res[line.id]=self._theo_amt(cr, uid, [line.id], context=context)[line.id]
|
||||
|
||||
return res
|
||||
|
||||
def _perc(self, cr, uid, ids,name,args,context):
|
||||
def _perc(self, cr, uid, ids, name, args, context):
|
||||
res = {}
|
||||
for line in self.browse(cr, uid, ids):
|
||||
if line.theoritical_amount<>0.00:
|
||||
|
@ -244,13 +244,13 @@ class crossovered_budget_lines(osv.osv):
|
|||
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget', ondelete='cascade', select=True, required=True),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account',required=True),
|
||||
'general_budget_id': fields.many2one('account.budget.post', 'Budgetary Position',required=True),
|
||||
'date_from': fields.date('Start Date',required=True),
|
||||
'date_to': fields.date('End Date',required=True),
|
||||
'date_from': fields.date('Start Date', required=True),
|
||||
'date_to': fields.date('End Date', required=True),
|
||||
'paid_date': fields.date('Paid Date'),
|
||||
'planned_amount':fields.float('Planned Amount',required=True,digits=(16,2)),
|
||||
'practical_amount':fields.function(_prac,method=True, string='Practical Amount',type='float',digits=(16,2)),
|
||||
'theoritical_amount':fields.function(_theo,method=True, string='Theoritical Amount',type='float',digits=(16,2)),
|
||||
'percentage':fields.function(_perc,method=True, string='Percentage',type='float'),
|
||||
'planned_amount':fields.float('Planned Amount', required=True, digits=(16,2)),
|
||||
'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)),
|
||||
'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)),
|
||||
'percentage':fields.function(_perc, method=True, string='Percentage', type='float'),
|
||||
}
|
||||
crossovered_budget_lines()
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
})
|
||||
self.context=context
|
||||
|
||||
def funct(self,object,form,ids={}, done=None, level=1):
|
||||
def funct(self, object, form, ids={}, done=None, level=1):
|
||||
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
|
@ -78,7 +78,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
context={'wizard_date_from':d_from,'wizard_date_to':d_to}
|
||||
for i in range(0,len(an_ids)):
|
||||
|
||||
analytic_name=self.pool.get('account.analytic.account').browse(self.cr, self.uid,[an_ids[i][0]])
|
||||
analytic_name=self.pool.get('account.analytic.account').browse(self.cr, self.uid, [an_ids[i][0]])
|
||||
|
||||
res={
|
||||
'b_id':'-1',
|
||||
|
@ -94,7 +94,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
|
||||
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])])
|
||||
|
||||
line_id = c_b_lines_obj.browse(self.cr,self.uid,line_ids)
|
||||
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
|
||||
tot_theo=tot_pln=tot_prac=tot_perc=0.00
|
||||
|
||||
done_budget=[]
|
||||
|
@ -194,7 +194,7 @@ class budget_report(report_sxw.rml_parse):
|
|||
tot['perc']=float(tot['prac'] /tot['theo'])*100
|
||||
return result
|
||||
|
||||
def funct_total(self,form):
|
||||
def funct_total(self, form):
|
||||
result=[]
|
||||
res={}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class account_budget_report(osv.osv_memory):
|
|||
'form': data
|
||||
}
|
||||
|
||||
data_model = self.pool.get(datas['model']).browse(cr,uid,context['active_id'])
|
||||
data_model = self.pool.get(datas['model']).browse(cr, uid, context['active_id'])
|
||||
if not data_model.dotation_ids:
|
||||
raise osv.except_osv(_('Insufficient Data!'),_('No Depreciation or Master Budget Expenses Found on Budget %s!') % data_model.name)
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class account_budget_spread(osv.osv_memory):
|
|||
_name = 'account.budget.spread'
|
||||
_description = 'Account Budget spread '
|
||||
_columns = {
|
||||
'fiscalyear': fields.many2one('account.fiscalyear','Fiscal Year', required=True),
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True),
|
||||
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ class account_coda(osv.osv):
|
|||
'name': fields.binary('Coda file', readonly=True),
|
||||
'statement_ids': fields.one2many('account.bank.statement','coda_id','Generated Bank Statement', readonly=True),
|
||||
'note': fields.text('Import log', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal','Bank Journal', readonly=True,select=True),
|
||||
'date': fields.date('Import Date', readonly=True,select=True),
|
||||
'journal_id': fields.many2one('account.journal','Bank Journal', readonly=True, select=True),
|
||||
'date': fields.date('Import Date', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users','User', readonly=True, select=True),
|
||||
}
|
||||
_defaults = {
|
||||
|
|
|
@ -121,7 +121,7 @@ def _coda_parsing(self, cr, uid, data, context):
|
|||
bank_statement_lines = {}
|
||||
bank_statement['date'] = str2date(line[5:11])
|
||||
bank_statement['journal_id']=data['form']['journal_id']
|
||||
period_id = pool.get('account.period').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")))])
|
||||
period_id = pool.get('account.period').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[0]
|
||||
bank_statement['state']='draft'
|
||||
elif line[0] == '1':
|
||||
|
@ -176,10 +176,10 @@ def _coda_parsing(self, cr, uid, data, context):
|
|||
st_line_partner_acc = str(line[10:47]).strip()
|
||||
cntry_number=line[10:47].strip()
|
||||
contry_name=line[47:125].strip()
|
||||
bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line_partner_acc)])
|
||||
bank_ids = pool.get('res.partner.bank').search(cr, uid, [('acc_number','=',st_line_partner_acc)])
|
||||
bank_statement_lines[st_line_name].update({'cntry_number': cntry_number, 'contry_name': contry_name})
|
||||
if bank_ids:
|
||||
bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context)
|
||||
bank = pool.get('res.partner.bank').browse(cr, uid, bank_ids[0], context)
|
||||
if line and bank.partner_id:
|
||||
bank_statement_lines[st_line_name].update({'partner_id': bank.partner_id.id})
|
||||
if bank_statement_lines[st_line_name]['amount'] < 0 :
|
||||
|
@ -274,7 +274,7 @@ def _coda_parsing(self, cr, uid, data, context):
|
|||
err_log += '\n\nNumber of statements : '+ str(len(bkst_list))
|
||||
err_log += '\nNumber of error :'+ str(nb_err) +'\n'
|
||||
|
||||
pool.get('account.coda').create(cr, uid,{
|
||||
pool.get('account.coda').create(cr, uid, {
|
||||
'name':codafile,
|
||||
'statement_ids': [(6, 0, bkst_list,)],
|
||||
'note':str_log1+str_not+std_log+err_log,
|
||||
|
|
|
@ -178,7 +178,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
msg_unsent = ''
|
||||
count = 0
|
||||
data_user = user_obj.browse(cr, uid, uid)
|
||||
move_lines = line_obj.browse(cr,uid,data['partner_ids'][0][2])
|
||||
move_lines = line_obj.browse(cr, uid, data['partner_ids'][0][2])
|
||||
partners = []
|
||||
dict_lines = {}
|
||||
for line in move_lines:
|
||||
|
@ -186,7 +186,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
dict_lines[line.name.id] =line
|
||||
for partner in partners:
|
||||
ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable'])])
|
||||
data_lines = move_obj.browse(cr,uid,ids_lines)
|
||||
data_lines = move_obj.browse(cr, uid, ids_lines)
|
||||
followup_data = dict_lines[partner.id]
|
||||
dest = False
|
||||
if partner.address:
|
||||
|
|
|
@ -26,8 +26,8 @@ class notify_message(osv.osv):
|
|||
_name = 'notify.message'
|
||||
_description = 'Notify By Messages'
|
||||
_columns = {
|
||||
'name' : fields.char('Title',size=64,required=True),
|
||||
'msg' : fields.text('Special Message',size=125,required=True,help='This notification will appear at the bottom of the Invoices when printed.',translate=True)
|
||||
'name' : fields.char('Title', size=64, required=True),
|
||||
'msg' : fields.text('Special Message', size=125, required=True, help='This notification will appear at the bottom of the Invoices when printed.', translate=True)
|
||||
}
|
||||
|
||||
notify_message()
|
||||
|
|
|
@ -43,7 +43,7 @@ class account_invoice_1(report_sxw.rml_parse):
|
|||
ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])
|
||||
ids.sort()
|
||||
for id in range(0,len(ids)):
|
||||
info = self.pool.get('account.invoice.line').browse(self.cr, self.uid,ids[id], self.context.copy())
|
||||
info = self.pool.get('account.invoice.line').browse(self.cr, self.uid, ids[id], self.context.copy())
|
||||
list_in_seq[info]=info.sequence
|
||||
i=1
|
||||
j=0
|
||||
|
@ -80,7 +80,7 @@ class account_invoice_1(report_sxw.rml_parse):
|
|||
if entry.uos_id.id==False:
|
||||
res['uos']=''
|
||||
else:
|
||||
uos_name = self.pool.get('product.uom').read(self.cr,self.uid,entry.uos_id.id,['name'],self.context.copy())
|
||||
uos_name = self.pool.get('product.uom').read(self.cr, self.uid, entry.uos_id.id, ['name'], self.context.copy())
|
||||
res['uos'] = uos_name['name']
|
||||
else:
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class account_invoice_with_message(report_sxw.rml_parse):
|
|||
if entry.uos_id.id==False:
|
||||
res['uos']=''
|
||||
else:
|
||||
uos_name = self.pool.get('product.uom').read(self.cr,self.uid,entry.uos_id.id,['name'],self.context.copy())
|
||||
uos_name = self.pool.get('product.uom').read(self.cr, self.uid, entry.uos_id.id, ['name'], self.context.copy())
|
||||
res['uos']=uos_name['name']
|
||||
else:
|
||||
|
||||
|
|
|
@ -30,11 +30,11 @@ class payment_type(osv.osv):
|
|||
_name= 'payment.type'
|
||||
_description= 'Payment Type'
|
||||
_columns= {
|
||||
'name': fields.char('Name', size=64, required=True,help='Payment Type'),
|
||||
'code': fields.char('Code', size=64, required=True,help='Specifies the Code for Payment Type'),
|
||||
'name': fields.char('Name', size=64, required=True, help='Payment Type'),
|
||||
'code': fields.char('Code', size=64, required=True, help='Specifies the Code for Payment Type'),
|
||||
'suitable_bank_types': fields.many2many('res.partner.bank.type',
|
||||
'bank_type_payment_type_rel',
|
||||
'pay_type_id','bank_type_id',
|
||||
'pay_type_id', 'bank_type_id',
|
||||
'Suitable bank types')
|
||||
}
|
||||
|
||||
|
@ -45,15 +45,15 @@ class payment_mode(osv.osv):
|
|||
_name= 'payment.mode'
|
||||
_description= 'Payment Mode'
|
||||
_columns= {
|
||||
'name': fields.char('Name', size=64, required=True,help='Mode of Payment'),
|
||||
'name': fields.char('Name', size=64, required=True, help='Mode of Payment'),
|
||||
'bank_id': fields.many2one('res.partner.bank', "Bank account",
|
||||
required=True,help='Bank Account for the Payment Mode'),
|
||||
'journal': fields.many2one('account.journal', 'Journal', required=True,
|
||||
domain=[('type', '=', 'cash')],help='Cash Journal for the Payment Mode'),
|
||||
'type': fields.many2one('payment.type','Payment type',required=True,help='Select the Payment Type for the Payment Mode.'),
|
||||
domain=[('type', '=', 'cash')], help='Cash Journal for the Payment Mode'),
|
||||
'type': fields.many2one('payment.type', 'Payment type', required=True, help='Select the Payment Type for the Payment Mode.'),
|
||||
}
|
||||
|
||||
def suitable_bank_types(self,cr,uid,payment_code=None,context={}):
|
||||
def suitable_bank_types(self, cr, uid, payment_code=None, context={}):
|
||||
"""Return the codes of the bank type that are suitable
|
||||
for the given payment type code"""
|
||||
if not payment_code:
|
||||
|
@ -101,10 +101,10 @@ class payment_order(osv.osv):
|
|||
('cancel','Cancelled'),
|
||||
('done','Done')], 'State', select=True,
|
||||
help='When an order is placed the state is \'Draft\'.\n Once the bank is confirmed the state is set to \'Confirmed\'.\n Then the order is paid the state is \'Done\'.'),
|
||||
'line_ids': fields.one2many('payment.line','order_id','Payment lines',states={'done':[('readonly',True)]}),
|
||||
'line_ids': fields.one2many('payment.line', 'order_id', 'Payment lines', states={'done':[('readonly',True)]}),
|
||||
'total': fields.function(_total, string="Total", method=True,
|
||||
type='float'),
|
||||
'user_id': fields.many2one('res.users','User', required=True, states={'done':[('readonly',True)]}),
|
||||
'user_id': fields.many2one('res.users', 'User', required=True, states={'done':[('readonly',True)]}),
|
||||
'date_prefered': fields.selection([
|
||||
('now', 'Directly'),
|
||||
('due', 'Due date'),
|
||||
|
@ -130,10 +130,10 @@ class payment_order(osv.osv):
|
|||
return True
|
||||
|
||||
def action_open(self, cr, uid, ids, *args):
|
||||
for order in self.read(cr,uid,ids,['reference']):
|
||||
for order in self.read(cr, uid, ids, ['reference']):
|
||||
if not order['reference']:
|
||||
reference = self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
|
||||
self.write(cr,uid,order['id'],{'reference':reference})
|
||||
self.write(cr, uid, order['id'],{'reference':reference})
|
||||
return True
|
||||
|
||||
def set_done(self, cr, uid, id, *args):
|
||||
|
@ -169,7 +169,7 @@ class payment_line(osv.osv):
|
|||
st=ads.street and ads.street or ''
|
||||
st1=ads.street2 and ads.street2 or ''
|
||||
if 'zip_id' in ads:
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||
else:
|
||||
zip=ads.zip and ads.zip or ''
|
||||
city= ads.city and ads.city or ''
|
||||
|
@ -195,7 +195,7 @@ class payment_line(osv.osv):
|
|||
st=ads.street and ads.street or ''
|
||||
st1=ads.street2 and ads.street2 or ''
|
||||
if 'zip_id' in ads:
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||
else:
|
||||
zip=ads.zip and ads.zip or ''
|
||||
city= ads.city and ads.city or ''
|
||||
|
@ -220,8 +220,8 @@ class payment_line(osv.osv):
|
|||
|
||||
if name == 'partner_id':
|
||||
partner_name = {}
|
||||
for p_id, p_name in partner_obj.name_get(cr,uid,
|
||||
filter(lambda x:x and x != 0,res.values()),context=context):
|
||||
for p_id, p_name in partner_obj.name_get(cr, uid,
|
||||
filter(lambda x:x and x != 0,res.values()), context=context):
|
||||
partner_name[p_id] = p_name
|
||||
|
||||
for id in ids:
|
||||
|
@ -298,28 +298,28 @@ class payment_line(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'name': fields.char('Your Reference', size=64, required=True),
|
||||
'communication': fields.char('Communication', size=64, required=True,help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
|
||||
'communication2': fields.char('Communication 2', size=64,help='The successor message of Communication.'),
|
||||
'move_line_id': fields.many2one('account.move.line','Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')],help='This Entry Line will be referred for the information of the ordering customer.'),
|
||||
'communication': fields.char('Communication', size=64, required=True, help="Used as the message between ordering customer and current company. Depicts 'What do you want to say to the recipient about this order ?'"),
|
||||
'communication2': fields.char('Communication 2', size=64, help='The successor message of Communication.'),
|
||||
'move_line_id': fields.many2one('account.move.line', 'Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')], help='This Entry Line will be referred for the information of the ordering customer.'),
|
||||
'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2),
|
||||
required=True, help='Payment amount in the partner currency'),
|
||||
'currency': fields.many2one('res.currency','Partner Currency',required=True),
|
||||
'company_currency': fields.many2one('res.currency','Company Currency',readonly=True),
|
||||
'currency': fields.many2one('res.currency','Partner Currency', required=True),
|
||||
'company_currency': fields.many2one('res.currency', 'Company Currency', readonly=True),
|
||||
'bank_id': fields.many2one('res.partner.bank', 'Destination Bank account'),
|
||||
'order_id': fields.many2one('payment.order', 'Order', required=True,
|
||||
ondelete='cascade', select=True),
|
||||
'partner_id': fields.many2one('res.partner', string="Partner",required=True,help='The Ordering Customer'),
|
||||
'partner_id': fields.many2one('res.partner', string="Partner", required=True, help='The Ordering Customer'),
|
||||
'amount': fields.function(_amount, string='Amount in Company Currency',
|
||||
method=True, type='float',
|
||||
help='Payment amount in the company currency'),
|
||||
'ml_date_created': fields.function(_get_ml_created_date, string="Effective Date",
|
||||
method=True, type='date',help="Invoice Effective Date"),
|
||||
method=True, type='date', help="Invoice Effective Date"),
|
||||
'ml_maturity_date': fields.function(_get_ml_maturity_date, method=True, type='date', string='Maturity Date'),
|
||||
'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='many2one', relation='account.invoice', string='Invoice Ref.'),
|
||||
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text",help='Address of the Main Partner'),
|
||||
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text",help='Address of the Ordering Customer.'),
|
||||
'date': fields.date('Payment Date',help="If no payment date is specified, the bank will treat this payment line directly"),
|
||||
'create_date': fields.datetime('Created' ,readonly=True),
|
||||
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text", help='Address of the Main Partner'),
|
||||
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text", help='Address of the Ordering Customer.'),
|
||||
'date': fields.date('Payment Date', help="If no payment date is specified, the bank will treat this payment line directly"),
|
||||
'create_date': fields.datetime('Created' , readonly=True),
|
||||
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -333,13 +333,13 @@ class payment_line(osv.osv):
|
|||
('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),
|
||||
]
|
||||
|
||||
def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,currency=False,company_currency=False,context=None):
|
||||
def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_planned, currency=False, company_currency=False, context=None):
|
||||
data={}
|
||||
|
||||
data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
|
||||
|
||||
if move_line_id:
|
||||
line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
|
||||
line = self.pool.get('account.move.line').browse(cr, uid, move_line_id)
|
||||
data['amount_currency']=line.amount_to_pay
|
||||
|
||||
res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
|
||||
|
@ -355,7 +355,7 @@ class payment_line(osv.osv):
|
|||
data['currency'] = temp
|
||||
|
||||
# calling onchange of partner and updating data dictionary
|
||||
temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type)
|
||||
temp_dict=self.onchange_partner(cr, uid, ids, line.partner_id.id, payment_type)
|
||||
data.update(temp_dict['value'])
|
||||
|
||||
data['reference']=line.ref
|
||||
|
@ -381,12 +381,12 @@ class payment_line(osv.osv):
|
|||
res['amount'] = company_amount
|
||||
return {'value': res}
|
||||
|
||||
def onchange_partner(self,cr,uid,ids,partner_id,payment_type,context=None):
|
||||
def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
|
||||
data={}
|
||||
data['info_partner']=data['bank_id']=False
|
||||
|
||||
if partner_id:
|
||||
part_obj=self.pool.get('res.partner').browse(cr,uid,partner_id)
|
||||
part_obj=self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
partner=part_obj.name or ''
|
||||
|
||||
if part_obj.address:
|
||||
|
@ -396,7 +396,7 @@ class payment_line(osv.osv):
|
|||
st1=ads.street2 and ads.street2 or ''
|
||||
|
||||
if 'zip_id' in ads:
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr,uid,[ads.zip_id.id])[0][1] or ''
|
||||
zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
|
||||
else:
|
||||
zip=ads.zip and ads.zip or ''
|
||||
city= ads.city and ads.city or ''
|
||||
|
|
|
@ -61,7 +61,7 @@ class account_report(osv.osv):
|
|||
if key==0:
|
||||
return obj.find(cr, uid, exception=False)
|
||||
else:
|
||||
obj_key=obj.browse(cr,uid,obj.find(cr, uid, exception=False))
|
||||
obj_key=obj.browse(cr, uid, obj.find(cr, uid, exception=False))
|
||||
if isinstance(obj_key,list):
|
||||
obj_key=obj_key[0]
|
||||
key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)])
|
||||
|
@ -69,8 +69,8 @@ class account_report(osv.osv):
|
|||
return False
|
||||
return key_ids[key]
|
||||
|
||||
def _calc_credit(code,year=0):
|
||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||
def _calc_credit(code, year=0):
|
||||
context['fiscalyear']=_calc_context(year, obj_fy)
|
||||
if not context['fiscalyear']:
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
|
@ -78,7 +78,7 @@ class account_report(osv.osv):
|
|||
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_debit(code,year=0):
|
||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||
context['fiscalyear']=_calc_context(year, obj_fy)
|
||||
if not context['fiscalyear']:
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
|
@ -86,7 +86,7 @@ class account_report(osv.osv):
|
|||
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_balance(code,year=0):
|
||||
context['fiscalyear']=_calc_context(year,obj_fy)
|
||||
context['fiscalyear']=_calc_context(year, obj_fy)
|
||||
if not context['fiscalyear']:
|
||||
del context['fiscalyear']
|
||||
acc = self.pool.get('account.account')
|
||||
|
@ -102,7 +102,7 @@ class account_report(osv.osv):
|
|||
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0.0)
|
||||
|
||||
def _calc_tax_code(code,period=0):
|
||||
context['period_id']=_calc_context(period,obj_period)
|
||||
context['period_id']=_calc_context(period, obj_period)
|
||||
if not context['period_id']:
|
||||
return 0.00
|
||||
context['period_id']=context['period_id'][0]
|
||||
|
@ -145,7 +145,7 @@ class account_report(osv.osv):
|
|||
def onchange_parent_id(self, cr, uid, ids, parent_id):
|
||||
v={}
|
||||
if parent_id:
|
||||
acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
|
||||
acc=self.pool.get('account.report.report').browse(cr, uid, parent_id)
|
||||
v['type']=acc.type
|
||||
# if int(acc.style) < 6:
|
||||
# v['style'] = str(int(acc.style)+1)
|
||||
|
@ -163,8 +163,8 @@ class account_report(osv.osv):
|
|||
('other','Others')],
|
||||
'Type', required=True),
|
||||
'expression': fields.char('Expression', size=240, required=True),
|
||||
'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2),help='This Value sets the limit of badness.'),
|
||||
'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2),help='This Value sets the limit of goodness.'),
|
||||
'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2), help='This Value sets the limit of badness.'),
|
||||
'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2), help='This Value sets the limit of goodness.'),
|
||||
'parent_id': fields.many2one('account.report.report', 'Parent'),
|
||||
'child_ids': fields.one2many('account.report.report', 'parent_id', 'Children'),
|
||||
'note': fields.text('Note'),
|
||||
|
@ -180,8 +180,8 @@ class account_report(osv.osv):
|
|||
('very good', 'Very Good')
|
||||
],
|
||||
string='Status'),
|
||||
'disp_tree':fields.boolean('Display Tree',help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'),
|
||||
'disp_graph':fields.boolean('Display As Graph',help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'),
|
||||
'disp_tree':fields.boolean('Display Tree', help='When the indicators are printed, if one indicator is set with this field to True, then it will display one more graphs with all its children in tree'),
|
||||
'disp_graph':fields.boolean('Display As Graph', help='If the field is set to True, information will be printed as a Graph, otherwise as an array.'),
|
||||
# 'style': fields.selection(_style, 'Style', required=True),
|
||||
# 'color_font' : fields.selection(_color, 'Font Color', help="Font Color for the report"),
|
||||
# 'color_back' : fields.selection(_color, 'Back Color')
|
||||
|
@ -215,12 +215,12 @@ account_report()
|
|||
class account_report_history(osv.osv):
|
||||
|
||||
def _calc_value(self, cr, uid, ids, name, args, context):
|
||||
acc_report_id=self.read(cr,uid,ids,['tmp','period_id'])
|
||||
acc_report_id=self.read(cr, uid, ids, ['tmp','period_id'])
|
||||
tmp_ids={}
|
||||
for a in acc_report_id:
|
||||
period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr,uid,[a['period_id'][0]])[0]
|
||||
period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])])
|
||||
tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr,uid,[a['tmp']],context={'periods':period_id})[0]['amount']
|
||||
period_val=pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [a['period_id'][0]])[0]
|
||||
period_id=pooler.get_pool(cr.dbname).get('account.period').search(cr, uid, [('date_start','<=',period_val['date_start']),('fiscalyear_id','=',period_val['fiscalyear_id'][0])])
|
||||
tmp_ids[a['id']] = pooler.get_pool(cr.dbname).get('account.report.report').read(cr, uid, [a['tmp']], context={'periods':period_id})[0]['amount']
|
||||
return tmp_ids
|
||||
|
||||
_name = "account.report.history"
|
||||
|
|
|
@ -76,7 +76,7 @@ class account_report_bs(osv.osv):
|
|||
def onchange_parent_id(self, cr, uid, ids, parent_id):
|
||||
v={}
|
||||
if parent_id:
|
||||
acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
|
||||
acc=self.pool.get('account.report.report').browse(cr, uid, parent_id)
|
||||
v['type']=acc.type
|
||||
if int(acc.style) < 6:
|
||||
v['style'] = str(int(acc.style)+1)
|
||||
|
|
|
@ -126,9 +126,9 @@ class account_invoice_line(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self, cr, uid, ids, c={}: ids, None,10)}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -34,8 +34,8 @@ class report_voucher(report_sxw.rml_parse):
|
|||
'get_ref' : self._get_ref
|
||||
})
|
||||
|
||||
def convert(self,amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
|
||||
def convert(self, amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
|
||||
return amt_en
|
||||
|
||||
def debit(self, move_ids):
|
||||
|
|
|
@ -31,8 +31,8 @@ class report_voucher_amount(report_sxw.rml_parse):
|
|||
'convert':self.convert
|
||||
})
|
||||
|
||||
def convert(self,amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount,'en',cur);
|
||||
def convert(self, amount, cur):
|
||||
amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
|
||||
return amt_en
|
||||
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ class account_voucher(osv.osv):
|
|||
self.write(cr, uid, ids, {'state':'posted'})
|
||||
return True
|
||||
|
||||
def cancel_voucher(self,cr,uid,ids,context={}):
|
||||
def cancel_voucher(self, cr, uid, ids, context={}):
|
||||
self.action_cancel(cr, uid, ids)
|
||||
self.write(cr, uid, ids, {'state':'cancel'})
|
||||
return True
|
||||
|
@ -406,7 +406,7 @@ class account_voucher(osv.osv):
|
|||
'general_account_id':line.account_id.id,
|
||||
'ref':ref
|
||||
}
|
||||
self.pool.get('account.analytic.line').create(cr,uid,an_line)
|
||||
self.pool.get('account.analytic.line').create(cr, uid, an_line)
|
||||
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
obj=self.pool.get('account.move').browse(cr, uid, move_id)
|
||||
|
@ -568,7 +568,7 @@ class account_voucher_line(osv.osv):
|
|||
'value' : {'account_id' : account_id.id, 'type' : ttype, 'amount':balance}
|
||||
}
|
||||
|
||||
def onchange_amount(self, cr, uid, ids,partner_id,amount, type,type1):
|
||||
def onchange_amount(self, cr, uid, ids, partner_id, amount, type, type1):
|
||||
if not amount:
|
||||
return {'value' : {}}
|
||||
if partner_id:
|
||||
|
@ -630,7 +630,7 @@ class account_voucher_line(osv.osv):
|
|||
'value' : { 'type' : type , 'amount':amount}
|
||||
}
|
||||
|
||||
def onchange_type(self, cr, uid, ids,partner_id,amount,type,type1):
|
||||
def onchange_type(self, cr, uid, ids, partner_id, amount, type, type1):
|
||||
if partner_id:
|
||||
obj = self.pool.get('res.partner')
|
||||
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
|
||||
|
|
|
@ -33,7 +33,7 @@ account_move_line()
|
|||
class account_voucher(osv.osv):
|
||||
_inherit = 'account.voucher'
|
||||
_columns = {
|
||||
'voucher_line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
|
||||
'voucher_line_ids':fields.one2many('account.voucher.line', 'voucher_id', 'Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
|
||||
}
|
||||
|
||||
def action_move_line_create(self, cr, uid, ids, *args):
|
||||
|
@ -192,7 +192,7 @@ class account_voucher(osv.osv):
|
|||
'general_account_id':line.account_id.id,
|
||||
'ref':ref
|
||||
}
|
||||
self.pool.get('account.analytic.line').create(cr,uid,an_line)
|
||||
self.pool.get('account.analytic.line').create(cr, uid, an_line)
|
||||
if mline_ids:
|
||||
self.pool.get('account.move.line').reconcile_partial(cr, uid, mline_ids, 'manual', context={})
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
|
|
|
@ -50,11 +50,11 @@ class account_analytic_account(osv.osv):
|
|||
else:
|
||||
res[id] += res.get(child, 0.0)
|
||||
|
||||
cur_obj = res_currency.browse(cr,uid,currency.values(),context)
|
||||
cur_obj = res_currency.browse(cr, uid, currency.values(), context)
|
||||
cur_obj = dict([(o.id, o) for o in cur_obj])
|
||||
for id in ids:
|
||||
if id in ids2:
|
||||
res[id] = res_currency.round(cr,uid,cur_obj[currency[id]],res.get(id,0.0))
|
||||
res[id] = res_currency.round(cr, uid, cur_obj[currency[id]], res.get(id,0.0))
|
||||
|
||||
return dict([(i, res[i]) for i in ids ])
|
||||
|
||||
|
@ -216,9 +216,9 @@ class account_analytic_account(osv.osv):
|
|||
'type' : lambda *a : 'normal',
|
||||
'company_id': _default_company,
|
||||
'state' : lambda *a : 'open',
|
||||
'user_id' : lambda self,cr,uid,ctx : uid,
|
||||
'partner_id': lambda self,cr, uid, ctx: ctx.get('partner_id', False),
|
||||
'contact_id': lambda self,cr, uid, ctx: ctx.get('contact_id', False),
|
||||
'user_id' : lambda self, cr, uid, ctx : uid,
|
||||
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
|
||||
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
|
||||
'date_start': lambda *a: time.strftime('%Y-%m-%d')
|
||||
}
|
||||
|
||||
|
@ -323,13 +323,13 @@ class account_analytic_line(osv.osv):
|
|||
'currency_id': fields.function(_get_account_currency, method=True, type='many2one', relation='res.currency', string='Account currency',
|
||||
store={
|
||||
'account.analytic.account': (_get_account_line, ['company_id'], 50),
|
||||
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
|
||||
'account.analytic.line': (lambda self, cr, uid, ids, c={}: ids, ['amount','unit_amount'],10),
|
||||
},
|
||||
help="The related account currency if not equal to the company one."),
|
||||
'amount_currency': fields.function(_amount_currency, method=True, digits_compute= dp.get_precision('Account'), string='Amount currency',
|
||||
store={
|
||||
'account.analytic.account': (_get_account_line, ['company_id'], 50),
|
||||
'account.analytic.line': (lambda self,cr,uid,ids,c={}: ids, ['amount','unit_amount'],10),
|
||||
'account.analytic.line': (lambda self, cr, uid, ids, c={}: ids, ['amount','unit_amount'],10),
|
||||
},
|
||||
help="The amount expressed in the related account currency if not equal to the company one."),
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ class analytic_journal_rate_grid(osv.osv):
|
|||
_name="analytic_journal_rate_grid"
|
||||
_description= "Relation table between journals and billing rates"
|
||||
_columns={
|
||||
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal',required=True,),
|
||||
'account_id': fields.many2one("account.analytic.account", "Analytic Account",required=True,),
|
||||
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True,),
|
||||
'account_id': fields.many2one("account.analytic.account", "Analytic Account", required=True,),
|
||||
'rate_id': fields.many2one("hr_timesheet_invoice.factor", "Invoicing Rate",),
|
||||
}
|
||||
|
||||
|
@ -67,14 +67,14 @@ class hr_analytic_timesheet(osv.osv):
|
|||
#get the old values from super and add the value from the new relation analytic_journal_rate_grid
|
||||
r = self.pool.get('analytic_journal_rate_grid').browse(cr, uid, temp)[0]
|
||||
res.setdefault('value',{})
|
||||
res['value']= super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids,account_id,user_id, unit_amount)['value']
|
||||
res['value']= super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids, account_id, user_id, unit_amount)['value']
|
||||
if r.rate_id.id:
|
||||
res['value']['to_invoice'] = r.rate_id.id
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def on_change_journal_id(self, cr, uid, ids,journal_id, account_id):
|
||||
def on_change_journal_id(self, cr, uid, ids, journal_id, account_id):
|
||||
res = {}
|
||||
if not (journal_id and account_id):
|
||||
return res
|
||||
|
|
|
@ -28,9 +28,9 @@ class analytic_user_funct_grid(osv.osv):
|
|||
_name="analytic_user_funct_grid"
|
||||
_description= "Relation table between users and products on a analytic account"
|
||||
_columns={
|
||||
'user_id': fields.many2one("res.users","User",required=True,),
|
||||
'product_id': fields.many2one("product.product","Product",required=True,),
|
||||
'account_id': fields.many2one("account.analytic.account", "Analytic Account",required=True,),
|
||||
'user_id': fields.many2one("res.users", "User", required=True,),
|
||||
'product_id': fields.many2one("product.product", "Product", required=True,),
|
||||
'account_id': fields.many2one("account.analytic.account", "Analytic Account", required=True,),
|
||||
}
|
||||
|
||||
analytic_user_funct_grid()
|
||||
|
@ -53,15 +53,15 @@ class hr_analytic_timesheet(osv.osv):
|
|||
|
||||
# Look in account, if no value for the user => look in parent until there is no more parent to look
|
||||
# Take the first found... if nothing found => return False
|
||||
def _get_related_user_account_recursiv(self,cr,uid,user_id,account_id):
|
||||
def _get_related_user_account_recursiv(self, cr, uid, user_id, account_id):
|
||||
|
||||
temp=self.pool.get('analytic_user_funct_grid').search(cr, uid, [('user_id', '=', user_id),('account_id', '=', account_id) ])
|
||||
account=self.pool.get('account.analytic.account').browse(cr,uid,account_id)
|
||||
account=self.pool.get('account.analytic.account').browse(cr, uid, account_id)
|
||||
if temp:
|
||||
return temp
|
||||
else:
|
||||
if account.parent_id:
|
||||
return self._get_related_user_account_recursiv(cr,uid,user_id,account.parent_id.id)
|
||||
return self._get_related_user_account_recursiv(cr, uid, user_id, account.parent_id.id)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -74,19 +74,19 @@ class hr_analytic_timesheet(osv.osv):
|
|||
return res
|
||||
|
||||
if not (user_id):
|
||||
return super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids,account_id)
|
||||
return super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids, account_id)
|
||||
|
||||
#get the browse record related to user_id and account_id
|
||||
temp = self._get_related_user_account_recursiv(cr,uid,user_id,account_id)
|
||||
temp = self._get_related_user_account_recursiv(cr, uid, user_id, account_id)
|
||||
# temp = self.pool.get('analytic_user_funct_grid').search(cr, uid, [('user_id', '=', user_id),('account_id', '=', account_id) ])
|
||||
if not temp:
|
||||
#if there isn't any record for this user_id and account_id
|
||||
return super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids,account_id)
|
||||
return super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids, account_id)
|
||||
else:
|
||||
#get the old values from super and add the value from the new relation analytic_user_funct_grid
|
||||
r = self.pool.get('analytic_user_funct_grid').browse(cr, uid, temp)[0]
|
||||
res.setdefault('value',{})
|
||||
res['value']= super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids,account_id)['value']
|
||||
res['value']= super(hr_analytic_timesheet, self).on_change_account_id(cr, uid, ids, account_id)['value']
|
||||
res['value']['product_id'] = r.product_id.id
|
||||
res['value']['product_uom_id'] = r.product_id.product_tmpl_id.uom_id.id
|
||||
|
||||
|
@ -108,19 +108,19 @@ class hr_analytic_timesheet(osv.osv):
|
|||
res ['value']['general_account_id']= a
|
||||
return res
|
||||
|
||||
def on_change_user_id(self, cr, uid, ids,user_id, account_id, unit_amount=0):
|
||||
def on_change_user_id(self, cr, uid, ids, user_id, account_id, unit_amount=0):
|
||||
res = {}
|
||||
if not (user_id):
|
||||
#avoid a useless call to super
|
||||
return res
|
||||
|
||||
#get the old values from super
|
||||
res = super(hr_analytic_timesheet, self).on_change_user_id(cr, uid, ids,user_id)
|
||||
res = super(hr_analytic_timesheet, self).on_change_user_id(cr, uid, ids, user_id)
|
||||
|
||||
if account_id:
|
||||
#get the browse record related to user_id and account_id
|
||||
# temp = self.pool.get('analytic_user_funct_grid').search(cr, uid, [('user_id', '=', user_id),('account_id', '=', account_id) ])
|
||||
temp = self._get_related_user_account_recursiv(cr,uid,user_id,account_id)
|
||||
temp = self._get_related_user_account_recursiv(cr, uid, user_id, account_id)
|
||||
if temp:
|
||||
#add the value from the new relation analytic_user_funct_grid
|
||||
r = self.pool.get('analytic_user_funct_grid').browse(cr, uid, temp)[0]
|
||||
|
|
|
@ -34,7 +34,7 @@ class auction_artists(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.char('Artist/Author Name', size=64, required=True),
|
||||
'pseudo': fields.char('Pseudo', size=64),
|
||||
'birth_death_dates':fields.char('Birth / Death dates',size=64),
|
||||
'birth_death_dates':fields.char('Birth / Death dates', size=64),
|
||||
'biography': fields.text('Biography'),
|
||||
}
|
||||
auction_artists()
|
||||
|
@ -45,7 +45,7 @@ auction_artists()
|
|||
class auction_dates(osv.osv):
|
||||
_name = "auction.dates"
|
||||
|
||||
def _adjudication_get(self, cr, uid, ids, prop, unknow_none,unknow_dict):
|
||||
def _adjudication_get(self, cr, uid, ids, prop, unknow_none, unknow_dict):
|
||||
tmp={}
|
||||
for id in ids:
|
||||
tmp[id]=0.0
|
||||
|
@ -97,7 +97,7 @@ class auction_dates(osv.osv):
|
|||
# objects vendus mais non factures
|
||||
#TODO: convert this query to tiny API
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
cr.execute('select count(*) as c from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',))
|
||||
cr.execute('select count(*) as c from auction_lots where auction_id IN %s and state=%s and obj_price>0', (tuple(ids),'draft',))
|
||||
cr.execute('SELECT COUNT(*) AS c '
|
||||
'FROM auction_lots '
|
||||
'WHERE auction_id IN %s '
|
||||
|
@ -108,10 +108,10 @@ class auction_dates(osv.osv):
|
|||
'WHERE auction_id IN %s '
|
||||
'AND state=%s AND obj_price>0', (tuple(ids), 'draft'))
|
||||
r = lots_obj.lots_invoice(cr, uid, [x[0] for x in cr.fetchall()],{},None)
|
||||
cr.execute('select id from auction_lots where auction_id =ANY(%s) and obj_price>0',(ids,))
|
||||
cr.execute('select id from auction_lots where auction_id IN %s and obj_price>0',(tuple(ids),))
|
||||
ids2 = [x[0] for x in cr.fetchall()]
|
||||
# for auction in auction_ids:
|
||||
c = lots_obj.seller_trans_create(cr, uid, ids2,{})
|
||||
c = lots_obj.seller_trans_create(cr, uid, ids2, {})
|
||||
self.write(cr, uid, ids, {'state':'closed'}) #close the auction
|
||||
return True
|
||||
auction_dates()
|
||||
|
|
|
@ -26,9 +26,9 @@ class report_artistlot(report_int):
|
|||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
def create(self,cr, uid, ids, datas, context):
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['artist_id'])
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['artist_id'])
|
||||
artists = []
|
||||
for lot in lots:
|
||||
if lot['artist_id'] and lot['artist_id'] not in artists:
|
||||
|
@ -40,7 +40,7 @@ class report_artistlot(report_int):
|
|||
datas['ids'] = artists
|
||||
|
||||
self._obj_report = netsvc.LocalService('report.report.auction.artists')
|
||||
return self._obj_report.create(cr,uid, artists, datas, context)
|
||||
return self._obj_report.create(cr, uid, artists, datas, context)
|
||||
|
||||
def result(self):
|
||||
return self._obj_report.result()
|
||||
|
|
|
@ -27,7 +27,7 @@ class auction_invoice(report_int):
|
|||
report_int.__init__(self, name)
|
||||
|
||||
def create(self,cr, uid, ids, datas, context):
|
||||
lots = self.pool.get('auction.lots').read(cr,uid, ids, ['ach_inv_id'], context=context)
|
||||
lots = self.pool.get('auction.lots').read(cr, uid, ids, ['ach_inv_id'], context=context)
|
||||
|
||||
invoices = {}
|
||||
for l in lots:
|
||||
|
@ -40,7 +40,7 @@ class auction_invoice(report_int):
|
|||
datas['ids'] = new_ids
|
||||
|
||||
self._obj_invoice = netsvc.LocalService('report.account.invoice')
|
||||
return self._obj_invoice.create(cr,uid, new_ids, datas, context)
|
||||
return self._obj_invoice.create(cr, uid, new_ids, datas, context)
|
||||
|
||||
def result(self):
|
||||
return self._obj_invoice.result()
|
||||
|
|
|
@ -61,7 +61,7 @@ class auction_total_rml(report_sxw.rml_parse):
|
|||
auc_date_ids = self.cr.fetchall()
|
||||
auct_dat=[]
|
||||
for ad_id in auc_date_ids:
|
||||
auc_dates_fields = self.pool.get('auction.dates').read(self.cr,self.uid,ad_id[0],['name','auction1','id'])
|
||||
auc_dates_fields = self.pool.get('auction.dates').read(self.cr, self.uid, ad_id[0], ['name','auction1','id'])
|
||||
auct_dat.append(auc_dates_fields)
|
||||
return auct_dat
|
||||
|
||||
|
@ -71,7 +71,7 @@ class auction_total_rml(report_sxw.rml_parse):
|
|||
res = self.cr.fetchone()
|
||||
return res[0]
|
||||
def sold_item(self, object_id):
|
||||
self.cr.execute("select count(1) from auction_lots where id IN %s and auction_id=%s and state in ('unsold') ", (tuple(self.total_obj),object_id,))
|
||||
self.cr.execute("select count(1) from auction_lots where id IN %s and auction_id=%s and state IN ('unsold') ", (tuple(self.total_obj),object_id,))
|
||||
res = self.cr.fetchone()
|
||||
return str(res[0])
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class buyer_form_report(report_sxw.rml_parse):
|
|||
taxes.append(lot.author_right)
|
||||
if lot.auction_id:
|
||||
taxes += lot.auction_id.buyer_costs
|
||||
tax=self.pool.get('account.tax').compute(self.cr,self.uid,taxes,lot.obj_price,1)
|
||||
tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
for t in tax:
|
||||
amount+=t['amount']
|
||||
return amount
|
||||
|
@ -55,7 +55,7 @@ class buyer_form_report(report_sxw.rml_parse):
|
|||
for object in objects:
|
||||
partner = ret_dict.get(object.ach_uid.id,False)
|
||||
if not partner:
|
||||
ret_dict[object.ach_uid.id] = {'partner' : object.ach_uid or False,'lots':[object]}
|
||||
ret_dict[object.ach_uid.id] = {'partner' : object.ach_uid or False, 'lots':[object]}
|
||||
else:
|
||||
lots = partner.get('lots')
|
||||
lots.append(object)
|
||||
|
|
|
@ -43,7 +43,7 @@ class buyer_list(report_sxw.rml_parse):
|
|||
'sum_lots':self.sum_lots
|
||||
})
|
||||
|
||||
def lines_lots_from_auction(self,objects):
|
||||
def lines_lots_from_auction(self, objects):
|
||||
|
||||
auc_lot_ids = []
|
||||
for lot_id in objects:
|
||||
|
@ -54,12 +54,12 @@ class buyer_list(report_sxw.rml_parse):
|
|||
auc_date_ids = self.cr.fetchall()
|
||||
auct_dat=[]
|
||||
for ad_id in auc_date_ids:
|
||||
auc_dates_fields = self.pool.get('auction.dates').read(self.cr,self.uid,ad_id[0],['name'])
|
||||
auc_dates_fields = self.pool.get('auction.dates').read(self.cr, self.uid, ad_id[0], ['name'])
|
||||
self.cr.execute('select * from auction_buyer_taxes_rel abr,auction_dates ad where ad.id=abr.auction_id and ad.id=%s', (ad_id[0],))
|
||||
res=self.cr.fetchall()
|
||||
total=0
|
||||
for r in res:
|
||||
buyer_rel_field = self.pool.get('account.tax').read(self.cr,self.uid,r[1],['amount'])
|
||||
buyer_rel_field = self.pool.get('account.tax').read(self.cr, self.uid, r[1], ['amount'])
|
||||
total = total + buyer_rel_field['amount']
|
||||
auc_dates_fields['amount']=total
|
||||
auct_dat.append(auc_dates_fields)
|
||||
|
@ -68,7 +68,7 @@ class buyer_list(report_sxw.rml_parse):
|
|||
def lines_lots_auct_lot(self,obj):
|
||||
auc_lot_ids = []
|
||||
|
||||
auc_date_ids = self.pool.get('auction.dates').search(self.cr,self.uid,([('name','like',obj['name'])]))
|
||||
auc_date_ids = self.pool.get('auction.dates').search(self.cr, self.uid, ([('name','like',obj['name'])]))
|
||||
|
||||
self.cr.execute('SELECT ach_login AS ach_uid, COUNT(1) AS no_lot, '\
|
||||
'SUM(obj_price) AS adj_price, '\
|
||||
|
|
|
@ -69,7 +69,7 @@ class auction_catalog(report_rml):
|
|||
temp=self.post_process_xml_data(cr, uid, xml, context)
|
||||
|
||||
return temp
|
||||
def catalog_xml(self,cr,uid,ids,data,context,cwid="0"):
|
||||
def catalog_xml(self, cr, uid, ids, data, context, cwid="0"):
|
||||
impl = minidom.getDOMImplementation()
|
||||
|
||||
doc = impl.createDocument(None, "report", None)
|
||||
|
@ -84,10 +84,10 @@ class auction_catalog(report_rml):
|
|||
tab_no_photo=[]
|
||||
for id in ids:
|
||||
lot_ids=pooler.get_pool(cr.dbname).get('auction.lots').search(cr, uid, [('auction_id', '=', id)])
|
||||
ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr,uid,lot_ids,['auction_id','name','lot_num','lot_est1','lot_est2'],context)
|
||||
ab=pooler.get_pool(cr.dbname).get('auction.lots').read(cr, uid, lot_ids, ['auction_id','name','lot_num','lot_est1','lot_est2'], context)
|
||||
auction_dates_ids = [x["auction_id"][0] for x in ab]
|
||||
|
||||
res=pooler.get_pool(cr.dbname).get('auction.dates').read(cr,uid,ids,['name','auction1','auction2'],context)
|
||||
res=pooler.get_pool(cr.dbname).get('auction.dates').read(cr, uid, ids, ['name','auction1','auction2'], context)
|
||||
# name emelment
|
||||
key = 'name'
|
||||
categ = doc.createElement(key)
|
||||
|
|
|
@ -31,7 +31,7 @@ class lots_list(report_sxw.rml_parse):
|
|||
'bid_line' : self.bid_line
|
||||
})
|
||||
def bid_line(self, lot_id):
|
||||
res = self.pool.get('auction.bid.lines').read(self.cr,self.uid,[lot_id])
|
||||
res = self.pool.get('auction.bid.lines').read(self.cr, self.uid, [lot_id])
|
||||
return True
|
||||
report_sxw.report_sxw('report.lots.list', 'auction.lots', 'addons/auction/report/lots_list.rml', parser=lots_list)
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ class auction_seller(report_int):
|
|||
def __init__(self, name):
|
||||
report_int.__init__(self, name)
|
||||
|
||||
def create(self,cr, uid, ids, datas, context):
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['bord_vnd_id'])
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['bord_vnd_id'])
|
||||
|
||||
bords = {}
|
||||
for l in lots:
|
||||
|
@ -37,7 +37,7 @@ class auction_seller(report_int):
|
|||
new_ids = bords.keys()
|
||||
|
||||
parts = {}
|
||||
partners = service.execute(cr.dbname,uid, 'auction.deposit', 'read', new_ids, ['partner_id'])
|
||||
partners = service.execute(cr.dbname, uid, 'auction.deposit', 'read', new_ids, ['partner_id'])
|
||||
for l in partners:
|
||||
if l['partner_id']:
|
||||
parts[l['partner_id'][0]]=True
|
||||
|
@ -48,7 +48,7 @@ class auction_seller(report_int):
|
|||
datas['ids'] = new_ids
|
||||
|
||||
self._obj_invoice = netsvc.LocalService('report.res.partner.address')
|
||||
return self._obj_invoice.create(cr,uid, new_ids, datas, context)
|
||||
return self._obj_invoice.create(cr, uid, new_ids, datas, context)
|
||||
|
||||
def result(self):
|
||||
return self._obj_invoice.result()
|
||||
|
|
|
@ -28,7 +28,7 @@ from osv import osv
|
|||
class seller_form_report(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(seller_form_report, self).__init__(cr, uid, name, context=context)
|
||||
lot=self.pool.get('auction.lots').browse(cr,uid,uid)
|
||||
lot=self.pool.get('auction.lots').browse(cr, uid, uid)
|
||||
#address=lot.bord_vnd_id.address_get(self.cr,self.uid,[partner.id])
|
||||
# partner=lot.bord_vnd_id.partner_id
|
||||
# address=partner.address and partner.address[0] or ""
|
||||
|
@ -53,7 +53,7 @@ class seller_form_report(report_sxw.rml_parse):
|
|||
taxes.append(lot.bord_vnd_id.tax_id)
|
||||
elif lot.auction_id and lot.auction_id.seller_costs:
|
||||
taxes += lot.auction_id.seller_costs
|
||||
tax=self.pool.get('account.tax').compute(self.cr,self.uid,taxes,lot.obj_price,1)
|
||||
tax=self.pool.get('account.tax').compute(self.cr, self.uid, taxes, lot.obj_price, 1)
|
||||
for t in tax:
|
||||
amount+=t['amount']
|
||||
return amount
|
||||
|
|
|
@ -35,14 +35,14 @@ class report_custom(report_rml):
|
|||
def __init__(self, name, table, tmpl, xsl):
|
||||
report_rml.__init__(self, name, table, tmpl, xsl)
|
||||
|
||||
def create_xml(self,cr, uid, ids, datas, context={}):
|
||||
def create_xml(self, cr, uid, ids, datas, context={}):
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
|
||||
# start_time = time.clock()
|
||||
|
||||
# lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['obj_price','ach_pay_id','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
auction = service.execute(cr.dbname,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', ids, ['obj_price','ach_login','obj_comm','lot_est1','lot_est2','bord_vnd_id','ach_emp','auction_id'])
|
||||
auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
# mid_time = time.clock()
|
||||
|
||||
|
@ -96,7 +96,7 @@ class report_custom(report_rml):
|
|||
# mid_time3 = time.clock()
|
||||
|
||||
debit = adj
|
||||
costs = service.execute(cr.dbname,uid, 'auction.lots', 'compute_seller_costs', ids)
|
||||
costs = service.execute(cr.dbname, uid, 'auction.lots', 'compute_seller_costs', ids)
|
||||
for cost in costs:
|
||||
debit += cost['amount']
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ class auction_lots_send_aie(osv.osv_memory):
|
|||
for (ref,id) in ids:
|
||||
|
||||
# ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)])
|
||||
datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image'])
|
||||
datas = service.execute(cr.db_name, uid, 'auction.lots', 'read', [id], ['name','image'])
|
||||
if len(datas):
|
||||
bin = base64.decodestring(datas[0]['image'])
|
||||
fname = datas[0]['name']
|
||||
|
|
|
@ -52,9 +52,9 @@ class auction_catalog_flagey(osv.osv_memory):
|
|||
"""
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
auc_dates_obj = self.pool.get('auction.dates')
|
||||
current_auction = auc_dates_obj.browse(cr,uid,context.get('active_ids', []))
|
||||
v_lots = lots_obj.search(cr,uid,[('auction_id','=',current_auction.id)])
|
||||
v_ids = lots_obj.browse(cr,uid,v_lots)
|
||||
current_auction = auc_dates_obj.browse(cr, uid, context.get('active_ids', []))
|
||||
v_lots = lots_obj.search(cr, uid, [('auction_id','=',current_auction.id)])
|
||||
v_ids = lots_obj.browse(cr, uid, v_lots)
|
||||
for ab in v_ids:
|
||||
if not ab.auction_id :
|
||||
raise osv.except_osv('Error!','No Lots belong to this Auction Date')
|
||||
|
|
|
@ -84,7 +84,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
|
|||
"""
|
||||
rec_ids = context and context.get('active_ids',False) or False
|
||||
assert rec_ids, _('Active IDs not Found')
|
||||
datas = self.read(cr, uid, ids[0],['ach_login','ach_uid'])
|
||||
datas = self.read(cr, uid, ids[0], ['ach_login','ach_uid'])
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
recs = lots_obj.browse(cr, uid, rec_ids, context)
|
||||
for rec in recs:
|
||||
|
|
|
@ -43,11 +43,11 @@ class auction_lots_cancel(osv.osv):
|
|||
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
lot = lots_obj.browse(cr,uid,context['active_id'],context)
|
||||
lot = lots_obj.browse(cr, uid, context['active_id'], context)
|
||||
if lot.ach_inv_id:
|
||||
supplier_refund_inv_id = invoice_obj.refund(cr, uid,[lot.ach_inv_id.id])
|
||||
supplier_refund_inv_id = invoice_obj.refund(cr, uid, [lot.ach_inv_id.id])
|
||||
if lot.sel_inv_id:
|
||||
customer_refund_inv_id = invoice_obj.refund(cr, uid,[lot.sel_inv_id.id])
|
||||
customer_refund_inv_id = invoice_obj.refund(cr, uid, [lot.sel_inv_id.id])
|
||||
return {}
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -50,7 +50,7 @@ class auction_lots_invoice(osv.osv_memory):
|
|||
res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context)
|
||||
service = netsvc.LocalService("object_proxy")
|
||||
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context.get('active_ids', []))
|
||||
auction = service.execute(cr.dbname,uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
auction = service.execute(cr.dbname, uid, 'auction.dates', 'read', [lots[0]['auction_id'][0]])[0]
|
||||
|
||||
price = 0.0
|
||||
price_topay = 0.0
|
||||
|
|
|
@ -66,14 +66,14 @@ class auction_transfer_unsold_object(osv.osv):
|
|||
bid_line_obj = self.pool.get('auction.bid_line')
|
||||
lots_obj = self.pool.get('auction.lots')
|
||||
lot_history_obj = self.pool.get('auction.lot.history')
|
||||
line_ids= bid_line_obj.search(cr,uid,[('lot_id','in',context['active_ids'])])
|
||||
line_ids= bid_line_obj.search(cr, uid, [('lot_id','in',context['active_ids'])])
|
||||
bid_line_obj.unlink(cr, uid, line_ids)
|
||||
|
||||
res = self.browse(cr, uid, ids)
|
||||
unsold_ids = lots_obj.search(cr,uid,[('auction_id','=',res[0].auction_id_from.id),('state','=','unsold')])
|
||||
for rec in lots_obj.browse(cr, uid, unsold_ids, context):
|
||||
new_id = lot_history_obj.create(cr,uid,{'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1})
|
||||
up_auction = lots_obj.write(cr,uid,[rec.id],{'auction_id': res[0].auction_id_to.id,
|
||||
new_id = lot_history_obj.create(cr, uid, {'auction_id':rec.auction_id.id,'lot_id':rec.id,'price': rec.obj_ret, 'name': rec.auction_id.auction1})
|
||||
up_auction = lots_obj.write(cr, uid, [rec.id], {'auction_id': res[0].auction_id_to.id,
|
||||
'obj_ret':None,
|
||||
'obj_price':None,
|
||||
'ach_login':None,
|
||||
|
|
|
@ -59,18 +59,18 @@ class res_partner_contact(osv.osv):
|
|||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Last Name', size=30,required=True),
|
||||
'name': fields.char('Last Name', size=30, required=True),
|
||||
'first_name': fields.char('First Name', size=30),
|
||||
'mobile': fields.char('Mobile',size=30),
|
||||
'mobile': fields.char('Mobile', size=30),
|
||||
'title': fields.selection(_title_get, 'Title'),
|
||||
'website': fields.char('Website',size=120),
|
||||
'lang_id': fields.many2one('res.lang','Language'),
|
||||
'job_ids': fields.one2many('res.partner.job','contact_id','Functions and Addresses'),
|
||||
'website': fields.char('Website', size=120),
|
||||
'lang_id': fields.many2one('res.lang', 'Language'),
|
||||
'job_ids': fields.one2many('res.partner.job', 'contact_id', 'Functions and Addresses'),
|
||||
'country_id': fields.many2one('res.country','Nationality'),
|
||||
'birthdate': fields.date('Birth Date'),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true,\
|
||||
it will allow you to hide the partner contact without removing it."),
|
||||
'partner_id': fields.related('job_ids','address_id','partner_id',type='many2one',\
|
||||
'partner_id': fields.related('job_ids', 'address_id', 'partner_id', type='many2one',\
|
||||
relation='res.partner', string='Main Employer'),
|
||||
'function': fields.related('job_ids', 'function', type='char', \
|
||||
string='Main Function'),
|
||||
|
|
|
@ -61,7 +61,7 @@ This test checks the speed of the module. Note that at least 5 demo data is need
|
|||
|
||||
# remove osv_memory class becaz it does not have demo data
|
||||
if obj_list:
|
||||
cr.execute("select w.res_model from ir_actions_todo as t left join ir_act_window as w on t.action_id=w.id where w.res_model =ANY(%s)",(obj_list,))
|
||||
cr.execute("select w.res_model from ir_actions_todo as t left join ir_act_window as w on t.action_id=w.id where w.res_model IN %s",(tuple(obj_list),))
|
||||
res = cr.fetchall()
|
||||
print res
|
||||
for remove_obj in res:
|
||||
|
|
|
@ -33,7 +33,7 @@ def _get_answers(cr, uid, ids):
|
|||
query = """
|
||||
select distinct(answer)
|
||||
from profile_question_yes_rel
|
||||
where profile=ANY(%s)"""
|
||||
where profile IN %s"""
|
||||
|
||||
cr.execute(query, (ids,))
|
||||
ans_yes = [x[0] for x in cr.fetchall()]
|
||||
|
@ -41,9 +41,9 @@ def _get_answers(cr, uid, ids):
|
|||
query = """
|
||||
select distinct(answer)
|
||||
from profile_question_no_rel
|
||||
where profile=ANY(%s)"""
|
||||
where profile IN %s"""
|
||||
|
||||
cr.execute(query, (ids,))
|
||||
cr.execute(query, (tuple(ids),))
|
||||
ans_no = [x[0] for x in cr.fetchall()]
|
||||
|
||||
return [ans_yes, ans_no]
|
||||
|
@ -61,7 +61,7 @@ def _get_parents(cr, uid, ids):
|
|||
select distinct(parent_id)
|
||||
from crm_segmentation
|
||||
where parent_id is not null
|
||||
and id=ANY(%s)""",(ids,))
|
||||
and id IN %s""",(tuple(ids),))
|
||||
|
||||
parent_ids = [x[0] for x in cr.fetchall()]
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ class NhException(Exception):
|
|||
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
class indexer():
|
||||
class indexer(object):
|
||||
""" An indexer knows how to parse the content of some file.
|
||||
|
||||
Typically, one indexer should be instantiated per file
|
||||
|
@ -43,7 +43,7 @@ class indexer():
|
|||
def _getExtensions(self):
|
||||
return []
|
||||
|
||||
def _getDefMime(self,ext):
|
||||
def _getDefMime(self, ext):
|
||||
""" Return a mimetype for this document type, ideally the
|
||||
closest to the extension ext. """
|
||||
mts = self._getMimeTypes();
|
||||
|
@ -51,7 +51,7 @@ class indexer():
|
|||
return mts[0]
|
||||
return None
|
||||
|
||||
def indexContent(self,content,filename=None, realfile = None):
|
||||
def indexContent(self, content, filename=None, realfile = None):
|
||||
""" Use either content or the real file, to index.
|
||||
Some parsers will work better with the actual
|
||||
content, others parse a file easier. Try the
|
||||
|
@ -111,7 +111,7 @@ def mime_match(mime, mdict):
|
|||
|
||||
return (None, None)
|
||||
|
||||
class contentIndex():
|
||||
class contentIndex(object):
|
||||
__logger = logging.getLogger('addons.document.content_index')
|
||||
def __init__(self):
|
||||
self.mimes = {}
|
||||
|
@ -132,7 +132,7 @@ class contentIndex():
|
|||
if not f:
|
||||
raise Exception("Your indexer should at least suport a mimetype or extension")
|
||||
|
||||
def doIndex(self,content, filename=None, content_type=None, realfname = None, debug=False):
|
||||
def doIndex(self, content, filename=None, content_type=None, realfname = None, debug=False):
|
||||
fobj = None
|
||||
fname = None
|
||||
mime = None
|
||||
|
|
|
@ -35,10 +35,10 @@ class ir_action_report_xml(osv.osv):
|
|||
def _model_get(self, cr, uid, ids, name, arg, context):
|
||||
res = {}
|
||||
model_pool = self.pool.get('ir.model')
|
||||
for data in self.read(cr,uid,ids,['model']):
|
||||
for data in self.read(cr, uid, ids, ['model']):
|
||||
model = data.get('model',False)
|
||||
if model:
|
||||
model_id =model_pool.search(cr,uid,[('model','=',model)])
|
||||
model_id =model_pool.search(cr, uid, [('model','=',model)])
|
||||
if model_id:
|
||||
res[data.get('id')] = model_id[0]
|
||||
else:
|
||||
|
@ -51,14 +51,14 @@ class ir_action_report_xml(osv.osv):
|
|||
model_id= args[0][2]
|
||||
if not model_id:
|
||||
return []
|
||||
model = self.pool.get('ir.model').read(cr,uid,[model_id])[0]['model']
|
||||
report_id = self.search(cr,uid,[('model','=',model)])
|
||||
model = self.pool.get('ir.model').read(cr, uid, [model_id])[0]['model']
|
||||
report_id = self.search(cr, uid, [('model','=',model)])
|
||||
if not report_id:
|
||||
return [('id','=','0')]
|
||||
return [('id','in',report_id)]
|
||||
|
||||
_columns={
|
||||
'model_id' : fields.function(_model_get,fnct_search=_model_search,method=True,string='Model Id'),
|
||||
'model_id' : fields.function(_model_get, fnct_search=_model_search, method=True, string='Model Id'),
|
||||
}
|
||||
|
||||
ir_action_report_xml()
|
||||
|
|
|
@ -78,10 +78,10 @@ class document_directory(osv.osv):
|
|||
return False
|
||||
return objid.browse(cr, uid, mid, context=context).res_id
|
||||
|
||||
def _get_def_storage(self,cr,uid,context=None):
|
||||
def _get_def_storage(self, cr, uid, context=None):
|
||||
if context and context.has_key('default_parent_id'):
|
||||
# Use the same storage as the parent..
|
||||
diro = self.browse(cr,uid,context['default_parent_id'])
|
||||
diro = self.browse(cr, uid, context['default_parent_id'])
|
||||
if diro.storage_id:
|
||||
return diro.storage_id.id
|
||||
objid=self.pool.get('ir.model.data')
|
||||
|
@ -119,7 +119,7 @@ class document_directory(osv.osv):
|
|||
""" Return the full path to this directory, in a list, root first
|
||||
"""
|
||||
def _parent(dir_id, path):
|
||||
parent=self.browse(cr,uid,dir_id)
|
||||
parent=self.browse(cr, uid, dir_id)
|
||||
if parent.parent_id and not parent.ressource_parent_type_id:
|
||||
_parent(parent.parent_id.id,path)
|
||||
path.append(parent.name)
|
||||
|
@ -130,12 +130,12 @@ class document_directory(osv.osv):
|
|||
_parent(dir_id, path)
|
||||
return path
|
||||
|
||||
def ol_get_resource_path(self,cr,uid,dir_id,res_model,res_id):
|
||||
def ol_get_resource_path(self, cr, uid, dir_id, res_model, res_id):
|
||||
# this method will be used in process module
|
||||
# to be need test and Improvement if resource dir has parent resource (link resource)
|
||||
path=[]
|
||||
def _parent(dir_id,path):
|
||||
parent=self.browse(cr,uid,dir_id)
|
||||
parent=self.browse(cr, uid, dir_id)
|
||||
if parent.parent_id and not parent.ressource_parent_type_id:
|
||||
_parent(parent.parent_id.id,path)
|
||||
path.append(parent.name)
|
||||
|
@ -144,10 +144,10 @@ class document_directory(osv.osv):
|
|||
return path
|
||||
|
||||
directory=self.browse(cr,uid,dir_id)
|
||||
model_ids=self.pool.get('ir.model').search(cr,uid,[('model','=',res_model)])
|
||||
model_ids=self.pool.get('ir.model').search(cr, uid, [('model','=',res_model)])
|
||||
if directory:
|
||||
_parent(dir_id,path)
|
||||
path.append(self.pool.get(directory.ressource_type_id.model).browse(cr,uid,res_id).name)
|
||||
path.append(self.pool.get(directory.ressource_type_id.model).browse(cr, uid, res_id).name)
|
||||
#user=self.pool.get('res.users').browse(cr,uid,uid)
|
||||
#return "ftp://%s:%s@localhost:%s/%s/%s"%(user.login,user.password,config.get('ftp_server_port',8021),cr.dbname,'/'.join(path))
|
||||
# No way we will return the password!
|
||||
|
@ -195,7 +195,7 @@ class document_directory(osv.osv):
|
|||
context['lang'] = lang
|
||||
|
||||
try: #just instrumentation
|
||||
return nodes.get_node_context(cr, uid, context).get_uri(cr,uri)
|
||||
return nodes.get_node_context(cr, uid, context).get_uri(cr, uri)
|
||||
except Exception,e:
|
||||
print "exception: ",e
|
||||
raise
|
||||
|
@ -235,15 +235,15 @@ class document_directory(osv.osv):
|
|||
default ={}
|
||||
name = self.read(cr, uid, [id])[0]['name']
|
||||
default.update({'name': name+ " (copy)"})
|
||||
return super(document_directory,self).copy(cr,uid,id,default,context)
|
||||
return super(document_directory,self).copy(cr, uid, id, default, context)
|
||||
|
||||
def _check_duplication(self, cr, uid,vals,ids=[],op='create'):
|
||||
def _check_duplication(self, cr, uid, vals, ids=[], op='create'):
|
||||
name=vals.get('name',False)
|
||||
parent_id=vals.get('parent_id',False)
|
||||
ressource_parent_type_id=vals.get('ressource_parent_type_id',False)
|
||||
ressource_id=vals.get('ressource_id',0)
|
||||
if op=='write':
|
||||
for directory in self.browse(cr,uid,ids):
|
||||
for directory in self.browse(cr, uid, ids):
|
||||
if not name:
|
||||
name=directory.name
|
||||
if not parent_id:
|
||||
|
@ -261,12 +261,12 @@ class document_directory(osv.osv):
|
|||
return False
|
||||
return True
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals,ids,op='write'):
|
||||
if not self._check_duplication(cr, uid, vals, ids, op='write'):
|
||||
raise osv.except_osv(_('ValidateError'), _('Directory name must be unique!'))
|
||||
return super(document_directory,self).write(cr,uid,ids,vals,context=context)
|
||||
return super(document_directory,self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if not self._check_duplication(cr,uid,vals):
|
||||
if not self._check_duplication(cr, uid, vals):
|
||||
raise osv.except_osv(_('ValidateError'), _('Directory name must be unique!'))
|
||||
if vals.get('name',False) and (vals.get('name').find('/')+1 or vals.get('name').find('@')+1 or vals.get('name').find('$')+1 or vals.get('name').find('#')+1) :
|
||||
raise osv.except_osv(_('ValidateError'), _('Directory name contains special characters!'))
|
||||
|
|
|
@ -309,7 +309,7 @@ class document_storage(osv.osv):
|
|||
if not fname:
|
||||
return None
|
||||
path = storage_bo.path
|
||||
return ( storage_bo.id, 'file', os.path.join(path,fname))
|
||||
return ( storage_bo.id, 'file', os.path.join(path, fname))
|
||||
else:
|
||||
raise TypeError("No %s storage" % boo.type)
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import time
|
|||
#
|
||||
|
||||
def get_node_context(cr, uid, context):
|
||||
return node_context(cr,uid,context)
|
||||
return node_context(cr, uid, context)
|
||||
|
||||
class node_context(object):
|
||||
""" This is the root node, representing access to some particular
|
||||
|
@ -60,7 +60,7 @@ class node_context(object):
|
|||
def get_uri(self, cr, uri):
|
||||
""" Although this fn passes back to doc.dir, it is needed since
|
||||
it is a potential caching point """
|
||||
(ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self)
|
||||
(ndir, duri) = self._dirobj._locate_child(cr, self.uid, self.rootdir, uri, None, self)
|
||||
while duri:
|
||||
ndir = ndir.child(cr, duri[0])
|
||||
if not ndir:
|
||||
|
@ -158,7 +158,7 @@ class node_class(object):
|
|||
return True
|
||||
return False
|
||||
|
||||
def get_dav_eprop(self,cr,ns,prop):
|
||||
def get_dav_eprop(self, cr, ns, prop):
|
||||
return None
|
||||
|
||||
def rm(self, cr):
|
||||
|
@ -205,19 +205,19 @@ class node_database(node_class):
|
|||
where2 = where + domain + [('type', '=', 'directory')]
|
||||
ids = dirobj.search(cr, uid, where2, context=ctx)
|
||||
res = []
|
||||
for dirr in dirobj.browse(cr,uid,ids,context=ctx):
|
||||
res.append(node_dir(dirr.name,self,self.context,dirr))
|
||||
for dirr in dirobj.browse(cr, uid, ids, context=ctx):
|
||||
res.append(node_dir(dirr.name, self, self.context,dirr))
|
||||
|
||||
where2 = where + domain + [('type', '=', 'ressource'), ('ressource_parent_type_id','=',False)]
|
||||
ids = dirobj.search(cr, uid, where2, context=ctx)
|
||||
for dirr in dirobj.browse(cr,uid,ids,context=ctx):
|
||||
res.append(node_res_dir(dirr.name,self,self.context,dirr))
|
||||
for dirr in dirobj.browse(cr, uid, ids, context=ctx):
|
||||
res.append(node_res_dir(dirr.name, self, self.context, dirr))
|
||||
|
||||
fil_obj = dirobj.pool.get('ir.attachment')
|
||||
ids = fil_obj.search(cr,uid,where,context=ctx)
|
||||
ids = fil_obj.search(cr, uid, where, context=ctx)
|
||||
if ids:
|
||||
for fil in fil_obj.browse(cr,uid,ids,context=ctx):
|
||||
res.append(node_file(fil.name,self,self.context,fil))
|
||||
for fil in fil_obj.browse(cr, uid, ids, context=ctx):
|
||||
res.append(node_file(fil.name, self, self.context, fil))
|
||||
return res
|
||||
|
||||
def _file_get(self,cr, nodename=False, directory_id=False):
|
||||
|
@ -241,7 +241,7 @@ class node_database(node_class):
|
|||
|
||||
class node_dir(node_database):
|
||||
our_type = 'collection'
|
||||
def __init__(self,path, parent, context, dirr, dctx=None):
|
||||
def __init__(self, path, parent, context, dirr, dctx=None):
|
||||
super(node_dir,self).__init__(path, parent,context)
|
||||
self.dir_id = dirr and dirr.id or False
|
||||
#todo: more info from dirr
|
||||
|
@ -269,7 +269,7 @@ class node_dir(node_database):
|
|||
pass
|
||||
|
||||
|
||||
def get_data(self,cr):
|
||||
def get_data(self, cr):
|
||||
res = ''
|
||||
for child in self.children(cr):
|
||||
res += child.get_data(cr)
|
||||
|
@ -277,7 +277,7 @@ class node_dir(node_database):
|
|||
|
||||
|
||||
|
||||
def _file_get(self,cr, nodename=False):
|
||||
def _file_get(self, cr, nodename=False):
|
||||
return super(node_dir,self)._file_get(cr, nodename, self.dir_id)
|
||||
|
||||
|
||||
|
@ -320,7 +320,7 @@ class node_dir(node_database):
|
|||
return dirobj.create(cr, uid, val)
|
||||
|
||||
|
||||
def create_child(self,cr,path,data):
|
||||
def create_child(self, cr, path, data):
|
||||
""" API function to create a child file object and node
|
||||
Return the node_* created
|
||||
"""
|
||||
|
@ -336,10 +336,10 @@ class node_dir(node_database):
|
|||
# Datas are not set here
|
||||
}
|
||||
|
||||
fil_id = fil_obj.create(cr,uid, val, context=ctx)
|
||||
fil = fil_obj.browse(cr,uid,fil_id,context=ctx)
|
||||
fnode = node_file(path,self,self.context,fil)
|
||||
fnode.set_data(cr,data,fil)
|
||||
fil_id = fil_obj.create(cr, uid, val, context=ctx)
|
||||
fil = fil_obj.browse(cr, uid, fil_id, context=ctx)
|
||||
fnode = node_file(path, self, self.context, fil)
|
||||
fnode.set_data(cr, data, fil)
|
||||
return fnode
|
||||
|
||||
def get_etag(self, cr):
|
||||
|
@ -365,8 +365,8 @@ class node_res_dir(node_class):
|
|||
node_dirs (with limited domain).
|
||||
"""
|
||||
our_type = 'collection'
|
||||
def __init__(self,path, parent, context, dirr, dctx=None ):
|
||||
super(node_res_dir,self).__init__(path, parent,context)
|
||||
def __init__(self, path, parent, context, dirr, dctx=None ):
|
||||
super(node_res_dir,self).__init__(path, parent, context)
|
||||
self.dir_id = dirr.id
|
||||
#todo: more info from dirr
|
||||
self.mimetype = 'application/x-directory'
|
||||
|
@ -400,7 +400,7 @@ class node_res_dir(node_class):
|
|||
return res[0]
|
||||
return None
|
||||
|
||||
def _child_get(self,cr, name = None, domain=None):
|
||||
def _child_get(self, cr, name = None, domain=None):
|
||||
""" return virtual children of resource, based on the
|
||||
foreign object.
|
||||
|
||||
|
@ -409,7 +409,6 @@ class node_res_dir(node_class):
|
|||
"""
|
||||
obj = self.context._dirobj.pool.get(self.res_model)
|
||||
if not obj:
|
||||
print "couldn't find model", self.res_model
|
||||
return []
|
||||
dirobj = self.context._dirobj
|
||||
uid = self.context.uid
|
||||
|
@ -432,12 +431,12 @@ class node_res_dir(node_class):
|
|||
if obj._parent_name in obj.fields_get(cr, uid):
|
||||
where.append((obj._parent_name,'=',object2 and object2.id or False))
|
||||
|
||||
resids = obj.search(cr,uid, where, context=ctx)
|
||||
resids = obj.search(cr, uid, where, context=ctx)
|
||||
res = []
|
||||
for bo in obj.browse(cr,uid,resids,context=ctx):
|
||||
for bo in obj.browse(cr, uid, resids, context=ctx):
|
||||
if not bo:
|
||||
continue
|
||||
name = getattr(bo,self.namefield)
|
||||
name = getattr(bo, self.namefield)
|
||||
if not name:
|
||||
continue
|
||||
# Yes! we can't do better but skip nameless records.
|
||||
|
@ -479,7 +478,7 @@ class node_res_obj(node_class):
|
|||
dc2['this'] = res_bo
|
||||
for fld,expr in self.dctx_dict.items():
|
||||
try:
|
||||
self.dctx[fld] = safe_eval(expr,dc2)
|
||||
self.dctx[fld] = safe_eval(expr, dc2)
|
||||
except Exception,e:
|
||||
print "Cannot eval %s for %s" % (expr, fld)
|
||||
print e
|
||||
|
@ -490,11 +489,11 @@ class node_res_obj(node_class):
|
|||
def children(self, cr, domain=None):
|
||||
return self._child_get(cr, domain=domain) + self._file_get(cr)
|
||||
|
||||
def child(self,cr, name, domain=None):
|
||||
def child(self, cr, name, domain=None):
|
||||
res = self._child_get(cr, name, domain=domain)
|
||||
if res:
|
||||
return res[0]
|
||||
res = self._file_get(cr,name)
|
||||
res = self._file_get(cr, name)
|
||||
if res:
|
||||
return res[0]
|
||||
return None
|
||||
|
@ -509,9 +508,9 @@ class node_res_obj(node_class):
|
|||
#if self.domain:
|
||||
# where.extend(self.domain)
|
||||
# print "res_obj file_get clause", where
|
||||
ids = cntobj.search(cr,uid,where,context=ctx)
|
||||
for content in cntobj.browse(cr,uid,ids,context=ctx):
|
||||
res3 = cntobj._file_get(cr,self,nodename,content, context=ctx)
|
||||
ids = cntobj.search(cr, uid, where, context=ctx)
|
||||
for content in cntobj.browse(cr, uid, ids, context=ctx):
|
||||
res3 = cntobj._file_get(cr, self, nodename, content, context=ctx)
|
||||
if res3:
|
||||
res.extend(res3)
|
||||
|
||||
|
@ -524,15 +523,15 @@ class node_res_obj(node_class):
|
|||
ctx = self.context.context.copy()
|
||||
ctx.update(self.dctx)
|
||||
where = [('directory_id','=',self.dir_id) ]
|
||||
ids = cntobj.search(cr,uid,where,context=ctx)
|
||||
for content in cntobj.browse(cr,uid,ids,context=ctx):
|
||||
ids = cntobj.search(cr, uid, where, context=ctx)
|
||||
for content in cntobj.browse(cr, uid, ids, context=ctx):
|
||||
if content.extension == '.ics': # FIXME: call the content class!
|
||||
res['http://groupdav.org/'] = ('resourcetype',)
|
||||
return res
|
||||
|
||||
def get_dav_eprop(self,cr,ns,prop):
|
||||
def get_dav_eprop(self, cr, ns, prop):
|
||||
if ns != 'http://groupdav.org/' or prop != 'resourcetype':
|
||||
print "Who asked for %s:%s?" % (ns,prop)
|
||||
print "Who asked for %s:%s?" % (ns, prop)
|
||||
return None
|
||||
res = {}
|
||||
cntobj = self.context._dirobj.pool.get('document.directory.content')
|
||||
|
@ -541,12 +540,12 @@ class node_res_obj(node_class):
|
|||
ctx.update(self.dctx)
|
||||
where = [('directory_id','=',self.dir_id) ]
|
||||
ids = cntobj.search(cr,uid,where,context=ctx)
|
||||
for content in cntobj.browse(cr,uid,ids,context=ctx):
|
||||
for content in cntobj.browse(cr, uid, ids, context=ctx):
|
||||
if content.extension == '.ics': # FIXME: call the content class!
|
||||
return ('vevent-collection','http://groupdav.org/')
|
||||
return None
|
||||
|
||||
def _child_get(self,cr, name=None, domain=None):
|
||||
def _child_get(self, cr, name=None, domain=None):
|
||||
dirobj = self.context._dirobj
|
||||
uid = self.context.uid
|
||||
ctx = self.context.context.copy()
|
||||
|
@ -563,8 +562,8 @@ class node_res_obj(node_class):
|
|||
where1 = []
|
||||
if obj._parent_name in obj.fields_get(cr, uid):
|
||||
where1 = where + [(obj._parent_name, '=', self.res_id)]
|
||||
resids = obj.search(cr,uid, where1, context=ctx)
|
||||
for bo in obj.browse(cr,uid,resids,context=ctx):
|
||||
resids = obj.search(cr, uid, where1, context=ctx)
|
||||
for bo in obj.browse(cr, uid, resids, context=ctx):
|
||||
namefield = directory.resource_field.name or 'name'
|
||||
if not bo:
|
||||
continue
|
||||
|
@ -634,7 +633,7 @@ class node_res_obj(node_class):
|
|||
|
||||
return dirobj.create(cr, uid, val)
|
||||
|
||||
def create_child(self,cr,path,data):
|
||||
def create_child(self, cr, path, data):
|
||||
""" API function to create a child file object and node
|
||||
Return the node_* created
|
||||
"""
|
||||
|
@ -652,18 +651,18 @@ class node_res_obj(node_class):
|
|||
# Datas are not set here
|
||||
}
|
||||
|
||||
fil_id = fil_obj.create(cr,uid, val, context=ctx)
|
||||
fil = fil_obj.browse(cr,uid,fil_id,context=ctx)
|
||||
fnode = node_file(path,self,self.context,fil)
|
||||
fnode.set_data(cr,data,fil)
|
||||
fil_id = fil_obj.create(cr, uid, val, context=ctx)
|
||||
fil = fil_obj.browse(cr, uid, fil_id, context=ctx)
|
||||
fnode = node_file(path, self, self.context, fil)
|
||||
fnode.set_data(cr, data, fil)
|
||||
return fnode
|
||||
|
||||
def _get_ttag(self,cr):
|
||||
return 'rodir-%d-%d' % (self.dir_id,self.res_id)
|
||||
return 'rodir-%d-%d' % (self.dir_id, self.res_id)
|
||||
|
||||
class node_file(node_class):
|
||||
our_type = 'file'
|
||||
def __init__(self,path, parent, context, fil):
|
||||
def __init__(self, path, parent, context, fil):
|
||||
super(node_file,self).__init__(path, parent,context)
|
||||
self.file_id = fil.id
|
||||
#todo: more info from ir_attachment
|
||||
|
@ -745,7 +744,7 @@ class node_file(node_class):
|
|||
stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id
|
||||
assert stor
|
||||
stobj = self.context._dirobj.pool.get('document.storage')
|
||||
return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj)
|
||||
return stobj.get_data(cr, self.context.uid,stor, self,self.context.context, fil_obj)
|
||||
|
||||
def get_data_len(self, cr, fil_obj = None):
|
||||
# TODO: verify with the storage object!
|
||||
|
@ -768,14 +767,14 @@ class node_file(node_class):
|
|||
stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id
|
||||
assert stor
|
||||
stobj = self.context._dirobj.pool.get('document.storage')
|
||||
return stobj.set_data(cr,self.context.uid,stor, self, data, self.context.context, fil_obj)
|
||||
return stobj.set_data(cr, self.context.uid,stor, self, data, self.context.context, fil_obj)
|
||||
|
||||
def _get_ttag(self,cr):
|
||||
return 'file-%d' % self.file_id
|
||||
|
||||
class node_content(node_class):
|
||||
our_type = 'content'
|
||||
def __init__(self,path, parent, context, cnt, dctx = None, act_id=None):
|
||||
def __init__(self, path, parent, context, cnt, dctx = None, act_id=None):
|
||||
super(node_content,self).__init__(path, parent,context)
|
||||
self.cnt_id = cnt.id
|
||||
self.create_date = False
|
||||
|
@ -799,7 +798,7 @@ class node_content(node_class):
|
|||
res.name = self
|
||||
return res
|
||||
|
||||
def fill_fields(self,cr,dctx = None):
|
||||
def fill_fields(self, cr, dctx = None):
|
||||
""" Try to read the object and fill missing fields, like mimetype,
|
||||
dates etc.
|
||||
This function must be different from the constructor, because
|
||||
|
@ -817,7 +816,7 @@ class node_content(node_class):
|
|||
cntobj = self.context._dirobj.pool.get('document.directory.content')
|
||||
ctx = self.context.context.copy()
|
||||
ctx.update(self.dctx)
|
||||
data = cntobj.process_read(cr,self.context.uid,self,ctx)
|
||||
data = cntobj.process_read(cr, self.context.uid, self, ctx)
|
||||
if data:
|
||||
self.content_length = len(data)
|
||||
return data
|
||||
|
@ -831,7 +830,7 @@ class node_content(node_class):
|
|||
cntobj = self.context._dirobj.pool.get('document.directory.content')
|
||||
ctx = self.context.context.copy()
|
||||
ctx.update(self.dctx)
|
||||
return cntobj.process_write(cr,self.context.uid,self, data,ctx)
|
||||
return cntobj.process_write(cr, self.context.uid, self, data, ctx)
|
||||
|
||||
def _get_ttag(self,cr):
|
||||
return 'cnt-%d%s' % (self.cnt_id,(self.act_id and ('-' + str(self.act_id))) or '')
|
||||
|
|
|
@ -44,7 +44,7 @@ class TxtIndex(indexer):
|
|||
def _getExtensions(self):
|
||||
return ['.txt', '.py']
|
||||
|
||||
def _doIndexContent(self,content):
|
||||
def _doIndexContent(self, content):
|
||||
return content
|
||||
|
||||
cntIndex.register(TxtIndex())
|
||||
|
@ -56,7 +56,7 @@ class PptxIndex(indexer):
|
|||
def _getExtensions(self):
|
||||
return ['.pptx']
|
||||
|
||||
def _doIndexFile(self,fname):
|
||||
def _doIndexFile(self, fname):
|
||||
# pptx2txt.pl package not support in windows platform.
|
||||
# Download pptx2txt package from http://sourceforge.net/projects/pptx2txt/" link.
|
||||
# To install this tool, just copy pptx2txt.pl to appropriate place (e.g. /usr/bin directory)
|
||||
|
@ -88,7 +88,7 @@ class DocxIndex(indexer):
|
|||
def _getExtensions(self):
|
||||
return ['.docx']
|
||||
|
||||
def _doIndexFile(self,fname):
|
||||
def _doIndexFile(self, fname):
|
||||
# docx2txt.pl package not support in windows platform.
|
||||
# Download docx2txt package from "http://sourceforge.net/projects/docx2txt/" link.
|
||||
# In case, you don't want to use Makefile for installation, you can follow these steps for manual installation.
|
||||
|
|
|
@ -27,20 +27,13 @@ for fname in args:
|
|||
fp = open(fname,'rb')
|
||||
content = fp.read()
|
||||
fp.close()
|
||||
res = cntIndex.doIndex(content,fname,None,None,True)
|
||||
res = cntIndex.doIndex(content, fname, None, None, True)
|
||||
else:
|
||||
res = cntIndex.doIndex(None, fname, None, fname,True)
|
||||
|
||||
if res:
|
||||
print "Result: ", res[0]
|
||||
print res[1]
|
||||
else:
|
||||
print "No result"
|
||||
except Exception,e:
|
||||
import traceback,sys
|
||||
tb_s = reduce(lambda x, y: x+y, traceback.format_exception( sys.exc_type, sys.exc_value, sys.exc_traceback))
|
||||
print "Traceback:",tb_s
|
||||
print "Exception: ",e
|
||||
|
||||
|
||||
#eof
|
||||
|
|
|
@ -265,7 +265,7 @@ class abstracted_fs:
|
|||
|
||||
if object2:
|
||||
where += [('res_id','=',object2.id),('res_model','=',object2._name)]
|
||||
cids = fobj.search(cr, uid,where)
|
||||
cids = fobj.search(cr, uid, where)
|
||||
if len(cids):
|
||||
cid = cids[0]
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@ class document_directory_content(osv.osv):
|
|||
|
||||
_columns = {
|
||||
'object_id': fields.many2one('ir.model', 'Object', oldname= 'ics_object_id'),
|
||||
'obj_iterate': fields.boolean('Iterate object',help="If set, a separate \
|
||||
'obj_iterate': fields.boolean('Iterate object', help="If set, a separate \
|
||||
instance will be created for each record of Object"),
|
||||
'fname_field': fields.char("Filename field",size=16,help="The field of the \
|
||||
'fname_field': fields.char("Filename field", size=16, help="The field of the \
|
||||
object used in the filename. Has to be a unique identifier."),
|
||||
'ics_domain': fields.char('Domain', size=64),
|
||||
'ics_field_ids': fields.one2many('document.directory.ics.fields', 'content_id', 'Fields Mapping')
|
||||
|
@ -138,7 +138,7 @@ class document_directory_content(osv.osv):
|
|||
dctx2 = { 'active_id': ro['id'] }
|
||||
if fname_fld:
|
||||
dctx2['active_'+fname_fld] = ro[fname_fld]
|
||||
n = node_content(tname, node, node.context,content,dctx=dctx2, act_id = ro['id'])
|
||||
n = node_content(tname, node, node.context, content, dctx=dctx2, act_id = ro['id'])
|
||||
n.fill_fields(cr, dctx2)
|
||||
res2.append(n)
|
||||
return res2
|
||||
|
|
|
@ -62,7 +62,7 @@ class openerp_dav_handler(dav_interface):
|
|||
self.baseuri = parent.baseuri
|
||||
self.verbose = verbose
|
||||
|
||||
def get_propnames(self,uri):
|
||||
def get_propnames(self, uri):
|
||||
props = self.PROPS
|
||||
self.parent.log_message('get propnames: %s' % uri)
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
|
@ -104,7 +104,7 @@ class openerp_dav_handler(dav_interface):
|
|||
pname -- name of the property
|
||||
"""
|
||||
if self.M_NS.has_key(ns):
|
||||
return dav_interface.get_prop(self,uri,ns,propname)
|
||||
return dav_interface.get_prop(self, uri, ns, propname)
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
cr, uid, pool, dbname, uri2 = self.get_cr(uri)
|
||||
if not dbname:
|
||||
|
@ -114,7 +114,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if not node:
|
||||
cr.close()
|
||||
raise DAV_NotFound
|
||||
res = node.get_dav_eprop(cr,ns,propname)
|
||||
res = node.get_dav_eprop(cr, ns, propname)
|
||||
cr.close()
|
||||
return res
|
||||
|
||||
|
@ -149,7 +149,7 @@ class openerp_dav_handler(dav_interface):
|
|||
cr.close()
|
||||
return self.db_name_list
|
||||
|
||||
def get_childs(self,uri, filters=None):
|
||||
def get_childs(self, uri, filters=None):
|
||||
""" return the child objects as self.baseuris for the given URI """
|
||||
self.parent.log_message('get childs: %s' % uri)
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
|
@ -160,7 +160,7 @@ class openerp_dav_handler(dav_interface):
|
|||
res = map(lambda x: self.urijoin(x), self.db_list())
|
||||
return res
|
||||
result = []
|
||||
node = self.uri2object(cr,uid,pool, uri2[:])
|
||||
node = self.uri2object(cr, uid, pool, uri2[:])
|
||||
|
||||
if not node:
|
||||
if cr: cr.close()
|
||||
|
@ -218,7 +218,7 @@ class openerp_dav_handler(dav_interface):
|
|||
uri2 = reluri.split('/')[2:]
|
||||
return cr, uid, pool, dbname, uri2
|
||||
|
||||
def uri2object(self, cr,uid, pool,uri):
|
||||
def uri2object(self, cr, uid, pool,uri):
|
||||
if not uid:
|
||||
return None
|
||||
return pool.get('document.directory').get_object(cr, uid, uri)
|
||||
|
@ -230,7 +230,7 @@ class openerp_dav_handler(dav_interface):
|
|||
try:
|
||||
if not dbname:
|
||||
raise DAV_Error, 409
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if not node:
|
||||
raise DAV_NotFound(uri2)
|
||||
try:
|
||||
|
@ -277,7 +277,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if not dbname:
|
||||
cr.close()
|
||||
return COLLECTION
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if not node:
|
||||
cr.close()
|
||||
raise DAV_NotFound(uri2)
|
||||
|
@ -285,7 +285,7 @@ class openerp_dav_handler(dav_interface):
|
|||
return node.displayname
|
||||
|
||||
@memoize(CACHE_SIZE)
|
||||
def _get_dav_getcontentlength(self,uri):
|
||||
def _get_dav_getcontentlength(self, uri):
|
||||
""" return the content length of an object """
|
||||
self.parent.log_message('get length: %s' % uri)
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
|
@ -321,7 +321,7 @@ class openerp_dav_handler(dav_interface):
|
|||
return str(result)
|
||||
|
||||
@memoize(CACHE_SIZE)
|
||||
def get_lastmodified(self,uri):
|
||||
def get_lastmodified(self, uri):
|
||||
""" return the last modified date of the object """
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
today = time.time()
|
||||
|
@ -329,7 +329,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if not dbname:
|
||||
return today
|
||||
try:
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if not node:
|
||||
raise DAV_NotFound(uri2)
|
||||
if node.write_date:
|
||||
|
@ -340,14 +340,14 @@ class openerp_dav_handler(dav_interface):
|
|||
if cr: cr.close()
|
||||
|
||||
@memoize(CACHE_SIZE)
|
||||
def get_creationdate(self,uri):
|
||||
def get_creationdate(self, uri):
|
||||
""" return the last modified date of the object """
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
cr, uid, pool, dbname, uri2 = self.get_cr(uri)
|
||||
if not dbname:
|
||||
raise DAV_Error, 409
|
||||
try:
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if not node:
|
||||
raise DAV_NotFound(uri2)
|
||||
if node.create_date:
|
||||
|
@ -366,7 +366,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if not dbname:
|
||||
return 'httpd/unix-directory'
|
||||
try:
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if not node:
|
||||
raise DAV_NotFound(uri2)
|
||||
result = node.mimetype
|
||||
|
@ -393,7 +393,7 @@ class openerp_dav_handler(dav_interface):
|
|||
cr.close()
|
||||
return True
|
||||
|
||||
def put(self,uri,data,content_type=None):
|
||||
def put(self, uri, data, content_type=None):
|
||||
""" put the object into the filesystem """
|
||||
self.parent.log_message('Putting %s (%d), %s'%( misc.ustr(uri), data and len(data) or 0, content_type))
|
||||
parent='/'.join(uri.split('/')[:-1])
|
||||
|
@ -401,7 +401,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if not dbname:
|
||||
raise DAV_Forbidden
|
||||
try:
|
||||
node = self.uri2object(cr,uid,pool, uri2[:])
|
||||
node = self.uri2object(cr, uid, pool, uri2[:])
|
||||
except:
|
||||
node = False
|
||||
|
||||
|
@ -409,11 +409,11 @@ class openerp_dav_handler(dav_interface):
|
|||
ext = objname.find('.') >0 and objname.split('.')[1] or False
|
||||
|
||||
if not node:
|
||||
dir_node = self.uri2object(cr,uid,pool, uri2[:-1])
|
||||
dir_node = self.uri2object(cr, uid, pool, uri2[:-1])
|
||||
if not dir_node:
|
||||
raise DAV_NotFound('Parent folder not found')
|
||||
try:
|
||||
dir_node.create_child(cr,objname,data)
|
||||
dir_node.create_child(cr, objname, data)
|
||||
except Exception,e:
|
||||
import traceback
|
||||
self.parent.log_error("Cannot create %s: %s", objname, str(e))
|
||||
|
@ -421,7 +421,7 @@ class openerp_dav_handler(dav_interface):
|
|||
raise DAV_Forbidden
|
||||
else:
|
||||
try:
|
||||
node.set_data(cr,data)
|
||||
node.set_data(cr, data)
|
||||
except Exception,e:
|
||||
import traceback
|
||||
self.parent.log_error("Cannot save %s: %s", objname, str(e))
|
||||
|
@ -433,7 +433,6 @@ class openerp_dav_handler(dav_interface):
|
|||
return 201
|
||||
|
||||
def rmcol(self,uri):
|
||||
print ' REMOVE COLLL :::::', uri
|
||||
""" delete a collection """
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
|
||||
|
@ -448,13 +447,12 @@ class openerp_dav_handler(dav_interface):
|
|||
return 204
|
||||
|
||||
def rm(self,uri):
|
||||
print ' REMOVE EVENT :::::', uri
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
cr, uid, pool,dbname, uri2 = self.get_cr(uri)
|
||||
if not dbname:
|
||||
cr.close()
|
||||
raise DAV_Error, 409
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
res = node.rm(cr)
|
||||
if not res:
|
||||
raise OSError(1, 'Operation not permited.')
|
||||
|
@ -467,7 +465,7 @@ class openerp_dav_handler(dav_interface):
|
|||
### a rm directly
|
||||
###
|
||||
|
||||
def delone(self,uri):
|
||||
def delone(self, uri):
|
||||
""" delete a single resource
|
||||
|
||||
You have to return a result dict of the form
|
||||
|
@ -480,7 +478,7 @@ class openerp_dav_handler(dav_interface):
|
|||
parent='/'.join(uri.split('/')[:-1])
|
||||
return res
|
||||
|
||||
def deltree(self,uri):
|
||||
def deltree(self, uri):
|
||||
""" delete a collection
|
||||
|
||||
You have to return a result dict of the form
|
||||
|
@ -488,7 +486,7 @@ class openerp_dav_handler(dav_interface):
|
|||
or None if everything's ok
|
||||
"""
|
||||
if uri[-1]=='/':uri=uri[:-1]
|
||||
res=deltree(self,uri)
|
||||
res=deltree(self, uri)
|
||||
parent='/'.join(uri.split('/')[:-1])
|
||||
return res
|
||||
|
||||
|
@ -497,7 +495,7 @@ class openerp_dav_handler(dav_interface):
|
|||
### MOVE handlers (examples)
|
||||
###
|
||||
|
||||
def moveone(self,src,dst,overwrite):
|
||||
def moveone(self, src, dst, overwrite):
|
||||
""" move one resource with Depth=0
|
||||
|
||||
an alternative implementation would be
|
||||
|
@ -514,10 +512,10 @@ class openerp_dav_handler(dav_interface):
|
|||
(untested!). This would not use the davcmd functions
|
||||
and thus can only detect errors directly on the root node.
|
||||
"""
|
||||
res=moveone(self,src,dst,overwrite)
|
||||
res=moveone(self, src, dst, overwrite)
|
||||
return res
|
||||
|
||||
def movetree(self,src,dst,overwrite):
|
||||
def movetree(self, src, dst, overwrite):
|
||||
""" move a collection with Depth=infinity
|
||||
|
||||
an alternative implementation would be
|
||||
|
@ -534,14 +532,14 @@ class openerp_dav_handler(dav_interface):
|
|||
(untested!). This would not use the davcmd functions
|
||||
and thus can only detect errors directly on the root node"""
|
||||
|
||||
res=movetree(self,src,dst,overwrite)
|
||||
res=movetree(self, src, dst, overwrite)
|
||||
return res
|
||||
|
||||
###
|
||||
### COPY handlers
|
||||
###
|
||||
|
||||
def copyone(self,src,dst,overwrite):
|
||||
def copyone(self, src, dst, overwrite):
|
||||
""" copy one resource with Depth=0
|
||||
|
||||
an alternative implementation would be
|
||||
|
@ -558,10 +556,10 @@ class openerp_dav_handler(dav_interface):
|
|||
(untested!). This would not use the davcmd functions
|
||||
and thus can only detect errors directly on the root node.
|
||||
"""
|
||||
res=copyone(self,src,dst,overwrite)
|
||||
res=copyone(self, src, dst, overwrite)
|
||||
return res
|
||||
|
||||
def copytree(self,src,dst,overwrite):
|
||||
def copytree(self, src, dst, overwrite):
|
||||
""" copy a collection with Depth=infinity
|
||||
|
||||
an alternative implementation would be
|
||||
|
@ -577,7 +575,7 @@ class openerp_dav_handler(dav_interface):
|
|||
|
||||
(untested!). This would not use the davcmd functions
|
||||
and thus can only detect errors directly on the root node"""
|
||||
res=copytree(self,src,dst,overwrite)
|
||||
res=copytree(self, src, dst, overwrite)
|
||||
return res
|
||||
|
||||
###
|
||||
|
@ -588,15 +586,15 @@ class openerp_dav_handler(dav_interface):
|
|||
### Look in davcmd.py for further details.
|
||||
###
|
||||
|
||||
def copy(self,src,dst):
|
||||
def copy(self, src, dst):
|
||||
src=urllib.unquote(src)
|
||||
dst=urllib.unquote(dst)
|
||||
ct = self._get_dav_getcontenttype(src)
|
||||
data = self.get_data(src)
|
||||
self.put(dst,data,ct)
|
||||
self.put(dst, data, ct)
|
||||
return 201
|
||||
|
||||
def copycol(self,src,dst):
|
||||
def copycol(self, src, dst):
|
||||
""" copy a collection.
|
||||
|
||||
As this is not recursive (the davserver recurses itself)
|
||||
|
@ -608,7 +606,7 @@ class openerp_dav_handler(dav_interface):
|
|||
return self.mkcol(dst)
|
||||
|
||||
|
||||
def exists(self,uri):
|
||||
def exists(self, uri):
|
||||
""" test if a resource exists """
|
||||
result = False
|
||||
cr, uid, pool,dbname, uri2 = self.get_cr(uri)
|
||||
|
@ -616,7 +614,7 @@ class openerp_dav_handler(dav_interface):
|
|||
if cr: cr.close()
|
||||
return True
|
||||
try:
|
||||
node = self.uri2object(cr,uid,pool, uri2)
|
||||
node = self.uri2object(cr, uid, pool, uri2)
|
||||
if node:
|
||||
result = True
|
||||
except:
|
||||
|
@ -625,6 +623,6 @@ class openerp_dav_handler(dav_interface):
|
|||
return result
|
||||
|
||||
@memoize(CACHE_SIZE)
|
||||
def is_collection(self,uri):
|
||||
def is_collection(self, uri):
|
||||
""" test if the given uri is a collection """
|
||||
return self._get_dav_resourcetype(uri)==COLLECTION
|
||||
|
|
|
@ -29,7 +29,7 @@ import tools
|
|||
|
||||
|
||||
super_mk_prop_response = PROPFIND.mk_prop_response
|
||||
def mk_prop_response(self,uri,good_props,bad_props,doc):
|
||||
def mk_prop_response(self, uri, good_props, bad_props, doc):
|
||||
""" make a new <prop> result element
|
||||
|
||||
We differ between the good props and the bad ones for
|
||||
|
|
|
@ -53,7 +53,6 @@ class DAVHandler(FixSendError,DAVRequestHandler):
|
|||
verbose = False
|
||||
|
||||
def get_userinfo(self,user,pw):
|
||||
print "get_userinfo"
|
||||
return False
|
||||
def _log(self, message):
|
||||
netsvc.Logger().notifyChannel("webdav",netsvc.LOG_DEBUG,message)
|
||||
|
@ -74,15 +73,15 @@ class DAVHandler(FixSendError,DAVRequestHandler):
|
|||
|
||||
def setup(self):
|
||||
davpath = '/'+config.get_misc('webdav','vdir','webdav')
|
||||
self.baseuri = "http://%s:%d/"% (self.server.server_name,self.server.server_port)
|
||||
self.baseuri = "http://%s:%d/"% (self.server.server_name, self.server.server_port)
|
||||
self.IFACE_CLASS = openerp_dav_handler(self, self.verbose)
|
||||
|
||||
|
||||
def log_message(self, format, *args):
|
||||
netsvc.Logger().notifyChannel('webdav',netsvc.LOG_DEBUG_RPC,format % args)
|
||||
netsvc.Logger().notifyChannel('webdav', netsvc.LOG_DEBUG_RPC, format % args)
|
||||
|
||||
def log_error(self, format, *args):
|
||||
netsvc.Logger().notifyChannel('xmlrpc',netsvc.LOG_WARNING,format % args)
|
||||
netsvc.Logger().notifyChannel('xmlrpc', netsvc.LOG_WARNING, format % args)
|
||||
|
||||
def do_PUT(self):
|
||||
dc=self.IFACE_CLASS
|
||||
|
@ -179,7 +178,7 @@ try:
|
|||
conf = OpenDAVConfig(**_dc)
|
||||
handler._config = conf
|
||||
reg_http_service(HTTPDir(directory,DAVHandler,OpenERPAuthProvider()))
|
||||
netsvc.Logger().notifyChannel('webdav',netsvc.LOG_INFO,"WebDAV service registered at path: %s/ "% directory)
|
||||
netsvc.Logger().notifyChannel('webdav', netsvc.LOG_INFO, "WebDAV service registered at path: %s/ "% directory)
|
||||
except Exception, e:
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel('webdav', netsvc.LOG_ERROR, 'Cannot launch webdav: %s' % e)
|
||||
|
|
|
@ -200,7 +200,7 @@ class event_registration(osv.osv):
|
|||
return super(event_registration, self).write(cr, uid, *args, **argv)
|
||||
|
||||
def mail_user_confirm(self, cr, uid, ids):
|
||||
reg_ids = self.browse(cr,uid,ids)
|
||||
reg_ids = self.browse(cr, uid, ids)
|
||||
for reg_id in reg_ids:
|
||||
src = reg_id.event_id.reply_to or False
|
||||
dest = []
|
||||
|
|
|
@ -47,13 +47,13 @@ class one2many_mod_task(fields.one2many):
|
|||
class event(osv.osv):
|
||||
_inherit = 'event.event'
|
||||
|
||||
def write(self, cr, uid, ids,vals, *args, **kwargs):
|
||||
def write(self, cr, uid, ids, vals, *args, **kwargs):
|
||||
if 'date_begin' in vals and vals['date_begin']:
|
||||
for eve in self.browse(cr, uid, ids):
|
||||
if eve.project_id:
|
||||
self.pool.get('project.project').write(cr, uid, [eve.project_id.id], {'date_end':eve.date_begin[:10]})
|
||||
|
||||
return super(event,self).write(cr, uid, ids,vals, *args, **kwargs)
|
||||
return super(event,self).write(cr, uid, ids, vals, *args, **kwargs)
|
||||
|
||||
_columns = {
|
||||
'project_id': fields.many2one('project.project', 'Project', readonly=True),
|
||||
|
|
|
@ -42,7 +42,7 @@ parameter_fields = {
|
|||
def _create_duplicate(self, cr, uid, data, context):
|
||||
event_obj=pooler.get_pool(cr.dbname).get('event.event')
|
||||
project_obj = pooler.get_pool(cr.dbname).get('project.project')
|
||||
duplicate_project_id= project_obj.copy(cr, uid,data['form']['project_id'], {'active': True})
|
||||
duplicate_project_id= project_obj.copy(cr, uid, data['form']['project_id'], {'active': True})
|
||||
project_obj.write(cr, uid, [duplicate_project_id], {'name': "copy of " + project_obj.browse(cr, uid, duplicate_project_id, context).name , 'date_start':time.strftime('%Y-%m-%d'),'date': event_obj.browse(cr, uid, [data['id']])[0].date_begin[0:10] })
|
||||
event_obj.write(cr, uid, [data['id']], {'project_id': duplicate_project_id })
|
||||
return {}
|
||||
|
|
|
@ -111,8 +111,8 @@ class hr_employee(osv.osv):
|
|||
'parent_id': fields.many2one('hr.employee', 'Manager', select=True),
|
||||
'category_id' : fields.many2one('hr.employee.category', 'Category'),
|
||||
'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'),
|
||||
'resource_id': fields.many2one('resource.resource','Resource',ondelete='cascade'),
|
||||
'coach_id': fields.many2one('res.users','Coach'),
|
||||
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade'),
|
||||
'coach_id': fields.many2one('res.users', 'Coach'),
|
||||
'job_id': fields.many2one('hr.job', 'Job'),
|
||||
'photo': fields.binary('Photo')
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ class res_users(osv.osv):
|
|||
for arg in args:
|
||||
if arg[0] == 'parent_id':
|
||||
parent = arg[2]
|
||||
child_ids = self._child_compute(cr, uid, parent,name, args, {})
|
||||
child_ids = self._child_compute(cr, uid, parent, name, args, {})
|
||||
if not child_ids:
|
||||
return [('id', 'in', [0])]
|
||||
return [('id', 'in', child_ids.get(uid,[]))]
|
||||
|
@ -155,14 +155,14 @@ class res_users(osv.osv):
|
|||
for arg in args:
|
||||
if arg[0] == 'child_ids':
|
||||
parent = arg[2]
|
||||
child_ids = self._child_compute(cr, uid, parent,name, args, {})
|
||||
child_ids = self._child_compute(cr, uid, parent, name, args, {})
|
||||
if not child_ids:
|
||||
return [('id', 'in', [0])]
|
||||
return [('id', 'in', child_ids.get(uid,[]))]
|
||||
|
||||
_columns = {
|
||||
'parent_id': fields.function(_parent_compute, relation='res.users',fnct_search=_parent_search, method=True, string="Managers", type='many2many'),
|
||||
'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search,method=True, string="Subordinates", type='many2many'),
|
||||
'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search, method=True, string="Subordinates", type='many2many'),
|
||||
'context_department_id': fields.many2one('hr.department', 'Departments'),
|
||||
}
|
||||
res_users()
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue