[13.0][MIGRATE] migrate module account_ebics.

This commit is contained in:
phanupong 2020-05-29 09:24:49 +07:00 committed by Luc De Meyer
parent 28cb01670c
commit 6773222e03
9 changed files with 9 additions and 41 deletions

View File

@ -3,7 +3,7 @@
{ {
'name': 'EBICS banking protocol', 'name': 'EBICS banking protocol',
'version': '12.0.1.0.1', 'version': '13.0.1.0.1',
'license': 'LGPL-3', 'license': 'LGPL-3',
'author': 'Noviat', 'author': 'Noviat',
'category': 'Accounting & Finance', 'category': 'Accounting & Finance',
@ -21,4 +21,5 @@
], ],
'installable': True, 'installable': True,
'application': True, 'application': True,
'external_dependencies': {'python': ['fintech', ]},
} }

View File

@ -1,13 +1,6 @@
# Copyright 2009-2019 Noviat. # Copyright 2009-2019 Noviat.
# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
"""
import logging
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s] %(levelname)s - %(name)s: %(message)s')
"""
import base64 import base64
import logging import logging
import re import re
@ -222,14 +215,12 @@ class EbicsConfig(models.Model):
self._cr.dbname, self._cr.dbname,
'mykeys']) 'mykeys'])
@api.multi
@api.depends('ebics_keys') @api.depends('ebics_keys')
def _compute_ebics_keys_found(self): def _compute_ebics_keys_found(self):
for cfg in self: for cfg in self:
cfg.ebics_keys_found = ( cfg.ebics_keys_found = (
cfg.ebics_keys and os.path.isfile(cfg.ebics_keys)) cfg.ebics_keys and os.path.isfile(cfg.ebics_keys))
@api.multi
@api.constrains('order_number') @api.constrains('order_number')
def _check_order_number(self): def _check_order_number(self):
for cfg in self: for cfg in self:
@ -247,7 +238,6 @@ class EbicsConfig(models.Model):
"Order Number should comply with the following pattern:" "Order Number should comply with the following pattern:"
"\n[A-Z]{1}[A-Z0-9]{3}")) "\n[A-Z]{1}[A-Z0-9]{3}"))
@api.multi
def unlink(self): def unlink(self):
for ebics_config in self: for ebics_config in self:
if ebics_config.state == 'active': if ebics_config.state == 'active':
@ -255,19 +245,15 @@ class EbicsConfig(models.Model):
"You cannot remove active EBICS congirations.")) "You cannot remove active EBICS congirations."))
return super(EbicsConfig, self).unlink() return super(EbicsConfig, self).unlink()
@api.multi
def set_to_draft(self): def set_to_draft(self):
return self.write({'state': 'draft'}) return self.write({'state': 'draft'})
@api.multi
def set_to_get_bank_keys(self): def set_to_get_bank_keys(self):
return self.write({'state': 'get_bank_keys'}) return self.write({'state': 'get_bank_keys'})
@api.multi
def set_to_active(self): def set_to_active(self):
return self.write({'state': 'active'}) return self.write({'state': 'active'})
@api.multi
def ebics_init_1(self): def ebics_init_1(self):
""" """
Initialization of bank keys - Step 1: Initialization of bank keys - Step 1:
@ -387,7 +373,6 @@ class EbicsConfig(models.Model):
return self.write({'state': 'init'}) return self.write({'state': 'init'})
@api.multi
def ebics_init_2(self): def ebics_init_2(self):
""" """
Initialization of bank keys - Step 2: Initialization of bank keys - Step 2:
@ -399,7 +384,6 @@ class EbicsConfig(models.Model):
self.ensure_one() self.ensure_one()
return self.write({'state': 'get_bank_keys'}) return self.write({'state': 'get_bank_keys'})
@api.multi
def ebics_init_3(self): def ebics_init_3(self):
""" """
Initialization of bank keys - Step 3: Initialization of bank keys - Step 3:
@ -437,7 +421,6 @@ class EbicsConfig(models.Model):
return True return True
@api.multi
def ebics_init_4(self): def ebics_init_4(self):
""" """
Initialization of bank keys - Step 2: Initialization of bank keys - Step 2:
@ -456,7 +439,6 @@ class EbicsConfig(models.Model):
bank.activate_keys() bank.activate_keys()
return self.write({'state': 'active'}) return self.write({'state': 'active'})
@api.multi
def change_passphrase(self): def change_passphrase(self):
self.ensure_one() self.ensure_one()
ctx = dict(self._context, default_ebics_config_id=self.id) ctx = dict(self._context, default_ebics_config_id=self.id)

