[MERGE] Merge from trunk addons
bzr revid: mra@mra-laptop-20101001035717-mbe3yjj16m3imxsl
This commit is contained in:
commit
99273fdc67
|
@ -132,7 +132,7 @@ class report_aged_receivable(osv.osv):
|
|||
|
||||
while (last_month_date > fy_start_date):
|
||||
LIST_RANGES.append(today + " to " + last_month_date.strftime('%Y-%m-%d'))
|
||||
today = (last_month_date- 1).strftime('%Y-%m-%d')
|
||||
today = (last_month_date- relativedelta(days=1)).strftime('%Y-%m-%d')
|
||||
last_month_date = datetime.strptime(today, '%Y-%m-%d') - relativedelta(months=1)
|
||||
|
||||
LIST_RANGES.append(today +" to " + fy_start_date.strftime('%Y-%m-%d'))
|
||||
|
|
|
@ -42,11 +42,7 @@
|
|||
if l.reconcile_id:
|
||||
reconciled = True
|
||||
break
|
||||
if not reconciled:
|
||||
print "Info: Voucher is not paid"
|
||||
else:
|
||||
print "Info: Voucher is paid"
|
||||
|
||||
assert (not reconciled), "Found reconciled move lines, should not be"
|
||||
-
|
||||
I create and post a voucher payment of amount 30000.0 for the partner Seagate
|
||||
-
|
||||
|
@ -74,8 +70,6 @@
|
|||
assert (voucher_id.state=='draft'), "Voucher is not in draft state"
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
|
||||
|
||||
|
||||
-
|
||||
I check that move lines are reconciled meaning voucher is paid
|
||||
-
|
||||
|
@ -85,7 +79,4 @@
|
|||
if l.reconcile_id:
|
||||
reconciled = True
|
||||
break
|
||||
if not reconciled:
|
||||
print "Info: Voucher is not paid"
|
||||
else:
|
||||
print "Info: Voucher is paid"
|
||||
assert reconciled, "Found unreconciled move lines/unpaid voucher"
|
||||
|
|
|
@ -113,6 +113,8 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),
|
||||
'act_email_from' : fields.char('Email From', size=64, required=False,
|
||||
help="Use a python expression to specify the right field on which one than we will use for the 'From' field of the header"),
|
||||
'act_email_to' : fields.char('Email To', size=64, required=False,
|
||||
help="Use a python expression to specify the right field on which one than we will use for the 'To' field of the header"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
@ -356,13 +358,20 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
emails += (action.act_email_cc or '').split(',')
|
||||
if action.act_mail_to_email:
|
||||
emails += (action.act_mail_to_email or '').split(',')
|
||||
|
||||
locals_for_emails = {
|
||||
'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
|
||||
'obj' : obj,
|
||||
}
|
||||
|
||||
if action.act_email_to:
|
||||
emails.append(safe_eval(action.act_email_to, {}, locals_for_emails))
|
||||
|
||||
emails = filter(None, emails)
|
||||
if len(emails) and action.act_mail_body:
|
||||
emails = list(set(emails))
|
||||
email_from = safe_eval(action.act_email_from, {}, {
|
||||
'user' : self.pool.get('res.users').browse(cr, uid, uid, context=context),
|
||||
'obj' : obj,
|
||||
})
|
||||
email_from = safe_eval(action.act_email_from, {}, locals_for_emails)
|
||||
|
||||
def to_email(text):
|
||||
return re.findall(r'([^ ,<@]+@[^> ,]+)', text or '')
|
||||
emails = to_email(','.join(filter(None, emails)))
|
||||
|
|
|
@ -65,12 +65,13 @@
|
|||
<group col="2" colspan="2" attrs="{'invisible': [('act_remind_user','=',False)]}">
|
||||
<field name="act_reply_to" attrs="{'required':[('act_remind_user','=',True)]}"/>
|
||||
</group>
|
||||
<separator colspan="4" string="Email Information"/>
|
||||
<separator colspan="4" string="Email Information"/>
|
||||
<field name="act_email_from" />
|
||||
<field name="act_mail_to_user"/>
|
||||
<field colspan="4" name="act_mail_to_email"/>
|
||||
<field name="act_mail_to_watchers"/>
|
||||
<field colspan="4" name="act_email_cc"/>
|
||||
<field name="act_email_to" />
|
||||
<field name="act_mail_to_user"/>
|
||||
<field colspan="4" name="act_mail_to_email"/>
|
||||
<field name="act_mail_to_watchers"/>
|
||||
<field colspan="4" name="act_email_cc"/>
|
||||
<separator colspan="4" string="Email Body"/>
|
||||
<field colspan="4" name="act_mail_body" height="250"
|
||||
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
|
||||
|
|
|
@ -185,14 +185,16 @@ class crm_lead(crm_case, osv.osv):
|
|||
@param *args: Give Tuple Value
|
||||
"""
|
||||
old_state = self.read(cr, uid, ids, ['state'])[0]['state']
|
||||
old_stage_id = self.read(cr, uid, ids, ['stage_id'])[0]['stage_id']
|
||||
res = super(crm_lead, self).case_open(cr, uid, ids, *args)
|
||||
if old_state == 'draft':
|
||||
stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args)
|
||||
if stage_id:
|
||||
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
|
||||
else:
|
||||
value = {}
|
||||
value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
|
||||
value = {}
|
||||
if not old_stage_id:
|
||||
stage_id = super(crm_lead, self).stage_next(cr, uid, ids, *args)
|
||||
if stage_id:
|
||||
value.update({'stage_id': stage_id})
|
||||
value.update(self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value'])
|
||||
value.update({'date_open': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
self.write(cr, uid, ids, value)
|
||||
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
<button name="case_open" string="Open"
|
||||
states="draft,pending" type="object"
|
||||
icon="gtk-go-forward" />
|
||||
<button name="case_close" string="Close"
|
||||
<button name="case_mark_lost" string="Close"
|
||||
states="open,draft,pending" type="object"
|
||||
icon="gtk-close" />
|
||||
<button name="case_pending" string="Pending"
|
||||
|
|
|
@ -327,7 +327,7 @@ class mailgate_tool(osv.osv_memory):
|
|||
msg['to'] = email_error
|
||||
tools.misc._email_send(smtp_from, self.to_email(email_error), msg, openobject_id=res.id)
|
||||
|
||||
def process_email(self, cr, uid, model, message, attach=True, context=None):
|
||||
def process_email(self, cr, uid, model, message, custom_values=None, attach=True, context=None):
|
||||
"""This function Processes email and create record for given OpenERP model
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
|
@ -346,6 +346,9 @@ class mailgate_tool(osv.osv_memory):
|
|||
if not context:
|
||||
context = {}
|
||||
|
||||
if custom_values is None or not isinstance(custom_values, dict):
|
||||
custom_values = {}
|
||||
|
||||
model_pool = self.pool.get(model)
|
||||
res_id = False
|
||||
|
||||
|
@ -354,6 +357,8 @@ class mailgate_tool(osv.osv_memory):
|
|||
att_ids = []
|
||||
if hasattr(model_pool, 'message_new'):
|
||||
res_id = model_pool.message_new(cr, uid, msg, context)
|
||||
if custom_values:
|
||||
model_pool.write(cr, uid, [res_id], custom_values, context=context)
|
||||
else:
|
||||
data = {
|
||||
'name': msg.get('subject'),
|
||||
|
|
|
@ -28,7 +28,7 @@ import xmlrpclib
|
|||
import email
|
||||
|
||||
class rpc_proxy(object):
|
||||
def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'):
|
||||
def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='openerp'):
|
||||
self.rpc = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (host, port, path), allow_none=True)
|
||||
self.user_id = uid
|
||||
self.passwd = passwd
|
||||
|
@ -49,11 +49,13 @@ class email_parser(object):
|
|||
self.email_default = email_default
|
||||
|
||||
|
||||
def parse(self, message):
|
||||
def parse(self, message, custom_values=None):
|
||||
if custom_values is None:
|
||||
custom_values = {}
|
||||
try:
|
||||
# pass message as bytes because we don't know its encoding until we parse its headers
|
||||
# and hence can't convert it to utf-8 for transport
|
||||
res_id = self.rpc('email.server.tools', 'process_email', self.model, xmlrpclib.Binary(message))
|
||||
res_id = self.rpc('email.server.tools', 'process_email', self.model, xmlrpclib.Binary(message), custom_values)
|
||||
except Exception, e:
|
||||
logger = logging.getLogger('mail-gateway')
|
||||
logger.warning('Failed to process incoming email. Source of the failed mail is available at debug level.', exc_info=True)
|
||||
|
@ -70,9 +72,10 @@ if __name__ == '__main__':
|
|||
parser.add_option("-p", "--password", dest="password", help="Password of the user in OpenERP", default='admin')
|
||||
parser.add_option("-o", "--model", dest="model", help="Name or ID of crm model", default="crm.lead")
|
||||
parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None)
|
||||
parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: terp)", default='terp')
|
||||
parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: openerp)", default='openerp')
|
||||
parser.add_option("--host", dest="host", help="Hostname of the OpenERP Server", default="localhost")
|
||||
parser.add_option("--port", dest="port", help="Port of the OpenERP Server", default="8069")
|
||||
parser.add_option("--custom-values", dest="custom_values", help="Add Custom Values to the object", default=None)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
@ -82,6 +85,12 @@ if __name__ == '__main__':
|
|||
|
||||
msg_txt = sys.stdin.read()
|
||||
|
||||
parser.parse(msg_txt)
|
||||
custom_values = {}
|
||||
try:
|
||||
custom_values = dict(eval(options.custom_values))
|
||||
except:
|
||||
pass
|
||||
|
||||
parser.parse(msg_txt, custom_values)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -231,6 +231,7 @@
|
|||
/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" string="Name"/>
|
||||
<field name="partner_id" string="Partner" />
|
||||
<field name="user_id"/>
|
||||
<field name="project_id" string="Project"/>
|
||||
<field name="categ_id"/>
|
||||
|
|
Loading…
Reference in New Issue