@@ -1032,23 +1032,10 @@ class account_move(osv.osv):
|
||||
}, context, check=False)
|
||||
ok = False
|
||||
if ok:
|
||||
obj_line=self.browse(cr, uid, ids[0])
|
||||
for move in self.browse(cr, uid, ids, context):
|
||||
for obj_line in move.line_id:
|
||||
#create analytic lines
|
||||
if obj_line.analytic_account_id:
|
||||
vals_lines={
|
||||
'name': obj_line.name,
|
||||
'date': obj_line.date,
|
||||
'account_id': obj_line.analytic_account_id.id,
|
||||
'unit_amount':obj_line.quantity,
|
||||
'amount': obj_line.debit or obj_line.credit,
|
||||
'general_account_id': obj_line.account_id.id,
|
||||
'journal_id': obj_line.journal_id.analytic_journal_id.id,
|
||||
'ref': obj_line.ref,
|
||||
'move_id':obj_line.id
|
||||
}
|
||||
self.pool.get('account.analytic.line').create(cr,uid,vals_lines)
|
||||
list_ids = []
|
||||
for tmp in move.line_id:
|
||||
list_ids.append(tmp.id)
|
||||
self.pool.get('account.move.line').create_analytic_lines(cr, uid, list_ids, context)
|
||||
return ok
|
||||
account_move()
|
||||
|
||||
|
||||
@@ -58,6 +58,24 @@ class account_move_line(osv.osv):
|
||||
del data[f]
|
||||
return data
|
||||
|
||||
def create_analytic_lines(self, cr, uid, ids, context={}):
|
||||
for obj_line in self.browse(cr, uid, ids, context):
|
||||
if obj_line.analytic_account_id:
|
||||
amt = (obj_line.credit or 0.0) - (obj_line.debit or 0.0)
|
||||
vals_lines={
|
||||
'name': obj_line.name,
|
||||
'date': obj_line.date,
|
||||
'account_id': obj_line.analytic_account_id.id,
|
||||
'unit_amount':obj_line.quantity,
|
||||
'amount': amt,
|
||||
'general_account_id': obj_line.account_id.id,
|
||||
'journal_id': obj_line.journal_id.analytic_journal_id.id,
|
||||
'ref': obj_line.ref,
|
||||
'move_id':obj_line.id
|
||||
}
|
||||
new_id = self.pool.get('account.analytic.line').create(cr,uid,vals_lines)
|
||||
return True
|
||||
|
||||
def _default_get(self, cr, uid, fields, context={}):
|
||||
# Compute simple values
|
||||
data = super(account_move_line, self).default_get(cr, uid, fields, context)
|
||||
|
||||
@@ -280,21 +280,15 @@ class account_move_line(osv.osv):
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||
}
|
||||
|
||||
def _analytic_update(self, cr, uid, ids, context):
|
||||
if self.called:
|
||||
self.called=False
|
||||
return False
|
||||
|
||||
obj_line=self.pool.get('account.analytic.line')
|
||||
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
def create_analytic_lines(self, cr, uid, ids, context={}):
|
||||
super(account_move_line, self).create_analytic_lines(cr, uid, ids, context)
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
if line.analytics_id:
|
||||
toremove = obj_line.search(cr, uid, [('move_id','=',line.id)], context=context)
|
||||
toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context)
|
||||
if toremove:
|
||||
obj_line.unlink(cr, uid, toremove, context=context)
|
||||
|
||||
obj_line.unlink(cr, uid, toremove, context=context)
|
||||
for line2 in line.analytics_id.account_ids:
|
||||
val = (line.debit or 0.0) - (line.credit or 0.0)
|
||||
val = (line.credit or 0.0) - (line.debit or 0.0)
|
||||
amt=val * (line2.rate/100)
|
||||
al_vals={
|
||||
'name': line.name,
|
||||
@@ -309,25 +303,7 @@ class account_move_line(osv.osv):
|
||||
'ref': line.ref,
|
||||
}
|
||||
ali_id=self.pool.get('account.analytic.line').create(cr,uid,al_vals)
|
||||
self.called=True
|
||||
return True
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
self.called=False
|
||||
if ('analytics_id' in vals) and (not vals['analytics_id']):
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context)
|
||||
if toremove:
|
||||
self.pool.get('account.analytic.line').unlink(cr, uid, toremove, context=context)
|
||||
result = super(account_move_line, self).write(cr, uid, ids, vals, context, check, update_check)
|
||||
self._analytic_update(cr, uid, ids, context)
|
||||
return result
|
||||
|
||||
def create(self, cr, uid, vals, context=None, check=True):
|
||||
self.called=False
|
||||
result = super(account_move_line, self).create(cr, uid, vals, context, check)
|
||||
self._analytic_update(cr, uid, [result], context)
|
||||
return result
|
||||
return True
|
||||
|
||||
account_move_line()
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ form = '''<?xml version="1.0"?>
|
||||
</form>'''
|
||||
|
||||
fields = {
|
||||
'file': {'string':'Select a PDF File', 'type':'binary','required':True,'filters':['*.pdf']},
|
||||
'file': {'string':'Select a PDF File', 'type':'binary','required':True,'filters':'*.pdf'},
|
||||
}
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ class report_custom(report_int):
|
||||
obj_user=pool.get('res.users').browse(cr,uid,uid)
|
||||
self.list['printing_user']=obj_user.name
|
||||
self.list['company_name']=obj_user.company_id.name
|
||||
self.list['company_country']=obj_user.company_id.partner_id.country
|
||||
self.list['company_vat']=obj_user.company_id.partner_id.vat
|
||||
self.list['printing_time']=time.strftime('%H:%M:%S')
|
||||
self.list['printing_date']=time.strftime('%D')
|
||||
|
||||
+27
-27
@@ -594,30 +594,25 @@ class crm_case(osv.osv):
|
||||
if case.user_id.signature:
|
||||
body += '\n\n%s' % (case.user_id.signature)
|
||||
dest = [dest]
|
||||
if not attach:
|
||||
tools.email_send(
|
||||
src,
|
||||
dest,
|
||||
'Reminder: '+'['+str(case.id)+']'+' '+case.name,
|
||||
body,
|
||||
reply_to=case.section_id.reply_to, tinycrm=str(case.id)
|
||||
)
|
||||
else:
|
||||
attach_ids = self.pool.get('ir.attachment').search(cr, uid,
|
||||
[('res_model', '=', 'crm.case'),
|
||||
('res_id', '=', case.id)])
|
||||
res = self.pool.get('ir.attachment').read(cr, uid,
|
||||
attach_ids, ['datas_fname','datas'])
|
||||
res = map(lambda x: (x['datas_fname'],
|
||||
base64.decodestring(x['datas'])), res)
|
||||
tools.email_send_attach(
|
||||
src,
|
||||
dest,
|
||||
'Reminder: '+'['+str(case.id)+']'+' '+case.name,
|
||||
body,
|
||||
reply_to=case.section_id.reply_to,
|
||||
attach=res, tinycrm=str(case.id)
|
||||
)
|
||||
|
||||
attach_to_send = None
|
||||
|
||||
if attach:
|
||||
attach_ids = self.pool.get('ir.attachment').search(cr, uid, [('res_model', '=', 'crm.case'), ('res_id', '=', case.id)])
|
||||
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, attach_ids, ['datas_fname','datas'])
|
||||
attach_to_send = map(lambda x: (x['datas_fname'], base64.decodestring(x['datas'])), attach_to_send)
|
||||
|
||||
# Send an email
|
||||
tools.email_send(
|
||||
src,
|
||||
dest,
|
||||
"Reminder: [%s] %s" % (str(case.id), case.name, ),
|
||||
body,
|
||||
reply_to=case.section_id.reply_to,
|
||||
tinycrm=str(case.id),
|
||||
attach=attach_to_send
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
def add_reply(self, cursor, user, ids, context=None):
|
||||
@@ -653,9 +648,14 @@ class crm_case(osv.osv):
|
||||
body = case.description
|
||||
if case.user_id.signature:
|
||||
body += '\n\n%s' % (case.user_id.signature)
|
||||
tools.email_send(case.user_id.address_id.email, emails,
|
||||
'['+str(case.id)+'] '+case.name, body,
|
||||
reply_to=case.section_id.reply_to, tinycrm=str(case.id))
|
||||
tools.email_send(
|
||||
case.user_id.address_id.email,
|
||||
emails,
|
||||
'['+str(case.id)+'] '+case.name,
|
||||
body,
|
||||
reply_to=case.section_id.reply_to,
|
||||
tinycrm=str(case.id)
|
||||
)
|
||||
return True
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part, email=False):
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
{
|
||||
"name" : "Suport for iCal based on Document Management System",
|
||||
"name" : "Support for iCal based on Document Management System",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"category" : "Generic Modules/Others",
|
||||
|
||||
Reference in New Issue
Block a user