- [[ note or removeParentNode('blockTable') ]]
+ [[ note or removeParentNode('blockTable') ]]
|
[[ l.note ]]
@@ -326,11 +326,11 @@
-->
- [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]
- [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]
+ [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.name or '' ]]
+ [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.zip or '']] [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.city or '']]
- [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]]
- [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']]
+ [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.name or '' ]]
+ [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.zip or '']] [[ o.partner_bank_id and o.partner_bank_id.printBank and o.partner_bank_id.bank and o.partner_bank_id.bank.city or '']]
[[user.company_id.name]]
[[ user.company_id.partner_id.address[0].street ]]
[[ (user.company_id.partner_id.address[0].street2 or '')]]
@@ -357,12 +357,12 @@
-
+
[[ _space(_get_ref(o)) ]]
- [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]
- [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]]
+ [[ o.partner_bank_id and o.partner_bank_id.printAccount and o.partner_bank_id.bvr_number or '' ]]
+ [[ o.partner_bank_id and o.partner_bank_id.printAccount and o.partner_bank_id.bvr_number or '' ]]
[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]
[[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]]
@@ -375,7 +375,7 @@
-->
- [[mod10r('01'+str('%.2f' % o.amount_total).replace('.','').rjust(10,'0'))]]>[[ _get_ref(o) ]]+ [[o.partner_bank.bvr_number.split('-')[0]+(str(o.partner_bank.bvr_number.split('-')[1])).rjust(6,'0')+o.partner_bank.bvr_number.split('-')[2] ]]>
+ [[mod10r('01'+str('%.2f' % o.amount_total).replace('.','').rjust(10,'0'))]]>[[ _get_ref(o) ]]+ [[o.partner_bank_id.bvr_number.split('-')[0]+(str(o.partner_bank_id.bvr_number.split('-')[1])).rjust(6,'0')+o.partner_bank_id.bvr_number.split('-')[2] ]]>
diff --git a/addons/l10n_ch/wizard/wizard_bvr.py b/addons/l10n_ch/wizard/wizard_bvr.py
index 15bdb85b356..9d7d74b1bc1 100644
--- a/addons/l10n_ch/wizard/wizard_bvr.py
+++ b/addons/l10n_ch/wizard/wizard_bvr.py
@@ -39,22 +39,22 @@ def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
invoice_obj = pool.get('account.invoice')
for invoice in invoice_obj.browse(cr, uid, data['ids'], context):
- if not invoice.partner_bank:
+ if not invoice.partner_bank_id:
raise wizard.except_wizard(_('UserError'),
_('No bank specified on invoice:\n%s') % \
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
if not re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]').match(
- invoice.partner_bank.bvr_number or ''):
+ invoice.partner_bank_id.bvr_number or ''):
raise wizard.except_wizard(_('UserError'),
_('Your bank BVR number should be of the form 0X-XXX-X!\n' \
'Please check your company ' \
'information for the invoice:\n%s') % \
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
- if invoice.partner_bank.bvr_adherent_num \
+ if invoice.partner_bank_id.bvr_adherent_num \
and not re.compile('[0-9]*$').match(
- invoice.partner_bank.bvr_adherent_num):
+ invoice.partner_bank_id.bvr_adherent_num):
raise wizard.except_wizard(_('UserError'),
_('Your bank BVR adherent number must contain exactly seven' \
'digits!\nPlease check your company ' \
@@ -65,7 +65,7 @@ def _check(self, cr, uid, data, context):
class wizard_report(wizard.interface):
states = {
'init': {
- 'actions': [_check],
+ 'actions': [_check],
'result': {'type':'print', 'report':'l10n_ch.bvr', 'state':'end'}
}
}
diff --git a/addons/marketing_campaign/marketing_campaign.py b/addons/marketing_campaign/marketing_campaign.py
index 38707ace374..46e1e28ade7 100644
--- a/addons/marketing_campaign/marketing_campaign.py
+++ b/addons/marketing_campaign/marketing_campaign.py
@@ -83,13 +83,6 @@ class marketing_campaign(osv.osv):
_name = "marketing.campaign"
_description = "Marketing Campaign"
-
- def _check_has_start(self, cr, uid, ids, context=None):
- for campaign in self.browse(cr, uid, ids, context=context):
- if not any(a.start for a in campaign.activity_ids):
- return False
- return True
-
_columns = {
'name': fields.char('Name', size=64, required=True),
'object_id': fields.many2one('ir.model', 'Model', required=True,
@@ -121,29 +114,34 @@ Normal - the campaign runs normally and automatically sends all emails and repor
'state': lambda *a: 'draft',
'mode': lambda *a: 'test',
}
-
- _constraints = [(_check_has_start, 'Please mark at least one activity as a start activity', ['Activities'])]
def state_running_set(self, cr, uid, ids, *args):
# TODO check that all subcampaigns are running
campaign = self.browse(cr, uid, ids[0])
- if not campaign.activity_ids :
- raise osv.except_osv("Error", "There is no activitity in the campaign")
- activity_ids = [ act_id.id for act_id in campaign.activity_ids]
-
- if not activity_ids:
- raise osv.except_osv(_("Error"), _("The campaign cannot be started : there are no activities in it"))
-
- act_obj = self.pool.get('marketing.campaign.activity')
- act_ids = act_obj.search(cr, uid, [('id', 'in', activity_ids),
- ('type', '=', 'email')])
- for activity in act_obj.browse(cr, uid, act_ids):
- if not activity.email_template_id.enforce_from_account :
+
+ if not campaign.activity_ids:
+ raise osv.except_osv(_("Error"), _("The campaign cannot be started: there are no activities in it"))
+
+ has_start = False
+ has_signal_without_from = False
+
+ for activity in campaign.activity_ids:
+ if activity.start:
+ has_start = True
+ if activity.signal and len(activity.from_ids) == 0:
+ has_signal_without_from = True
+
+ if activity.type != 'email':
+ continue
+ if not activity.email_template_id.enforce_from_account:
raise osv.except_osv(_("Error"), _("The campaign cannot be started: an email account is missing in the email activity '%s'")%activity.name)
- if activity.email_template_id.enforce_from_account.state != 'approved' :
+ if activity.email_template_id.enforce_from_account.state != 'approved':
raise osv.except_osv(_("Error"), _("The campaign cannot be started: the email account is not approved in the email activity '%s'")%activity.name)
- self.write(cr, uid, ids, {'state': 'running'})
- return True
+
+ if not has_start and not has_signal_without_from:
+ raise osv.except_osv(_("Error"), _("The campaign hasn't any starting activity nor any activity with a signal and no previous activity."))
+
+ return self.write(cr, uid, ids, {'state': 'running'})
def state_done_set(self, cr, uid, ids, *args):
# TODO check that this campaign is not a subcampaign in running mode.
diff --git a/addons/olap/data/olap_cube_view.xml b/addons/olap/data/olap_cube_view.xml
index bd30efeafe7..a93f59c2759 100644
--- a/addons/olap/data/olap_cube_view.xml
+++ b/addons/olap/data/olap_cube_view.xml
@@ -78,8 +78,8 @@
|