Pep8 and xml indentation

This commit is contained in:
Valentin Chemiere 2015-03-12 18:41:40 +01:00
parent 9cfa8face8
commit f5d264b36c
3 changed files with 35 additions and 37 deletions

View File

@ -7,14 +7,12 @@ from base64 import b64encode
class AbstractTask(object):
def create_file(self, filename, data):
ir_attachment_id = self.env['ir.attachment'].create(
{
'name': filename,
'datas': b64encode(data),
'datas_fname': filename,
'task_id': self.task.id,
'location_id': self.task.location_id.id,
'external_hash': self.ext_hash
}
)
ir_attachment_id = self.env['ir.attachment'].create({
'name': filename,
'datas': b64encode(data),
'datas_fname': filename,
'task_id': self.task.id,
'location_id': self.task.location_id.id,
'external_hash': self.ext_hash
})
return ir_attachment_id

View File

@ -2,19 +2,19 @@
<openerp>
<data>
<record id="view_attachment_improved_form" model="ir.ui.view">
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="base.view_attachment_form" />
<field name="arch" type="xml">
<field name="url" position="after">
<field name="sync_date"/>
<field name="state"/>
<field name="state_message"/>
<record id="view_attachment_improved_form" model="ir.ui.view">
<field name="model">ir.attachment</field>
<field name="inherit_id" ref="base.view_attachment_form" />
<field name="arch" type="xml">
<field name="url" position="after">
<field name="sync_date"/>
<field name="state"/>
<field name="state_message"/>
<field name="task_id"/>
<field name="location_id"/>
</field>
</field>
</record>
</field>
</field>
</record>
<record id="view_external_attachment_tree" model="ir.ui.view">
<field name="model">ir.attachment</field>

View File

@ -36,7 +36,7 @@ class Task(models.Model):
filepath = fields.Char()
location_id = fields.Many2one('external.file.location', string='Location')
attachment_ids = fields.One2many('ir.attachment', 'task_id',
string='Attachment')
string='Attachment')
delete_file = fields.Boolean(string='Delete file')
move_file = fields.Boolean(string='Move file')
move_path = fields.Char(string='Move path')
@ -69,21 +69,21 @@ class Task(models.Model):
def run(self):
for cls in itersubclasses(AbstractTask):
if cls._synchronize_type and \
cls._key + '_' + cls._synchronize_type == self.method:
method_class = cls
cls._key + '_' + cls._synchronize_type == self.method:
method_class = cls
config = {
'host': self.location_id.address,
'user': self.location_id.login,
'pwd': self.location_id.password,
'port': self.location_id.port,
'allow_dir_creation': False,
'file_name': self.filename,
'path': self.filepath,
'attachment_ids': self.attachment_ids,
'task': self,
'move_path': self.move_path,
'delete_file': self.delete_file,
'move_file': self.move_file,
}
'host': self.location_id.address,
'user': self.location_id.login,
'pwd': self.location_id.password,
'port': self.location_id.port,
'allow_dir_creation': False,
'file_name': self.filename,
'path': self.filepath,
'attachment_ids': self.attachment_ids,
'task': self,
'move_path': self.move_path,
'delete_file': self.delete_file,
'move_file': self.move_file,
}
conn = method_class(self.env, config)
conn.run()