[MERGE] merged from lp:~openerp-dev/openobject-addons/ysa-dev-addons2

bzr revid: hmo@hmo-20100520122700-lejy1xv9yuts4icw
This commit is contained in:
hmo 2010-05-20 17:57:00 +05:30
commit 90f1e9d101
19 changed files with 101 additions and 82 deletions

View File

@ -507,7 +507,6 @@ def _links_get(self, cr, uid, context=None):
res = obj.read(cr, uid, ids, ['object', 'name'], context)
return [(r['object'], r['name']) for r in res]
class crm_case_log(osv.osv):
""" Case Communication History """
_name = "crm.case.log"

View File

@ -26,7 +26,7 @@
'category': 'Generic Modules/Others',
'description': """This is a complete document management system:
* User Authentication
* Document Indexation
* Document Indexation :- .pptx and .docx files are not support in windows platform.
ATTENTION:
- When you install this module in a running company that have already PDF files stored into the database,

View File

@ -104,11 +104,9 @@ class document_directory(osv.osv):
]
def name_get(self, cr, uid, ids, context={}):
res = []
all_ids = self.search(cr,uid,[])
if not self.search(cr,uid,[('id','in',ids)]):
ids = []
for d in self.browse(cr, uid, ids, context=context):
if d.id not in all_ids:
continue
s = ''
d2 = d
while d2 and d2.parent_id:

View File

@ -57,6 +57,7 @@ class PptxIndex(indexer):
return ['.pptx']
def _doIndexFile(self,fname):
# pptx2txt.pl package not support in windows platform.
# Download pptx2txt package from http://sourceforge.net/projects/pptx2txt/" link.
# To install this tool, just copy pptx2txt.pl to appropriate place (e.g. /usr/bin directory)
fp = Popen(['pptx2txt.pl', fname], shell=False, stdout=PIPE).stdout
@ -88,6 +89,7 @@ class DocxIndex(indexer):
return ['.docx']
def _doIndexFile(self,fname):
# docx2txt.pl package not support in windows platform.
# Download docx2txt package from "http://sourceforge.net/projects/docx2txt/" link.
# In case, you don't want to use Makefile for installation, you can follow these steps for manual installation.
# Copy docx2txt.pl, docx2txt.sh and docx2txt.config to appropriate place (e.g. /usr/bin directory) . used following command.

View File

@ -7,6 +7,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_demo"/>
<field name="response_user">5</field>
</record>
</data>
<data>
@ -16,6 +17,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
</data>
<data>

View File

@ -148,6 +148,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
</data>
<data>

View File

@ -207,7 +207,7 @@ class survey_browse_response(report_rml):
<td><para style="terp_tblheader_General_Centre_simple">""" + to_xml(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) + """</para></td>
<td><para style="terp_tblheader_General_Centre"></para></td>
<td><para style="terp_tblheader_General_right">Answer By:- </para></td>
<td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login) + """</para></td>
<td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login or '') + """</para></td>
</tr>
</blockTable><para style="P2"></para>"""

View File

@ -149,11 +149,10 @@ class survey_form(report_rml):
<story>"""
surv_obj = pooler.get_pool(cr.dbname).get('survey')
for survey in surv_obj.browse(cr,uid,ids):
if datas.has_key('form') and datas['form']['survey_title']:
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
if survey.note:
rml += """
<para style="P2"></para>

View File

