[IMP] excel_import_export: black, isort, prettier

pull/2505/head
Kitti U 2021-02-13 14:08:54 +07:00 committed by Aungkokolin1997
parent 7162b84404
commit 354890e57a
8 changed files with 41 additions and 34 deletions

View File

@ -7,7 +7,7 @@
"version": "13.0.1.0.0",
"author": "Ecosoft,Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/server-tools/",
"website": "https://github.com/OCA/server-tools",
"category": "Tools",
"depends": ["mail"],
"external_dependencies": {"python": ["xlrd", "xlwt", "openpyxl"]},

View File

@ -8,7 +8,7 @@ from odoo import api, models
_logger = logging.getLogger(__name__)
try:
from openpyxl.styles import PatternFill, Alignment, Font
from openpyxl.styles import Alignment, Font, PatternFill
except ImportError:
_logger.debug('Cannot import "openpyxl". Please make sure it is installed.')

View File

@ -95,10 +95,12 @@ class XLSXTemplate(models.Model):
)
# Utilities
export_action_id = fields.Many2one(
comodel_name="ir.actions.act_window", ondelete="set null",
comodel_name="ir.actions.act_window",
ondelete="set null",
)
import_action_id = fields.Many2one(
comodel_name="ir.actions.act_window", ondelete="set null",
comodel_name="ir.actions.act_window",
ondelete="set null",
)
use_report_wizard = fields.Boolean(
string="Easy Reporting",
@ -109,12 +111,17 @@ class XLSXTemplate(models.Model):
string="Report Model",
help="When use commone wizard, choose the result model",
)
result_field = fields.Char(compute="_compute_result_field",)
result_field = fields.Char(
compute="_compute_result_field",
)
report_menu_id = fields.Many2one(
comodel_name="ir.ui.menu", string="Report Menu", readonly=True,
comodel_name="ir.ui.menu",
string="Report Menu",
readonly=True,
)
report_action_id = fields.Many2one(
comodel_name="ir.actions.report", string="Report Action",
comodel_name="ir.actions.report",
string="Report Action",
)
def _compute_result_field(self):
@ -208,8 +215,8 @@ class XLSXTemplate(models.Model):
_field.ensure_one()
_field.write({"relation": self.result_model_id.model})
_field.compute = """
self['%s'] = self.env['%s'].search(self.safe_domain(self.domain))
""" % (
self['{}'] = self.env['{}'].search(self.safe_domain(self.domain))
""".format(
self.result_field,
self.result_model_id.model,
)

View File

@ -41,7 +41,7 @@ odoo.define("excel_import_export.report", function(require) {
data: JSON.stringify([new_url, type]),
},
success: resolve,
error: error => {
error: (error) => {
self.call("crash_manager", "rpc_error", error);
reject();
},