diff options
Diffstat (limited to 'addons/document')
| -rw-r--r-- | addons/document/__openerp__.py | 2 | ||||
| -rw-r--r-- | addons/document/document.py | 13 | ||||
| -rw-r--r-- | addons/document/document_directory.py | 6 | ||||
| -rw-r--r-- | addons/document/document_view.xml | 87 | ||||
| -rw-r--r-- | addons/document/report/document_report.py | 6 | ||||
| -rw-r--r-- | addons/document/report/document_report_view.xml | 6 | ||||
| -rw-r--r-- | addons/document/std_index.py | 2 |
7 files changed, 69 insertions, 53 deletions
diff --git a/addons/document/__openerp__.py b/addons/document/__openerp__.py index 8a78ae46fdd..ac227827d11 100644 --- a/addons/document/__openerp__.py +++ b/addons/document/__openerp__.py @@ -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, diff --git a/addons/document/document.py b/addons/document/document.py index 2b2ac2f7587..5d3075f7a4a 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -75,7 +75,7 @@ class document_file(osv.osv): 'user_id': fields.many2one('res.users', 'Owner', select=1), 'group_ids': fields.many2many('res.groups', 'document_group_rel', 'item_id', 'group_id', 'Groups'), # the directory id now is mandatory. It can still be computed automatically. - 'parent_id': fields.many2one('document.directory', 'Directory', select=1, required=True), + 'parent_id': fields.many2one('document.directory', 'Directory', select=1), 'file_size': fields.integer('File Size', required=True), 'file_type': fields.char('Content Type', size=128), # If ir.attachment contained any data before document is installed, preserve @@ -88,11 +88,16 @@ class document_file(osv.osv): 'create_uid': fields.many2one('res.users', 'Creator', readonly=True), 'store_method': fields.selection([('db', 'Database'), ('fs', 'Filesystem'), ('link', 'Link')], "Storing Method"), 'datas': fields.function(_data_get, method=True, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True), + 'url': fields.char('File URL',size=64), 'store_fname': fields.char('Stored Filename', size=200), 'res_model': fields.char('Attached Model', size=64), #res_model 'res_id': fields.integer('Attached ID'), #res_id 'partner_id':fields.many2one('res.partner', 'Partner', select=1), - 'title': fields.char('Resource Title', size=64), + 'type':fields.selection([ + ('url','URL'), + ('binary','Binary'), + + ],'Type', help="Type is used to separate URL and binary File"), } def __get_def_directory(self, cr, uid, context=None): @@ -103,6 +108,7 @@ class document_file(osv.osv): 'user_id': lambda self, cr, uid, ctx:uid, 'file_size': lambda self, cr, uid, ctx:0, 'store_method': lambda *args: 'db', + 'type': 'binary', 'parent_id': __get_def_directory } _sql_constraints = [ @@ -155,7 +161,6 @@ class document_file(osv.osv): def create(self, cr, uid, vals, context=None): if not context: context = {} - vals['title'] = vals['name'] vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False) if not vals['parent_id']: vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context) @@ -168,8 +173,6 @@ class document_file(osv.osv): result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context) if len(result): obj = result[0] - if obj.get('name', False): - vals['title'] = (obj.get('name', ''))[:60] if obj_model._name == 'res.partner': vals['partner_id'] = obj['id'] elif obj.get('address_id', False): diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 56e52aa9b69..e395f96833d 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -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: diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index 720ab6de69f..fd424ad7d52 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -118,7 +118,7 @@ <record model="ir.ui.view" id="view_document_directory_tree"> <field name="name">document.directory</field> <field name="model">document.directory</field> - <field name="type">tree</field> + <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Directories" toolbar="1"> <field name="name"/> @@ -179,71 +179,96 @@ <form string="Documents"> <group colspan="4" col="6"> <field name="name" select="1" /> - <field name="title" select="1"/> - <field name="partner_id"/> - <field name="user_id"/> - <field name="parent_id"/> + <field name="type"/> + <field name="parent_id"/> </group> <notebook colspan="4"> <page string="Attachment"> <group col="2" colspan="2"> <separator string="Data" colspan="2"/> + <group col="2" colspan="2" attrs="{'invisible':[('type','=','url')]}"> <field name="datas" filename="datas_fname"/> <field name="datas_fname" select="1"/> + </group> + <group col="2" colspan="2" attrs="{'invisible':[('type','=','binary')]}"> + <field name="url" widget="url"/> + </group> + </group> + + <group col="2" colspan="2"> - <separator string="Attached To" colspan="2"/> - <field name="res_model" readonly="1"/> - <field name="res_id" readonly="1"/> + <separator string="Relation" colspan="2"/> + <field name="res_name" readonly="1"/> + <field name="partner_id"/> + <field name="user_id"/> </group> - <separator string="Preview" colspan="4"/> - <field - name="preview" - widget="image" - readonly="1" - nolabel="1" - colspan="4" - img_height="400" - img_width="800"/> - - </page><page string="Indexed Content"> - <field name="index_content" nolabel="1" colspan="4" select="1"/> - </page><page string="Security"> - <field name="group_ids" colspan="4" nolabel="1"/> - </page><page string="Others Info"> - <group colspan="4" col="4"> - <separator string="File Information" colspan="4"/> - <field name="file_size" readonly="1"/> - <newline/> + <group col="4" colspan="4"> <separator string="History" colspan="4"/> + <group col="4" colspan="4"> <field name="create_uid"/> <field name="create_date"/> + </group> + <group col="4" colspan="4"> <field name="write_uid"/> <field name="write_date"/> + </group> </group> - </page><page string="Notes"> + </page> + <page string="Security"> + <field name="group_ids" colspan="4" nolabel="1"/> + </page> + + <page string="Notes"> <field colspan="4" name="description" nolabel="1"/> </page> </notebook> </form> </field> </record> + + <record id="view_attach_filter" model="ir.ui.view"> + <field name="name">IR Attachment</field> + <field name="model">ir.attachment</field> + <field name="type">search</field> + <field name="arch" type="xml"> + <search string="IR Attachment"> + <filter icon="gtk-media-rewind" string="Recent" + help="less 1 month modified/created attachments" + domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')),('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" + /> + <separator orientation="vertical"/> + <field name="user_id" widget="selection"> + <filter icon="terp-partner" + domain="[('user_id','=', False)]" + help="Filter on my Attachment" /> + </field> + <field name="partner_id" widget="selection"/> + <newline/> + <group expand="1" string="Group By..."> + <filter string="Partner" icon="terp-partner" domain="[]" + context="{'group_by':'partner_id'}" /> + <filter string="Directory" icon="gtk-open" domain="[]" context="{'group_by':'parent_id'}"/> + </group> + </search> + </field> + </record> <record model="ir.ui.view" id="view_document_file_tree"> <field name="name">ir.attachment</field> <field name="model">ir.attachment</field> <field name="type">tree</field> <field name="priority" eval="1"/> <field name="arch" type="xml"> - <tree string="Documents"> + <tree colors="blue:type in ('url')" string="Documents"> <field name="name"/> - <field name="title" /> - <field name="partner_id"/> + <field name="type"/> <field name="datas_fname"/> <field name="user_id"/> <field name="create_date"/> <field name="write_date"/> </tree> + </field> </record> diff --git a/addons/document/report/document_report.py b/addons/document/report/document_report.py index efe3a8183ab..d3964fc2d99 100644 --- a/addons/document/report/document_report.py +++ b/addons/document/report/document_report.py @@ -44,7 +44,6 @@ class report_document_user(osv.osv): ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True), 'user_id':fields.integer('Owner', readonly=True), 'user':fields.char('User',size=64,readonly=True), - 'file_title': fields.char('File Name',size=64,readonly=True), 'directory': fields.char('Directory',size=64,readonly=True), 'create_date': fields.datetime('Date Created', readonly=True), 'change_date': fields.datetime('Modified Date', readonly=True), @@ -66,7 +65,6 @@ class report_document_user(osv.osv): d.name as directory, f.create_date as create_date, f.file_size as file_size, - min(f.title) as file_title, min(d.type) as type, f.write_date as change_date from ir_attachment f @@ -83,7 +81,6 @@ class report_files_partner(osv.osv): _auto = False _columns = { 'name': fields.char('Year',size=64,required=False, readonly=True), - 'file_title': fields.char('File Name',size=64,readonly=True), 'directory': fields.char('Directory',size=64,readonly=True), 'create_date': fields.datetime('Date Created', readonly=True), 'change_date': fields.datetime('Modified Date', readonly=True), @@ -101,7 +98,6 @@ class report_files_partner(osv.osv): select min(f.id) as id,count(*) as nbr, to_char(f.create_date,'YYYY') as name, min(to_char(f.create_date,'MM')) as month, - min(f.title) as file_title, p.name as partner from ir_attachment f inner join res_partner p @@ -145,7 +141,6 @@ class report_document_wall(osv.osv): 'user_id':fields.many2one('res.users', 'Owner',readonly=True), 'user':fields.char('User',size=64,readonly=True), 'month': fields.char('Month', size=24,readonly=True), - 'file_name':fields.char('Last Posted File Name',size=64,readonly=True), 'last':fields.datetime('Last Posted Time', readonly=True), } @@ -153,7 +148,6 @@ class report_document_wall(osv.osv): cr.execute(""" create or replace view report_document_wall as ( select max(f.id) as id, - min(title) as file_name, to_char(min(f.create_date),'YYYY-MM-DD HH24:MI:SS') as last, f.user_id as user_id, f.user_id as user, to_char(f.create_date,'Month') as month diff --git a/addons/document/report/document_report_view.xml b/addons/document/report/document_report_view.xml index c6d59fa3d29..4afc66fb4d7 100644 --- a/addons/document/report/document_report_view.xml +++ b/addons/document/report/document_report_view.xml @@ -8,7 +8,6 @@ <field name="arch" type="xml"> <form string="Files"> <field name="name" select="1"/> - <field name="file_title" select="1"/> <field name="user" select="1"/> <field name="directory" select="1"/> <field name="file_size"/> @@ -26,7 +25,6 @@ <tree string="Files"> <field name="name" select="1"/> <field name="month" select="1"/> - <field name="file_title"/> <field name="user" select="1"/> <field name="directory" select="1"/> <field name="file_size"/> @@ -48,7 +46,6 @@ <separator orientation="vertical"/> <field name="name" select="1"/> <field name="month" select="1"/> - <field name="file_title" select="1"/> <field name="user" select="1"/> <field name="directory" select="1"/> </group> @@ -79,13 +76,11 @@ <form string="Wall of Shame"> <field name="user_id" select="1"/> <field name="month" select="1"/> - <field name="file_name" select="1"/> <field name="last"/> </form> </field> </record> - <record model="ir.ui.view" id="view_document_wall_tree"> <field name="name">report.document.wall.tree</field> <field name="model">report.document.wall</field> @@ -94,7 +89,6 @@ <tree string="Wall of Shame"> <field name="user_id" select="1"/> <field name="month" select="1"/> - <field name="file_name"/> <field name="last"/> </tree> </field> diff --git a/addons/document/std_index.py b/addons/document/std_index.py index 4979c05a17d..2f2f2094bc3 100644 --- a/addons/document/std_index.py +++ b/addons/document/std_index.py @@ -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. |