@ -225,7 +225,7 @@ class survey_question(osv.osv):
'page_id': fields.many2one('survey.page', 'Survey Page', ondelete='cascade', required=1),
'question': fields.char('Question', size=128, required=1),
'answer_choice_ids': fields.one2many('survey.answer', 'question_id', 'Answer'),
'is_require_answer': fields.boolean('Require Answer to Question (optional)'),
'is_require_answer': fields.boolean('Require Answer to Question'),
'required_type': fields.selection([('all','All'), ('at least','At Least'), ('at most','At Most'), ('exactly','Exactly'), ('a range','A Range')], 'Respondent must answer'),
'req_ans': fields.integer('#Required Answer'),
'maximum_req_ans': fields.integer('Maximum Required Answer'),
@ -250,7 +250,7 @@ class survey_question(osv.osv):
('date_and_time','Date and Time'),('descriptive_text','Descriptive Text'),
('table','Table'),
], 'Question Type', required=1,),
'is_comment_require': fields.boolean('Add Comment Field (optional)'),
'is_comment_require': fields.boolean('Add Comment Field'),
'comment_label': fields.char('Field Label', size = 255),
'comment_field_type': fields.selection([('char', 'Single Line Of Text'), ('text', 'Paragraph of Text')], 'Comment Field Type'),
'comment_valid_type': fields.selection([('do_not_validate', '''Don't Validate Comment Text.'''),
@ -269,7 +269,7 @@ class survey_question(osv.osv):
'comment_valid_err_msg': fields.text('Error message'),
'make_comment_field': fields.boolean('Make Comment Field an Answer Choice'),
'make_comment_field_err_msg': fields.text('Error message'),
'is_validation_require': fields.boolean('Validate Text (optional)'),
'is_validation_require': fields.boolean('Validate Text'),
'validation_type': fields.selection([('do_not_validate', '''Don't Validate Comment Text.'''),\
('must_be_specific_length', 'Must Be Specific Length'),\
('must_be_whole_number', 'Must Be A Whole Number'),\
@ -609,7 +609,7 @@ class survey_response(osv.osv):
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] + ')'
name = (record['user_id'] and record['user_id'][1] or '' )+ ' (' + record['date_create'].split('.')[0] + ')'
res.append((record['id'], name))
return res

View File

@ -24,6 +24,7 @@
<field name="state">open</field>
<field name="tot_comp_survey">1</field>
<field name="tot_start_survey">1</field>
<field name="response_user">5</field>
</record>
<record id="survey_page_who_are_you" model="survey.page">
@ -498,6 +499,7 @@
<field name="state">open</field>
<field name="tot_comp_survey">1</field>
<field name="tot_start_survey">1</field>
<field name="response_user">5</field>
</record>
<record id="survey_page_odoo_who_are_you" model="survey.page">
@ -1286,6 +1288,7 @@
<field name="responsible_id" ref="base.user_demo"/>
<field name="max_response_limit">20</field>
<field name="type" ref="survey_type2"/>
<field name="response_user">5</field>
</record>
</data>
<data>
@ -2163,6 +2166,8 @@
<field eval="1" name="send_response"/>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey_type3"/>
<field name="response_user">5</field>
<field name="max_response_limit">20</field>
</record>
</data>
<data>

View File

@ -6,8 +6,7 @@
id="report_survey_form"
model="survey"
name="survey.form"
menu="False"
string="Survey Form"/>
string="Print Survey"/>
<report auto="True"
id="survey_analysis"

View File

@ -478,7 +478,7 @@
<field name="note" colspan="4" nolabel="1"/>
<group colspan="4">
<label string="" colspan="3"/>
<button name="survey_save" string="Ok" type="object" icon="gtk-go-back"/>
<button name="survey_save" string="Ok" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
@ -805,7 +805,7 @@
</notebook>
<group colspan="4">
<label string="" colspan="3"/>
<button name="survey_save" string="Ok" type="object" icon="gtk-ok"/>
<button name="survey_save" string="Ok" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
@ -1156,11 +1156,11 @@
res_model="survey.answer"
src_model="survey.question"/>
<act_window domain="[('survey_id', '=', active_id)]"
<!--act_window domain="[('survey_id', '=', active_id)]"
id="act_survey_response"
name="Survey Answer"
res_model="survey.response"
src_model="survey"/>
src_model="survey"/-->
<menuitem name="Answer a Survey" id="menu_run_survey_form" sequence="2"
action="action_view_survey_name" parent="menu_answer_surveys"

View File

@ -46,7 +46,7 @@ class survey_browse_answer(osv.osv_memory):
_columns = {
'survey_id': fields.selection(_get_survey, "Survey", required="1"),
'response_id': fields.many2one("survey.response", "Survey Answer"),
'response_id': fields.many2one("survey.response", "Survey Answer", help="If you want to print all answer of selected survey then don't select survey answer and if you select survey answer then print only selected survey answer."),
}
def action_next(self, cr, uid, ids, context=None):

View File

@ -28,11 +28,12 @@ from tools.translate import _
class survey_print(osv.osv_memory):
_name = 'survey.print'
_columns = {
'survey_ids': fields.many2many('survey','survey_print',\
'survey_id','print_id', "Survey", required="1"),
'orientation' : fields.selection([('vertical','Portrait(Vertical)'),\
('horizontal','Landscape(Horizontal)')], 'Orientation'),
'paper_size' : fields.selection([('letter','Letter (8.5" x 11")'),\
('legal','Legal (8.5" x 14")'),('a4','A4 (210mm x 297mm)')], 'Paper Size'),
'survey_title' : fields.boolean('Include Survey Title'),
'page_number' : fields.boolean('Include Page Numvers'),
'without_pagebreak' : fields.boolean('Print Without Page Breaks'),
}
@ -40,7 +41,6 @@ class survey_print(osv.osv_memory):
_defaults = {
'orientation': lambda *a:'vertical',
'paper_size': lambda *a:'letter',
'survey_title':lambda *a: 0,
'page_number':lambda *a: 0,
'without_pagebreak':lambda *a: 0
}
@ -57,7 +57,7 @@ class survey_print(osv.osv_memory):
@return : Dictionary value for print survey form.
"""
datas = {'ids' : context.get('active_ids', [])}
datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']}
res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\
'page_number', 'without_pagebreak'], context)
res = res and res[0] or {}

View File

@ -10,10 +10,11 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Survey Print">
<separator string="Survey" colspan="4"/>
<field name="survey_ids" nolabel="1" colspan="4" />
<separator string="Print Option" colspan="4"/>
<field name="orientation" colspan="4"/>
<field name="paper_size" colspan="4"/>
<field name="survey_title" colspan="4"/>
<field name="page_number" colspan="4"/>
<field name="without_pagebreak" colspan="4"/>
<separator colspan="4" />
@ -34,10 +35,9 @@
<field name="target">new</field>
</record>
<act_window id="action_act_view_survey_print"
key2="client_action_multi" name="Print Survey"
res_model="survey.print" src_model="survey"
view_mode="form" target="new" view_type="form" />
<menuitem name="Print Survey" id="menu_print_survey_form" sequence="1"
action="action_view_survey_print" parent="menu_reporting"
groups="group_survey_manager" icon="STOCK_PRINT"/>
</data>
</openerp>

View File

@ -29,38 +29,28 @@ class thunderbird_installer(osv.osv_memory):
_name = 'thunderbird.installer'
_inherit = 'res.config.installer'
def process_plugin(self, cr, uid, ids, context):
"""
Default Attach Thunderbird Plug-in File.
"""
data = {}
file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
data['plugin_file'] = base64.encodestring(file.read())
self.write(cr, uid, ids, data)
return False
def process_pdf_file(self, cr, uid, ids, context):
"""
Default Attach Thunderbird Plug-in Installation File.
"""
data = {}
def default_get(self, cr, uid, fields, context={}):
data = super(thunderbird_installer, self).default_get(cr, uid, fields, context)
pdf_file = open(config['addons_path'] + "/thunderbird/doc/Installation Guide to OpenERP Thunderbid Plug-in.pdf", 'r')
data['pdf_file'] = base64.encodestring(pdf_file.read())
self.write(cr, uid, ids, data)
return False
file = open(config['addons_path'] + "/thunderbird/plugin/tiny_plugin-2.0.xpi", 'r')
data['plugin_file'] = base64.encodestring(file.read())
return data
_columns = {
'name':fields.char('File name', size=34),
'pdf_name':fields.char('File name', size=64),
'thunderbird':fields.boolean('Thunderbird Module ', help="Allows you to select an object that youd like to add to your email and its attachments."),
'plugin_file':fields.binary('Thunderbird Plug-in', readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbir."),
'pdf_file':fields.binary('Thunderbird Plug-in Installation File', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
'plugin_file':fields.binary('Thunderbird Plug-in', readonly=True, help="Thunderbird plug-in file. Save as this file and install this plug-in in thunderbird."),
'pdf_file':fields.binary('Installation Manual', help="The documentation file :- how to install Thunderbird Plug-in.", readonly=True),
'description':fields.text('Description', readonly=True)
}
_defaults = {
'thunderbird' : True,
'name' : 'tiny_plugin-2.0.xpi',
'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf',
'description' : """ * Save The thunderbird plug­in Follow the following step to install thunderbird plug­in. \n -> 1. From Menu Bar, Open Tools ­> Add ons. \n -> 2. Now click on install button and a browser window will appear. \n -> 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. \n -> 4. Click on Install Now and restart Thunderbird. \n -> 5. Now Thunderbird plug­in is installed."""
}
thunderbird_installer()

View File

@ -90,9 +90,9 @@ class tinythunderbird_partner(osv.osv):
case_pool=self.pool.get(dictcreate.get('object','crm.case'))
partner_ids=add_obj.search(cr,user,[('email','=',dictcreate['email_from'])])
partner=add_obj.read(cr,user,partner_ids,['partner_id'])
if partner:
if partner and partner[0] and partner[0]['partner_id']:
dictcreate.update({'partner_id':partner[0]['partner_id'][0]})
create_id = self.pool.get(dictcreate.get('object','crm.case')).create(cr, user, dictcreate)
create_id = case_pool.create(cr, user, dictcreate)
cases=case_pool.browse(cr,user,[create_id])
case_pool._history(cr, user, cases, _('Archive'), history=True, email=False)
return create_id
@ -104,10 +104,11 @@ class tinythunderbird_partner(osv.osv):
def thunderbird_createpartner(self,cr,user,vals):
dictcreate = dict(vals)
search_id = self.pool.get('res.partner').search(cr, user,[('name','=',dictcreate['name'])])
address_obj = self.pool.get('res.partner')
search_id = address_obj.search(cr, user,[('name','=',dictcreate['name'])])
if search_id:
return 0
create_id = self.pool.get('res.partner').create(cr, user, dictcreate)
create_id = address_obj.create(cr, user, dictcreate)
return create_id
def thunderbird_searchobject(self,cr,user,vals):
@ -116,12 +117,13 @@ class tinythunderbird_partner(osv.osv):
return (search_id and search_id[0]) or 0
def thunderbird_searchcontact(self,cr,user,vals):
search_id1 = self.pool.get('res.partner.address').search(cr,user,[('name','ilike',vals)])
search_id2 = self.pool.get('res.partner.address').search(cr,user,[('email','=',vals)])
address_obj = self.pool.get('res.partner.address')
search_id1 = address_obj.search(cr,user,[('name','ilike',vals)])
search_id2 = address_obj.search(cr,user,[('email','=',vals)])
if search_id1:
return self.pool.get('res.partner.address').name_get(cr, user, search_id1)
return address_obj.name_get(cr, user, search_id1)
elif search_id2:
return self.pool.get('res.partner.address').name_get(cr, user, search_id2)
return address_obj.name_get(cr, user, search_id2)
return []
def thunderbird_tempsearch(self,cr,user,vals):
@ -132,21 +134,22 @@ class tinythunderbird_partner(osv.osv):
name_get=[]
er_val=[]
for object in obj:
dyn_object = self.pool.get(object)
if object == 'res.partner.address':
search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)])
search_id2 = self.pool.get(object).search(cr,user,[('email','=',value)])
search_id1 = dyn_object.search(cr,user,[('name','ilike',value)])
search_id2 = dyn_object.search(cr,user,[('email','=',value)])
if search_id1:
name_get.append(object)
name_get.append(self.pool.get(object).name_get(cr, user, search_id1))
name_get.append(dyn_object.name_get(cr, user, search_id1))
elif search_id2:
name_get.append(object)
name_get.append(self.pool.get(object).name_get(cr, user, search_id2))
name_get.append(dyn_object.name_get(cr, user, search_id2))
else:
try:
search_id1 = self.pool.get(object).search(cr,user,[('name','ilike',value)])
search_id1 = dyn_object.search(cr,user,[('name','ilike',value)])
if search_id1:
name_get.append(object)
name_get.append(self.pool.get(object).name_get(cr, user, search_id1))
name_get.append(dyn_object.name_get(cr, user, search_id1))
except:
er_val.append(object)
continue
@ -179,17 +182,38 @@ class tinythunderbird_partner(osv.osv):
def read(self, cr, user, ids, fields=None, context={}, load='_classic_read'):
ret_read = super(tinythunderbird_partner, self).read(cr, user, ids,fields,context,load)
attach_obj = self.pool.get('ir.attachment')
for read_data in ret_read:
attachments = self.pool.get('ir.attachment').search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])])
attechments_data = self.pool.get('ir.attachment').read(cr,user,attachments,['name'])
attachments = attach_obj.search(cr,user,[('res_model','=',self._name),('res_id','=',read_data['id'])])
attechments_data = sattach_obj.read(cr,user,attachments,['name'])
file_names = [a['name'] for a in attechments_data]
text_atteched = '\n'.join(file_names)
read_data['attachments'] = text_atteched
return ret_read
def unlink(self, cr, uid, ids, context={}):
attachments = self.pool.get('ir.attachment').search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)])
self.pool.get('ir.attachment').unlink(cr,uid,attachments)
attach_obj = self.pool.get('ir.attachment')
attachments = attach_obj.search(cr,uid,[('res_model','=',self._name),('res_id','in',ids)])
attach_obj.unlink(cr,uid,attachments)
return super(tinythunderbird_partner, self).unlink(cr, uid, ids,context)
tinythunderbird_partner()
def thunderbird_objectsearch(self,cr,user,vals):
obj_list= [('crm.claim', 'Claim'), ('crm.lead','Lead'), ('crm.meeting','Metting'), ('crm.opportunity','Opportunity'), ('crm.phonecall','Phonecall'), ('crm.fundraising','Fund raising'), ('crm.helpdesk','Helpdesk')]
object=[]
model_obj = self.pool.get('ir.model')
for obj in obj_list:
if model_obj.search(cr, user, [('model', '=', obj[0])]):
object.append(obj)
return object
def thunderbird_list_search_object(self,cr,user,vals):
model_obj = self.pool.get('ir.model')
object=''
for obj in vals[0][1].split(','):
if model_obj.search(cr, user, [('model', '=', obj)]):
object += obj + ","
else:
object += "null,"
return object
tinythunderbird_partner()

Binary file not shown.

View File

@ -29,13 +29,11 @@
<newline/>
<field name="plugin_file" filename="name"/>
<button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
<newline/>
<field name="pdf_file" filename="pdf_name"/>
<button name="process_pdf_file" icon="gtk-execute" string="Get Plugin Installation File" type="object"/>
<newline/>
<separator string="Thunderbird plugin installation note." colspan="4"/>
<label colspan="8" string="Save The thunderbird plug­in Follow the following step to install thunderbird plug­in ? 1. From Menu Bar, Open Tools ­> Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plug­in is installed."/>
<field name="description" nolabel="1" colspan="8"/>
</group>
</group>
</data>
@ -74,16 +72,18 @@
<label align="0.0" string="This module is required for the thuderbird plug-in to work properly.This allows you to select an object that you had like to add to your email and its attachments. You can select a partner, a task, a project, an analytical account, or any other object and attach selected mail as .eml file in attachment of selected record." width="200"/>
</group>
<group colspan="8">
<separator string="Thunderbird" colspan="4"/>
<field name="thunderbird"/>
<field name="name" invisible="1"/>
<newline/>
<field name="plugin_file"/>
<button name="process_plugin" icon="gtk-execute" string="Get Plugin File" type="object"/>
<newline/>
<separator string="Thunderbird plugin installation note." colspan="4"/>
<label colspan="8" string="Save The thunderbird plug­in Follow the following step to install thunderbird plug­in ? 1. From Menu Bar, Open Tools ­> Add ons. 2. Now click on install button and a browser window will appear. 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. 4. Click on Install Now and restart Thunderbird. 5. Now Thunderbird plug­in is installed."/>
</group>
<field name="thunderbird"/>
<field name="name" invisible="1"/>
<field name="pdf_name" invisible="1"/>
<newline/>
<field name="plugin_file" filename="name"/>
<newline/>
<field name="pdf_file" filename="pdf_name"/>
<newline/>
<separator string="Thunderbird plugin installation note." colspan="4"/>
<field name="description" nolabel="1" colspan="8"/>
</group>
</group>
</group>
<separator string="" colspan="4"/>