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 @@ - + - - - - + + + + + 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 @@