View File

@ -66,7 +66,6 @@ class EbicsFile(models.Model):
""" """
return self.env.user.company_id return self.env.user.company_id
@api.multi
def unlink(self): def unlink(self):
ff_methods = self._file_format_methods() ff_methods = self._file_format_methods()
for ebics_file in self: for ebics_file in self:
@ -82,15 +81,12 @@ class EbicsFile(models.Model):
ebics_file.bank_statement_ids.unlink() ebics_file.bank_statement_ids.unlink()
return super(EbicsFile, self).unlink() return super(EbicsFile, self).unlink()
@api.multi
def set_to_draft(self): def set_to_draft(self):
return self.write({'state': 'draft'}) return self.write({'state': 'draft'})
@api.multi
def set_to_done(self): def set_to_done(self):
return self.write({'state': 'done'}) return self.write({'state': 'done'})
@api.multi
def process(self): def process(self):
self.ensure_one() self.ensure_one()
self.note_process = '' self.note_process = ''
@ -104,7 +100,6 @@ class EbicsFile(models.Model):
else: else:
return self._process_undefined_format() return self._process_undefined_format()
@api.multi
def action_open_bank_statements(self): def action_open_bank_statements(self):
self.ensure_one() self.ensure_one()
action = self.env['ir.actions.act_window'].for_xml_id( action = self.env['ir.actions.act_window'].for_xml_id(
@ -114,7 +109,6 @@ class EbicsFile(models.Model):
action.update({'domain': domain}) action.update({'domain': domain})
return action return action
@api.multi
def button_close(self): def button_close(self):
self.ensure_one() self.ensure_one()
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}

View File

@ -5,7 +5,7 @@
<field name="name">ebics.config.tree</field> <field name="name">ebics.config.tree</field>
<field name="model">ebics.config</field> <field name="model">ebics.config</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="EBICS Configuration" colors="blue:state!='active'"> <tree string="EBICS Configuration" decoration-muted="state!='active'">
<field name="name"/> <field name="name"/>
<field name="bank_id"/> <field name="bank_id"/>
<field name="ebics_host"/> <field name="ebics_host"/>
@ -113,7 +113,7 @@
<record id="ebics_config_action" model="ir.actions.act_window"> <record id="ebics_config_action" model="ir.actions.act_window">
<field name="name">EBICS Configuration</field> <field name="name">EBICS Configuration</field>
<field name="res_model">ebics.config</field> <field name="res_model">ebics.config</field>
<field name="view_type">form</field> <!-- <field name="view_type">form</field> -->
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>

View File

@ -36,7 +36,7 @@
<field name="name">ebics.file.tree</field> <field name="name">ebics.file.tree</field>
<field name="model">ebics.file</field> <field name="model">ebics.file</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="EBICS Files" colors="blue:state=='draft'" create="false"> <tree string="EBICS Files" decoration-muted="state=='draft'" create="false">
<field name="date" string="Download Date"/> <field name="date" string="Download Date"/>
<field name="name"/> <field name="name"/>
<field name="date_from"/> <field name="date_from"/>
@ -111,7 +111,6 @@
<field name="name">EBICS Download Files</field> <field name="name">EBICS Download Files</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ebics.file</field> <field name="res_model">ebics.file</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/> <field name="view_id" eval="False"/>
<field name="domain">[('type','=','down')]</field> <field name="domain">[('type','=','down')]</field>
@ -144,7 +143,7 @@
<field name="name">ebics.file.tree</field> <field name="name">ebics.file.tree</field>
<field name="model">ebics.file</field> <field name="model">ebics.file</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="EBICS Files" colors="blue:state=='draft'" create="false"> <tree string="EBICS Files" decoration-muted="state=='draft'" create="false">
<field name="date" string="Upload Date"/> <field name="date" string="Upload Date"/>
<field name="name"/> <field name="name"/>
<field name="user_id"/> <field name="user_id"/>
@ -187,7 +186,6 @@
<field name="name">EBICS Upload Files</field> <field name="name">EBICS Upload Files</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ebics.file</field> <field name="res_model">ebics.file</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/> <field name="view_id" eval="False"/>
<field name="domain">[('type','=','up')]</field> <field name="domain">[('type','=','up')]</field>

View File

@ -36,7 +36,7 @@
<record id="ebics_file_format_action" model="ir.actions.act_window"> <record id="ebics_file_format_action" model="ir.actions.act_window">
<field name="name">EBICS File Formats</field> <field name="name">EBICS File Formats</field>
<field name="res_model">ebics.file.format</field> <field name="res_model">ebics.file.format</field>
<field name="view_type">form</field> <!-- <field name="view_type">form</field> -->
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>

View File

@ -35,7 +35,6 @@ class EbicsChangePassphrase(models.TransientModel):
required=True) required=True)
note = fields.Text(string='Notes', readonly=True) note = fields.Text(string='Notes', readonly=True)
@api.multi
def change_passphrase(self): def change_passphrase(self):
self.ensure_one() self.ensure_one()
if self.old_pass != self.ebics_config_id.ebics_passphrase: if self.old_pass != self.ebics_config_id.ebics_passphrase:
@ -71,7 +70,6 @@ class EbicsChangePassphrase(models.TransientModel):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
} }
@api.multi
def button_close(self): def button_close(self):
self.ensure_one() self.ensure_one()
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}

