diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 82ceb2aab70..b2ca2af3b0b 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -202,6 +202,10 @@ class invite_attendee_wizard(osv.osv_memory):
to send an Email to Invited Person')
}
+ _defaults = {
+ 'type': lambda *x: 'internal'
+ }
+
def do_invite(self, cr, uid, ids, context={}):
datas = self.read(cr, uid, ids)[0]
model = False
@@ -224,12 +228,10 @@ class invite_attendee_wizard(osv.osv_memory):
user_obj = self.pool.get('res.users')
for user_id in datas.get('user_ids', []):
user = user_obj.browse(cr, uid, user_id)
- if not user.address_id.email:
- raise osv.except_osv(_('Error!'), \
- ("User does not have an email Address"))
vals.update({'user_id': user_id,
'email': user.address_id.email})
- mail_to.append(user.address_id.email)
+ if user.address_id.email:
+ mail_to.append(user.address_id.email)
elif type == 'external' and datas.get('email'):
vals.update({'email': datas['email']})
@@ -237,13 +239,11 @@ class invite_attendee_wizard(osv.osv_memory):
elif type == 'partner':
add_obj = self.pool.get('res.partner.address')
for contact in add_obj.browse(cr, uid, datas['contact_ids']):
- if not contact.email:
- raise osv.except_osv(_('Error!'), \
- ("Partner does not have an email Address"))
vals.update({
'partner_address_id': contact.id,
'email': contact.email})
- mail_to.append(contact.email)
+ if contact.email:
+ mail_to.append(contact.email)
if model == 'calendar.attendee':
att = att_obj.browse(cr, uid, context['active_id'])
@@ -256,9 +256,14 @@ class invite_attendee_wizard(osv.osv_memory):
obj.write(cr, uid, res_obj.id, {model_field: [(4, att_id)]})
if datas.get('send_mail'):
+ if not mail_to:
+ name = map(lambda x: x[1], filter(lambda x: type==x[0], \
+ self._columns['type'].selection))
+ raise osv.except_osv(_('Error!'), ("%s must have an email \
+Address to send mail") % (name[0]))
att_obj._send_mail(cr, uid, [att_id], mail_to, \
email_from=tools.config.get('email_from', False))
-
+
return {}
@@ -268,10 +273,6 @@ class invite_attendee_wizard(osv.osv_memory):
cr.execute('select id from res_partner_address \
where partner_id=%s' % (partner_id))
contacts = map(lambda x: x[0], cr.fetchall())
- if not contacts:
- raise osv.except_osv(_('Error!'), \
- ("Partner does not have any Contacts"))
-
return {'value': {'contact_ids': contacts}}
invite_attendee_wizard()
@@ -398,7 +399,7 @@ request was delegated to"),
'user_id': fields.many2one('res.users', 'User'),
'partner_address_id': fields.many2one('res.partner.address', 'Contact'),
'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', relation='res.partner', string='Partner', help="Partner related to contact"),
- 'email': fields.char('Email', size=124, required=True, help="Email of Invited Person"),
+ 'email': fields.char('Email', size=124, help="Email of Invited Person"),
'event_date': fields.function(_compute_data, method=True, string='Event Date', type="datetime", multi='event_date'),
'event_end_date': fields.function(_compute_data, method=True, string='Event End Date', type="datetime", multi='event_end_date'),
'ref': fields.reference('Event Ref', selection=_links_get, size=128),
@@ -480,6 +481,17 @@ request was delegated to"),
self.write(cr, uid, ids, {'state': 'tentative'}, context)
def do_accept(self, cr, uid, ids, context=None, *args):
+ vals = self.read(cr, uid, ids, context=context)[0]
+ user = vals.get('user_id')
+ if user:
+ ref = vals.get('ref', None)
+ if ref:
+ model, event = ref.split(',')
+ model_obj = self.pool.get(model)
+ event_ref = model_obj.browse(cr, uid, event, context=context)[0]
+ if event_ref.user_id.id != user[0]:
+ defaults = {'user_id': user[0]}
+ new_event = model_obj.copy(cr, uid, event, default=defaults, context=context)
self.write(cr, uid, ids, {'state': 'accepted'}, context)
def do_decline(self, cr, uid, ids, context=None, *args):
@@ -708,26 +720,21 @@ class calendar_event(osv.osv):
'interval': 1})
return {'value': {'rrule': rrulestr}}
- def _get_duration(self, cr, uid, ids, name, arg, context):
- res = {}
- for event in self.browse(cr, uid, ids, context=context):
- start = datetime.strptime(event.date, "%Y-%m-%d %H:%M:%S")
- res[event.id] = 0
- if event.date_deadline:
- end = datetime.strptime(event.date_deadline[:19], "%Y-%m-%d %H:%M:%S")
- diff = end - start
- duration = float(diff.days)* 24 + (float(diff.seconds) / 3600)
- res[event.id] = round(duration, 2)
- return res
+ def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, context={}):
+ if not start_date:
+ return {}
+ start = datetime.strptime(start_date, "%Y-%m-%d %H:%M:%S")
+ value = {}
+ if end_date and not duration:
+ end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
+ diff = end - start
+ duration = float(diff.days)* 24 + (float(diff.seconds) / 3600)
+ value['duration'] = round(duration, 2)
+ elif not end_date:
+ end = start + timedelta(hours=duration)
+ value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
+ return {'value': value}
- def _set_duration(self, cr, uid, id, name, value, arg, context):
- event = self.browse(cr, uid, id, context=context)
- start = datetime.strptime(event.date, "%Y-%m-%d %H:%M:%S")
- end = start + timedelta(hours=value)
- cr.execute("UPDATE %s set date_deadline='%s' \
- where id=%s"% (self._table, end.strftime("%Y-%m-%d %H:%M:%S"), id))
- return True
-
_columns = {
'id': fields.integer('ID'),
'sequence': fields.integer('Sequence'),
@@ -735,8 +742,7 @@ class calendar_event(osv.osv):
'date': fields.datetime('Date'),
'date_deadline': fields.datetime('Deadline'),
'create_date': fields.datetime('Created', readonly=True),
- 'duration': fields.function(_get_duration, method=True, \
- fnct_inv=_set_duration, string='Duration'),
+ 'duration': fields.float('Duration'),
'description': fields.text('Your action'),
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
('confidential', 'Confidential')], 'Mark as'),
@@ -757,25 +763,15 @@ rule or repeating pattern for anexception to a recurrence set"),
'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
'recurrent_uid': fields.integer('Recurrent ID'),
'recurrent_id': fields.datetime('Recurrent ID date'),
- 'vtimezone': fields.selection(_tz_get, 'Timezone', size=64),
+ 'vtimezone': fields.related('user_id', 'context_tz', type='char', size=24, string='Timezone'),
'user_id': fields.many2one('res.users', 'Responsible'),
}
-
+
_defaults = {
'class': lambda *a: 'public',
'show_as': lambda *a: 'busy',
}
- def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv):
- if not user_id:
- return {'value': {'vtimezone': False}}
- value = {'vtimezone': False}
- cr.execute('select context_tz from res_users where id=%s' % (user_id))
- timezone = cr.fetchone()[0]
- if timezone:
- value.update({'vtimezone': timezone.lower()})
- return {'value': value}
-
def modify_this(self, cr, uid, ids, defaults, context=None, *args):
datas = self.read(cr, uid, ids[0], context=context)
defaults.update({
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index 9039f00381c..c81f6040a3d 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -29,7 +29,7 @@
+
+
+
+ hr_evaluation.plan.form
+ hr_evaluation.plan
+ tree
+
+
+
+
+
+
+
+
+
+
+ hr_evaluation.plan
+ form
+ tree,form
+
+
+
+
-
- hr_evaluation.plan.phase.form
- hr_evaluation.plan.phase
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- hr_evaluation.plan.phase.form
- hr_evaluation.plan.phase
- tree
-
-
-
-
-
-
-
-
-
-
+
+ hr_evaluation.plan.phase.form
+ hr_evaluation.plan.phase
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_evaluation.plan.phase.form
+ hr_evaluation.plan.phase
+ tree
+
+
+
+
+
+
+
+
+
+
-
+
hr.hr.employee.view.form
hr.employee
-
-
+
+
- hr_evaluation.evaluation.form
- hr_evaluation.evaluation
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- hr_evaluation.evaluation.form
+ hr_evaluation.evaluation
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- hr_evaluation.evaluation.form
- hr_evaluation.evaluation
- tree
-
-
-
-
-
-
-
-
- hr_evaluation.evaluation
- form
- tree,form
-
-
+
+
+
+ hr_evaluation.evaluation.tree
+ hr_evaluation.evaluation
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr_evaluation.evaluation
+ form
+ tree,form
+
+
-
- hr_evaluation.interview.form
- hr.evaluation.interview
- form
-
+
+ hr_evaluation.interview.form
+ hr.evaluation.interview
+ form
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
- hr_evaluation.interview.tree
- hr.evaluation.interview
- tree
-
-
+
+
+
+ hr_evaluation.interview.tree
+ hr.evaluation.interview
+ tree
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
- hr.evaluation.interview
- form
- tree,form
-
+
+ hr.evaluation.interview
+ form
+ tree,form
+
-
+
-
+
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index ef80a9e0f1c..bab890a9268 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/addons/project_long_term/project_view.xml b/addons/project_long_term/project_view.xml
index be7b8de5977..696176fc2f9 100644
--- a/addons/project_long_term/project_view.xml
+++ b/addons/project_long_term/project_view.xml
@@ -97,6 +97,7 @@
+
@@ -105,11 +106,64 @@
+
+ project.phase.calendar
+ project.phase
+ calendar
+
+
+
+
+
+
+
+
+
+
+ project.phase.gantt
+ project.phase
+ gantt
+
+
+
+
+
+
+
+
+
+
+
+ project.phase.search
+ project.phase
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Project phases
project.phase
form
+ tree,form,calendar,gantt
+
diff --git a/addons/sale/report_sale_view.xml b/addons/sale/report_sale_view.xml
index 286a529cf82..30816750035 100644
--- a/addons/sale/report_sale_view.xml
+++ b/addons/sale/report_sale_view.xml
@@ -1,89 +1,6 @@
-
- report.sale.order.tree
- sale.order
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sale Orders By Partner
- sale.order
- form
- graph,tree
- {'report':True}
- [('date_order','>=',time.strftime('%Y-%m-01')),('state','<>','draft'),('state','<>','cancel')]
-
-
-
-
- tree
-
-
-
-
-
- graph
-
-
-
-
-
-
-
- report.sale.order.line.tree
- sale.order.line
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sale Orders by Product
- sale.order.line
- form
- graph,tree
- {'report':True}
- [('product_uom_qty','!=','0')]
-
-
-
-
- tree
-
-
-
-
-
- graph
-
-
-
-
-
-
+
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index a9d0935fc76..0c0542d6747 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -197,7 +197,8 @@ class sale_order(osv.osv):
('cancel', 'Cancelled')
], 'Order State', readonly=True, help="Gives the state of the quotation or sale order. The exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception) or in the picking list process (Shipping Exception). The 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the date 'Ordered Date'.", select=True),
'date_order': fields.date('Ordered Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
-
+ 'create_date': fields.date('Creation Date', readonly=True),
+ 'date_confirm': fields.date('Confirmation Date', readonly=True),
'user_id': fields.many2one('res.users', 'Salesman', states={'draft': [('readonly', False)]}, select=True),
'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)]}, required=True, change_default=True, select=True),
'partner_invoice_id': fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)]}),
@@ -361,10 +362,10 @@ class sale_order(osv.osv):
def button_dummy(self, cr, uid, ids, context={}):
return True
-#FIXME: the method should return the list of invoices created (invoice_ids)
-# and not the id of the last invoice created (res). The problem is that we
-# cannot change it directly since the method is called by the sale order
-# workflow and I suppose it expects a single id...
+ #FIXME: the method should return the list of invoices created (invoice_ids)
+ # and not the id of the last invoice created (res). The problem is that we
+ # cannot change it directly since the method is called by the sale order
+ # workflow and I suppose it expects a single id...
def _inv_get(self, cr, uid, order, context={}):
return {}
@@ -522,9 +523,9 @@ class sale_order(osv.osv):
'partner_type': 'customer', 'probability': 1.0,\
'planned_revenue': o.amount_untaxed})
if (o.order_policy == 'manual'):
- self.write(cr, uid, [o.id], {'state': 'manual'})
+ self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': time.strftime('%Y-%m-%d')})
else:
- self.write(cr, uid, [o.id], {'state': 'progress'})
+ self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': time.strftime('%Y-%m-%d')})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
def procurement_lines_get(self, cr, uid, ids, *args):
diff --git a/addons/sale/sale_report.py b/addons/sale/sale_report.py
index 442b3588ade..2f387ee3883 100644
--- a/addons/sale/sale_report.py
+++ b/addons/sale/sale_report.py
@@ -35,13 +35,13 @@ class sale_report(osv.osv):
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
- 'product_uom':fields.many2one('product.uom', 'UoM', readonly=True),
'product_qty':fields.float('Qty', readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
'price_total':fields.float('Total Price', readonly=True),
+ 'delay':fields.float('Avg Closing Days', digits=(16,2), readonly=True),
'price_average':fields.float('Average Price', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'state': fields.selection([
@@ -71,6 +71,7 @@ class sale_report(osv.osv):
s.user_id as user_id,
s.shop_id as shop_id,
s.company_id as company_id,
+ extract(epoch from avg(s.date_confirm-s.create_date))/(24*60*60)::decimal(16,2) as delay,
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
diff --git a/addons/sale/sale_report_view.xml b/addons/sale/sale_report_view.xml
index 418060834c3..3592cda4662 100644
--- a/addons/sale/sale_report_view.xml
+++ b/addons/sale/sale_report_view.xml
@@ -16,6 +16,7 @@
+
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index e48d59d1f4a..f319e04c1d8 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -204,15 +204,29 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -243,7 +257,7 @@
-
+
diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml
index 6a7e7b6a8ee..213605929ba 100644
--- a/addons/sale/sale_workflow.xml
+++ b/addons/sale/sale_workflow.xml
@@ -58,7 +58,6 @@
stopall
action_cancel()
-
invoice
@@ -85,7 +84,6 @@
stopall
action_cancel()
-
ship
diff --git a/addons/survey/report/survey_analysis_report.py b/addons/survey/report/survey_analysis_report.py
index e95270bf80b..44d42610e6f 100755
--- a/addons/survey/report/survey_analysis_report.py
+++ b/addons/survey/report/survey_analysis_report.py
@@ -101,6 +101,9 @@ class survey_analysis(report_rml):
"""
surv_obj = pooler.get_pool(cr.dbname).get('survey')
+ if datas.has_key('form') and datas['form']['survey_ids']:
+ ids = datas['form']['survey_ids'][0][2]
+
for survey in surv_obj.browse(cr, uid, ids):
rml += """
diff --git a/addons/survey/report/survey_browse_response.py b/addons/survey/report/survey_browse_response.py
index 1ba53f4cd33..e406aca9833 100644
--- a/addons/survey/report/survey_browse_response.py
+++ b/addons/survey/report/survey_browse_response.py
@@ -481,12 +481,12 @@ class survey_browse_response(report_rml):
rml += """
No Response
"""
- if datas.has_key('form') and not datas['form']['without_pagebreak']:
- rml += """ """
- elif not datas.has_key('form'):
- rml += """ """
- else:
- rml += """ """
+ if datas.has_key('form') and not datas['form']['without_pagebreak']:
+ rml += """ """
+ elif not datas.has_key('form'):
+ rml += """ """
+ else:
+ rml += """ """
rml += """"""
report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type]
diff --git a/addons/survey/report/survey_form.py b/addons/survey/report/survey_form.py
index 6d62726fff5..ff1e0bc8424 100644
--- a/addons/survey/report/survey_form.py
+++ b/addons/survey/report/survey_form.py
@@ -365,12 +365,12 @@ class survey_form(report_rml):
rml+="""
"""
rml+=""" """
- if datas.has_key('form') and not datas['form']['without_pagebreak']:
- rml+=""" """
- elif not datas.has_key('form'):
- rml+=""" """
- else:
- rml+=""" """
+ if datas.has_key('form') and not datas['form']['without_pagebreak']:
+ rml+=""" """
+ elif not datas.has_key('form'):
+ rml+=""" """
+ else:
+ rml+=""" """
rml+=""""""
report_type = datas.get('report_type', 'pdf')
create_doc = self.generators[report_type]
diff --git a/addons/survey/survey.py b/addons/survey/survey.py
index ccd3e3d28f4..55a1e33f588 100644
--- a/addons/survey/survey.py
+++ b/addons/survey/survey.py
@@ -519,6 +519,16 @@ class survey_response(osv.osv):
'response_type' : lambda * a: "manually",
}
+ def name_get(self, cr, uid, ids, context=None):
+ if not len(ids):
+ return []
+ reads = self.read(cr, uid, ids, ['user_id','date_create'], context)
+ res = []
+ for record in reads:
+ name = record['user_id'][1] + ' (' + record['date_create'].split('.')[0] + ')'
+ res.append((record['id'], name))
+ return res
+
def copy(self, cr, uid, id, default=None,context={}):
raise osv.except_osv(_('Error !'),_('You cannot duplicate the resource!'))
@@ -667,7 +677,6 @@ class survey_question_wiz(osv.osv_memory):
context.update({'sur_name_id' :wiz_id})
else:
sur_name_rec = surv_name_wiz.read(cr, uid, context['sur_name_id'])
-
if context.has_key('active_id'): context.pop('active_id')
survey_id = context['survey_id']
survey_obj = self.pool.get('survey')
@@ -675,7 +684,8 @@ class survey_question_wiz(osv.osv_memory):
page_obj = self.pool.get('survey.page')
que_obj = self.pool.get('survey.question')
ans_obj = self.pool.get('survey.answer')
- response_obj = self.pool.get('survey.response.line')
+
+ sur_response_obj = self.pool.get('survey.response')
que_col_head = self.pool.get('survey.question.column.heading')
p_id = sur_rec['page_ids']
total_pages = len(p_id)
@@ -721,11 +731,22 @@ class survey_question_wiz(osv.osv_memory):
pag_rec = page_obj.read(cr, uid, p_id)
xml_form = etree.Element('form', {'string': _(tools.ustr(pag_rec['title']))})
xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'})
+ if context.has_key('response_id'):
+ xml_group = etree.SubElement(xml_form, 'group', {'col': '40', 'colspan': '4'})
+ record = sur_response_obj.browse(cr, uid, context['response_id'][context['response_no']])
+ etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr('Answer Of :- ' + record.user_id.name + ', Date :- ' + record.date_create.split('.')[0] )), 'align':"0.0"})
+ etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(" Response :- " + str(context['response_no'] + 1) +"/" + str(len(context['response_id'])) )), 'align':"0.0"})
+ if context['response_no'] > 0:
+ etree.SubElement(xml_group, 'button', {'colspan':"1",'icon':"gtk-go-back",'name':"action_forward_previous",'string': tools.ustr("Previous Answer"),'type':"object"})
+ if context['response_no'] + 1 == len(context['response_id']):
+ etree.SubElement(xml_group, 'button', {'colspan':"1",'icon': "gtk-go-forward", 'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context)})
+ else:
+ etree.SubElement(xml_group, 'button', {'colspan':"1",'icon': "gtk-go-forward", 'name':"action_forward_next",'string': tools.ustr("Next Answer") ,'type':"object",'context' : tools.ustr(context)})
if wiz_id:
fields["wizardid_" + str(wiz_id)] = {'type':'char', 'size' : 255, 'string':"", 'views':{}}
etree.SubElement(xml_form, 'field', {'invisible':'1','name': "wizardid_" + str(wiz_id),'default':str(lambda *a: 0)})
-
if pag_rec['note']:
+ xml_group = etree.SubElement(xml_form, 'group', {'col': '1', 'colspan': '4'})
for que_test in pag_rec['note'].split('\n'):
etree.SubElement(xml_group, 'label', {'string': to_xml(tools.ustr(que_test)), 'align':"0.0"})
que_ids = pag_rec['question_ids']
@@ -902,8 +923,13 @@ class survey_question_wiz(osv.osv_memory):
but_string = "Next"
if int(page_number) + 1 == total_pages:
but_string = "Done"
- if context.has_key('active') and context['active'] and int(page_number) + 1 == total_pages:
- etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'string': "Done" ,'special':"cancel",'context' : tools.ustr(context)})
+
+ if context.has_key('active') and context['active'] and int(page_number) + 1 == total_pages and context.has_key('response_id') and context.has_key('response_no') and context['response_no'] + 1 == len(context['response_id']):
+ etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'special' : 'cancel','string': tools.ustr("Done") ,'context' : tools.ustr(context)})
+ elif context.has_key('active') and context['active'] and int(page_number) + 1 == total_pages and context.has_key('response_id'):
+ etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'name':"action_forward_next",'string': tools.ustr("Next Answer") ,'type':"object",'context' : tools.ustr(context)})
+ elif context.has_key('active') and context['active'] and int(page_number) + 1 == total_pages:
+ etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'special': "cancel", 'string' : 'Done', 'context' : tools.ustr(context)})
else:
etree.SubElement(xml_group, 'button', {'icon': "gtk-go-forward", 'name':"action_next",'string': tools.ustr(but_string) ,'type':"object",'context' : tools.ustr(context)})
if context.has_key('active') and context['active'] and context.has_key('edit'):
@@ -920,7 +946,6 @@ class survey_question_wiz(osv.osv_memory):
result['context'] = context
else:
survey_obj.write(cr, uid, survey_id, {'tot_comp_survey' : sur_rec['tot_comp_survey'] + 1})
- sur_response_obj = self.pool.get('survey.response')
sur_response_obj.write(cr, uid, [sur_name_read['response']], {'state' : 'done'})
if sur_rec['send_response']:
user_obj = self.pool.get('res.users')
@@ -951,7 +976,7 @@ class survey_question_wiz(osv.osv_memory):
if user_email and resp_email:
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_obj.browse(cr, uid, uid).name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
tools.email_send(user_email, [resp_email], "Survey Response Of " + str(user_obj.browse(cr, uid, uid).name) , mail, attach = attachments)
-
+
xml_form = etree.Element('form', {'string': _('Complete Survey Response')})
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
etree.SubElement(xml_form, 'label', {'string': 'Thanks for your response'})
@@ -987,7 +1012,8 @@ class survey_question_wiz(osv.osv_memory):
value[field] = tot_per
response_obj = self.pool.get('survey.response')
if context.has_key('response_id') and context['response_id']:
- response_ans = response_obj.browse(cr, uid, context['response_id'])
+ data = super(survey_question_wiz, self).default_get(cr, uid, fields_list, context)
+ response_ans = response_obj.browse(cr, uid, context['response_id'][context['response_no']])
fields_list.sort()
for que in response_ans.question_ids:
for field in fields_list:
@@ -1068,7 +1094,7 @@ class survey_question_wiz(osv.osv_memory):
survey_obj.write(cr, uid, sur_name_read['survey_id'], {'tot_start_survey' : sur_rec['tot_start_survey'] + 1})
if context.has_key('cur_id'):
self.pool.get(context['object']).write(cr, uid, [int(context['cur_id'])], {'response' : response_id})
-
+
for key,val in sur_name_read['store_ans'].items():
for field in vals:
if field.split('_')[0] == val['question_id']:
@@ -1529,6 +1555,42 @@ class survey_question_wiz(osv.osv_memory):
'context': context
}
+ def action_forward_previous(self, cr, uid, ids, context=None):
+ search_obj = self.pool.get('ir.ui.view')
+ surv_name_wiz = self.pool.get('survey.name.wiz')
+ search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
+ wiz_id = surv_name_wiz.create(cr,uid, {'survey_id' : context['survey_id'],'page_no' :-1,'page':'next','transfer' :1,'response':0})
+ context.update({'sur_name_id' :wiz_id, 'response_no' : context['response_no'] - 1})
+ if context['response_no'] + 1 > len(context['response_id']):
+ return {}
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'survey.question.wiz',
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'search_view_id':search_id[0],
+ 'context': context
+ }
+
+ def action_forward_next(self, cr, uid, ids, context=None):
+ search_obj = self.pool.get('ir.ui.view')
+ surv_name_wiz = self.pool.get('survey.name.wiz')
+ search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
+ wiz_id = surv_name_wiz.create(cr,uid, {'survey_id' : context['survey_id'],'page_no' :-1,'page':'next','transfer' :1,'response':0})
+ context.update({'sur_name_id' :wiz_id, 'response_no' : context['response_no'] + 1})
+ if context['response_no'] + 1 > len(context['response_id']):
+ return {}
+ return {
+ 'view_type': 'form',
+ "view_mode": 'form',
+ 'res_model': 'survey.question.wiz',
+ 'type': 'ir.actions.act_window',
+ 'target': 'new',
+ 'search_view_id':search_id[0],
+ 'context': context
+ }
+
def action_next(self, cr, uid, ids, context=None):
surv_name_wiz = self.pool.get('survey.name.wiz')
search_obj = self.pool.get('ir.ui.view')
@@ -1580,7 +1642,7 @@ class survey_request(osv.osv):
'email' : fields.char("E-mail", size=64),
'survey_id' : fields.many2one("survey", "Survey", required=1),
'response' : fields.many2one('survey.response', 'Answer'),
- 'state' : fields.selection([('waiting_answer', 'Wating Answer'),('done', 'Done'),('cancel', 'Cancelled')], 'State', readonly=1)
+ 'state' : fields.selection([('draft','Draft'),('waiting_answer', 'Wating Answer'),('done', 'Done'),('cancel', 'Cancelled')], 'State', readonly=1)
}
_defaults = {
'state' : lambda * a: 'waiting_answer',
@@ -1622,12 +1684,17 @@ class survey_print_answer(osv.osv_memory):
_columns = {
'survey_id': fields.selection(_get_survey, "Survey", required="1"),
- 'response_id': fields.many2one("survey.response", "Survey Response", required="1"),
+ 'response_id': fields.many2one("survey.response", "Survey Response"),
}
def action_next(self, cr, uid, ids, context=None):
- response_id = self.read(cr, uid, ids, [])[0]
- context.update({'active' : True,'survey_id' : response_id['survey_id'], 'response_id' : response_id['response_id']})
+ record = self.read(cr, uid, ids, [])[0]
+ if record['response_id']:
+ res_id = [(record['response_id'])]
+ else:
+ sur_response_obj = self.pool.get('survey.response')
+ res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',int(record['survey_id']))])
+ context.update({'active' : True,'survey_id' : record['survey_id'], 'response_id' : res_id, 'response_no' : 0})
search_obj = self.pool.get('ir.ui.view')
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
return {
@@ -1642,4 +1709,4 @@ class survey_print_answer(osv.osv_memory):
survey_print_answer()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/survey/survey_demo.xml b/addons/survey/survey_demo.xml
index 6cc5a1acc59..3a41881fd2b 100644
--- a/addons/survey/survey_demo.xml
+++ b/addons/survey/survey_demo.xml
@@ -21,6 +21,8 @@
20
+ open
+ 1
@@ -492,6 +494,8 @@
20
+ open
+ 1
@@ -1280,6 +1284,7 @@
20
+
@@ -2819,4 +2824,621 @@
+
+
+
+
+
+ 2010-03-03 14:25:03
+
+
+
+
+
+
+ 2010-03-03 14:29:36
+
+
+
+
+
+
+ 2010-03-03 14:25:03.603599
+ done
+
+
+ link
+
+
+
+
+ 2010-03-03 14:29:36.247905
+ done
+
+
+ link
+
+
+
+
+ 2010-03-03 14:25:03.631622
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:03.653849
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:03.671836
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:03.689999
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:03.706175
+ done
+
+ Tiny ERP
+
+
+
+
+
+ 2010-03-03 14:25:29.087116
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:29.107571
+ done
+
+
+
+
+
+
+ 2010-03-03 14:25:29.126023
+ done
+
+
+
+
+
+
+ 2010-03-03 14:26:14.844451
+ done
+
+
+
+
+
+
+ 2010-03-03 14:26:14.872224
+ done
+
+
+
+
+
+
+ 2010-03-03 14:26:14.897764
+ skip
+
+
+
+
+
+
+ 2010-03-03 14:26:14.918989
+ done
+
+
+
+
+
+
+ 2010-03-03 14:29:36.27459
+ done
+
+
+
+
+
+
+ 2010-03-03 14:29:36.301461
+ done
+
+
+
+
+
+
+ 2010-03-03 14:29:36.33203
+ done
+
+ Tiny ERP
+
+
+
+
+
+ 2010-03-03 14:29:36.35911
+ done
+
+
+
+
+
+
+ 2010-03-03 14:30:11.376172
+ done
+
+
+
+
+
+
+ 2010-03-03 14:30:11.397675
+ done
+
+
+
+
+
+
+ 2010-03-03 14:30:11.414119
+ done
+
+
+
+
+
+
+ 2010-03-03 14:31:18.637519
+ done
+
+
+
+
+
+
+ 2010-03-03 14:31:18.653091
+ done
+
+ survey
+
+
+
+
+
+ 2010-03-03 14:31:18.669619
+ done
+
+
+
+
+
+
+ 2010-03-03 14:31:18.691933
+ done
+
+
+
+
+
+
+ 2010-03-03 14:32:08.47899
+ done
+
+
+
+
+
+
+ 2010-03-03 14:32:08.501274
+ done
+
+
+
+
+
+
+ 2010-03-03 14:32:08.523878
+ skip
+
+
+
+
+
+
+ 2010-03-03 14:32:08.538988
+ done
+
+
+
+
+
+
+ 2010-03-03 14:32:08.555196
+ done
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/survey/survey_que_wizard.xml b/addons/survey/survey_que_wizard.xml
index 6b52bc66c23..3f2550d93ee 100644
--- a/addons/survey/survey_que_wizard.xml
+++ b/addons/survey/survey_que_wizard.xml
@@ -102,7 +102,7 @@
- Answer Survey Response
+ Answer Survey
ir.actions.act_window
survey.print.answer
form
diff --git a/addons/survey/survey_report.xml b/addons/survey/survey_report.xml
index fc4caaa5180..ab057d16e33 100644
--- a/addons/survey/survey_report.xml
+++ b/addons/survey/survey_report.xml
@@ -12,7 +12,7 @@
+ string="Print Survey Statistics"/>
-->
-
-
+
-
-
+
@@ -284,7 +282,7 @@
survey_question_wizard_test
@@ -848,11 +845,11 @@
survey.response.line
form
-
+
-
+
@@ -889,7 +886,7 @@
survey.response.line
tree
-
+
@@ -907,7 +904,7 @@
survey.response
form
-
+
@@ -923,7 +920,7 @@
survey.response
tree
-
+
@@ -942,7 +939,7 @@
survey.response.answer
form
-
+
@@ -962,7 +959,7 @@
survey.response.answer
tree
-
+
@@ -1047,6 +1044,18 @@
+
+ Survey Request
+ survey.request
+ form
+ tree,form
+
+
+
+
+
@@ -1083,9 +1092,9 @@
-
+ groups="group_survey_manager"/-->
-
+ parent="menu_reporting" type="wizard" icon="STOCK_PRINT" groups="group_survey_manager"/>
+
diff --git a/addons/survey/survey_wizard.xml b/addons/survey/survey_wizard.xml
index 47db190e311..cacba61354b 100644
--- a/addons/survey/survey_wizard.xml
+++ b/addons/survey/survey_wizard.xml
@@ -10,5 +10,8 @@
+
+
diff --git a/addons/survey/wizard/__init__.py b/addons/survey/wizard/__init__.py
index e0fd5999004..35f8cf03820 100755
--- a/addons/survey/wizard/__init__.py
+++ b/addons/survey/wizard/__init__.py
@@ -23,5 +23,6 @@
import wizard_survey
import wizard_print_survey
import wizard_browse_answer
+import wizard_print_survey_statistics
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/survey/wizard/wizard_browse_answer.py b/addons/survey/wizard/wizard_browse_answer.py
index 6a81edce627..90cde78fec9 100644
--- a/addons/survey/wizard/wizard_browse_answer.py
+++ b/addons/survey/wizard/wizard_browse_answer.py
@@ -30,7 +30,7 @@ from tools.translate import _
_survey_form = '''
-
+
diff --git a/addons/survey/wizard/wizard_print_survey_statistics.py b/addons/survey/wizard/wizard_print_survey_statistics.py
new file mode 100644
index 00000000000..0dcac11e01f
--- /dev/null
+++ b/addons/survey/wizard/wizard_print_survey_statistics.py
@@ -0,0 +1,52 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# $Id$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import wizard
+import time
+import pooler
+from random import choice
+import string
+import tools
+from tools.translate import _
+
+_survey_form = '''
+
+
+ '''
+
+_survey_fields = {
+ 'survey_ids': {'string': 'Survey', 'type': 'many2many', 'relation': 'survey','required':'1'},
+ }
+
+class print_survey_statistics_wizard(wizard.interface):
+ states = {
+ 'init' : {
+ 'actions' : [],
+ 'result' : {'type' : 'form', 'arch' :_survey_form, 'fields' :_survey_fields,\
+ 'state' : [('end', 'Cancel', 'gtk-cancel'), ('print', 'Print', 'gtk-print')]}
+ },
+ 'print': {
+ 'actions': [],
+ 'result': {'type':'print', 'report':'survey.analysis', 'state':'end'}
+ }
+ }
+print_survey_statistics_wizard('wizard.print.survey.statistics')