mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 18:38:41 -06:00
Pep8 and xml indentation
This commit is contained in:
parent
9cfa8face8
commit
f5d264b36c
@ -7,14 +7,12 @@ from base64 import b64encode
|
|||||||
class AbstractTask(object):
|
class AbstractTask(object):
|
||||||
|
|
||||||
def create_file(self, filename, data):
|
def create_file(self, filename, data):
|
||||||
ir_attachment_id = self.env['ir.attachment'].create(
|
ir_attachment_id = self.env['ir.attachment'].create({
|
||||||
{
|
'name': filename,
|
||||||
'name': filename,
|
'datas': b64encode(data),
|
||||||
'datas': b64encode(data),
|
'datas_fname': filename,
|
||||||
'datas_fname': filename,
|
'task_id': self.task.id,
|
||||||
'task_id': self.task.id,
|
'location_id': self.task.location_id.id,
|
||||||
'location_id': self.task.location_id.id,
|
'external_hash': self.ext_hash
|
||||||
'external_hash': self.ext_hash
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
return ir_attachment_id
|
return ir_attachment_id
|
||||||
|
@ -2,19 +2,19 @@
|
|||||||
<openerp>
|
<openerp>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
<record id="view_attachment_improved_form" model="ir.ui.view">
|
<record id="view_attachment_improved_form" model="ir.ui.view">
|
||||||
<field name="model">ir.attachment</field>
|
<field name="model">ir.attachment</field>
|
||||||
<field name="inherit_id" ref="base.view_attachment_form" />
|
<field name="inherit_id" ref="base.view_attachment_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="url" position="after">
|
<field name="url" position="after">
|
||||||
<field name="sync_date"/>
|
<field name="sync_date"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<field name="state_message"/>
|
<field name="state_message"/>
|
||||||
<field name="task_id"/>
|
<field name="task_id"/>
|
||||||
<field name="location_id"/>
|
<field name="location_id"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="view_external_attachment_tree" model="ir.ui.view">
|
<record id="view_external_attachment_tree" model="ir.ui.view">
|
||||||
<field name="model">ir.attachment</field>
|
<field name="model">ir.attachment</field>
|
||||||
|
@ -36,7 +36,7 @@ class Task(models.Model):
|
|||||||
filepath = fields.Char()
|
filepath = fields.Char()
|
||||||
location_id = fields.Many2one('external.file.location', string='Location')
|
location_id = fields.Many2one('external.file.location', string='Location')
|
||||||
attachment_ids = fields.One2many('ir.attachment', 'task_id',
|
attachment_ids = fields.One2many('ir.attachment', 'task_id',
|
||||||
string='Attachment')
|
string='Attachment')
|
||||||
delete_file = fields.Boolean(string='Delete file')
|
delete_file = fields.Boolean(string='Delete file')
|
||||||
move_file = fields.Boolean(string='Move file')
|
move_file = fields.Boolean(string='Move file')
|
||||||
move_path = fields.Char(string='Move path')
|
move_path = fields.Char(string='Move path')
|
||||||
@ -69,21 +69,21 @@ class Task(models.Model):
|
|||||||
def run(self):
|
def run(self):
|
||||||
for cls in itersubclasses(AbstractTask):
|
for cls in itersubclasses(AbstractTask):
|
||||||
if cls._synchronize_type and \
|
if cls._synchronize_type and \
|
||||||
cls._key + '_' + cls._synchronize_type == self.method:
|
cls._key + '_' + cls._synchronize_type == self.method:
|
||||||
method_class = cls
|
method_class = cls
|
||||||
config = {
|
config = {
|
||||||
'host': self.location_id.address,
|
'host': self.location_id.address,
|
||||||
'user': self.location_id.login,
|
'user': self.location_id.login,
|
||||||
'pwd': self.location_id.password,
|
'pwd': self.location_id.password,
|
||||||
'port': self.location_id.port,
|
'port': self.location_id.port,
|
||||||
'allow_dir_creation': False,
|
'allow_dir_creation': False,
|
||||||
'file_name': self.filename,
|
'file_name': self.filename,
|
||||||
'path': self.filepath,
|
'path': self.filepath,
|
||||||
'attachment_ids': self.attachment_ids,
|
'attachment_ids': self.attachment_ids,
|
||||||
'task': self,
|
'task': self,
|
||||||
'move_path': self.move_path,
|
'move_path': self.move_path,
|
||||||
'delete_file': self.delete_file,
|
'delete_file': self.delete_file,
|
||||||
'move_file': self.move_file,
|
'move_file': self.move_file,
|
||||||
}
|
}
|
||||||
conn = method_class(self.env, config)
|
conn = method_class(self.env, config)
|
||||||
conn.run()
|
conn.run()
|
||||||
|
Loading…
Reference in New Issue
Block a user