diff options
| author | sbh (Open ERP) <sbh@tinyerp.com> | 2010-10-01 10:25:33 +0530 |
|---|---|---|
| committer | sbh (Open ERP) <sbh@tinyerp.com> | 2010-10-01 10:25:33 +0530 |
| commit | 29335f2cae1ddd5eaedfc0522c80e4e66ea59b51 (patch) | |
| tree | b911acdc521b60f367e454fdaf138bc4cc3c7e81 | |
| parent | 6f2bb74f1519e7d0382e6ec1c4a25e47758f91b8 (diff) | |
| parent | 7b4cae7e4cbcfe64d3c1c2b48dd21d7c463bc313 (diff) | |
[MERGE] : Merge with lp:openobject-addons
bzr revid: sbh@tinyerp.com-20101001045533-7ofs6p8iuy91gn40
| -rw-r--r-- | addons/account/report/account_report.py | 2 | ||||
| -rw-r--r-- | addons/account_voucher/test/sales_receipt.yml | 13 | ||||
| -rw-r--r-- | addons/base_action_rule/base_action_rule.py | 17 | ||||
| -rw-r--r-- | addons/base_action_rule/base_action_rule_view.xml | 11 | ||||
| -rw-r--r-- | addons/crm/crm_lead.py | 14 | ||||
| -rw-r--r-- | addons/crm/crm_lead_view.xml | 2 | ||||
| -rw-r--r-- | addons/mail_gateway/mail_gateway.py | 7 | ||||
| -rwxr-xr-x | addons/mail_gateway/scripts/openerp_mailgate/openerp_mailgate.py | 19 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 1 |
9 files changed, 52 insertions, 34 deletions
diff --git a/addons/account/report/account_report.py b/addons/account/report/account_report.py index b7d3441913f..1136300f065 100644 --- a/addons/account/report/account_report.py +++ b/addons/account/report/account_report.py @@ -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')) diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index af10d614730..628d1795bc8 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -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"
\ No newline at end of file + assert reconciled, "Found unreconciled move lines/unpaid voucher" diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index f31f10c4060..9a2d720cc1a 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -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))) diff --git a/addons/base_action_rule/base_action_rule_view.xml b/addons/base_action_rule/base_action_rule_view.xml index 755f6680d34..01951b3c9b8 100644 --- a/addons/base_action_rule/base_action_rule_view.xml +++ b/addons/base_action_rule/base_action_rule_view.xml @@ -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)]}" /> diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index cdc3553dc0e..76260082602 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -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): diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 40317a4b188..2cbd1581ff5 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -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" diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index c775b97d520..2f14fc6a5e5 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -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'), diff --git a/addons/mail_gateway/scripts/openerp_mailgate/openerp_mailgate.py b/addons/mail_gateway/scripts/openerp_mailgate/openerp_mailgate.py index 1fed4388e3d..879d3d37029 100755 --- a/addons/mail_gateway/scripts/openerp_mailgate/openerp_mailgate.py +++ b/addons/mail_gateway/scripts/openerp_mailgate/openerp_mailgate.py @@ -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: diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 56677c61a61..ef4ecdd3957 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -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"/> |