View File

@ -125,7 +125,6 @@ class EbicsXfer(models.TransientModel):
def _onchange_format_id(self): def _onchange_format_id(self):
self.order_type = self.format_id.order_type self.order_type = self.format_id.order_type
@api.multi
def ebics_upload(self): def ebics_upload(self):
self.ensure_one() self.ensure_one()
ctx = self._context.copy() ctx = self._context.copy()
@ -147,7 +146,6 @@ class EbicsXfer(models.TransientModel):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
} }
@api.multi
def ebics_download(self): def ebics_download(self):
self.ensure_one() self.ensure_one()
self.ebics_config_id._check_ebics_files() self.ebics_config_id._check_ebics_files()
@ -238,12 +236,10 @@ class EbicsXfer(models.TransientModel):
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
} }
@api.multi
def button_close(self): def button_close(self):
self.ensure_one() self.ensure_one()
return {'type': 'ir.actions.act_window_close'} return {'type': 'ir.actions.act_window_close'}
@api.multi
def view_ebics_file(self): def view_ebics_file(self):
self.ensure_one() self.ensure_one()
module = __name__.split('addons.')[1].split('.')[0] module = __name__.split('addons.')[1].split('.')[0]
@ -335,7 +331,6 @@ class EbicsXfer(models.TransientModel):
return ebics_file return ebics_file
@api.multi
def _setup_client(self): def _setup_client(self):
self.ebics_config_id._check_ebics_keys() self.ebics_config_id._check_ebics_keys()
passphrase = self._get_passphrase() passphrase = self._get_passphrase()

View File

@ -70,7 +70,7 @@
<field name="name">EBICS File Transfer</field> <field name="name">EBICS File Transfer</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ebics.xfer</field> <field name="res_model">ebics.xfer</field>
<field name="view_type">form</field> <!-- <field name="view_type">form</field> -->
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</field>
<field name="context">{'ebics_download': 1}</field> <field name="context">{'ebics_download': 1}</field>
@ -81,7 +81,7 @@
<field name="name">EBICS File Transfer</field> <field name="name">EBICS File Transfer</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ebics.xfer</field> <field name="res_model">ebics.xfer</field>
<field name="view_type">form</field> <!-- <field name="view_type">form</field> -->
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</field>
<field name="context">{'ebics_upload': 1}</field> <field name="context">{'ebics_upload': 1}</field>