[IMP] update dotfiles

pull/2505/head
oca-git-bot 2022-03-30 21:12:54 +02:00 committed by Aungkokolin1997
parent c433fadc11
commit 6edf2c56b7
7 changed files with 18 additions and 18 deletions

View File

@ -24,7 +24,7 @@ except ImportError:
def adjust_cell_formula(value, k): def adjust_cell_formula(value, k):
""" Cell formula, i.e., if i=5, val=?(A11)+?(B12) -> val=A16+B17 """ """Cell formula, i.e., if i=5, val=?(A11)+?(B12) -> val=A16+B17"""
if isinstance(value, str): if isinstance(value, str):
for i in range(value.count("?(")): for i in range(value.count("?(")):
if value and "?(" in value and ")" in value: if value and "?(" in value and ")" in value:
@ -38,7 +38,7 @@ def adjust_cell_formula(value, k):
def get_field_aggregation(field): def get_field_aggregation(field):
""" i..e, 'field@{sum}' """ """i..e, 'field@{sum}'"""
if field and "@{" in field and "}" in field: if field and "@{" in field and "}" in field:
i = field.index("@{") i = field.index("@{")
j = field.index("}", i) j = field.index("}", i)
@ -52,7 +52,7 @@ def get_field_aggregation(field):
def get_field_condition(field): def get_field_condition(field):
""" i..e, 'field${value > 0 and value or False}' """ """i..e, 'field${value > 0 and value or False}'"""
if field and "${" in field and "}" in field: if field and "${" in field and "}" in field:
i = field.index("${") i = field.index("${")
j = field.index("}", i) j = field.index("}", i)
@ -87,7 +87,7 @@ def get_field_style(field):
def get_field_style_cond(field): def get_field_style_cond(field):
""" i..e, 'field#?object.partner_id and #{font=bold} or #{}?' """ """i..e, 'field#?object.partner_id and #{font=bold} or #{}?'"""
if field and "#?" in field and "?" in field: if field and "#?" in field and "?" in field:
i = field.index("#?") i = field.index("#?")
j = field.index("?", i + 2) j = field.index("?", i + 2)
@ -128,7 +128,7 @@ def fill_cell_style(field, field_style, styles):
def get_line_max(line_field): def get_line_max(line_field):
""" i.e., line_field = line_ids[100], max = 100 else 0 """ """i.e., line_field = line_ids[100], max = 100 else 0"""
if line_field and "[" in line_field and "]" in line_field: if line_field and "[" in line_field and "]" in line_field:
i = line_field.index("[") i = line_field.index("[")
j = line_field.index("]") j = line_field.index("]")
@ -162,7 +162,7 @@ def split_row_col(pos):
def openpyxl_get_sheet_by_name(book, name): def openpyxl_get_sheet_by_name(book, name):
""" Get sheet by name for openpyxl """ """Get sheet by name for openpyxl"""
i = 0 i = 0
for sheetname in book.sheetnames: for sheetname in book.sheetnames:
if sheetname == name: if sheetname == name:

View File

@ -19,7 +19,7 @@ class XLSXStyles(models.AbstractModel):
@api.model @api.model
def get_openpyxl_styles(self): def get_openpyxl_styles(self):
""" List all syles that can be used with styleing directive #{...} """ """List all syles that can be used with styleing directive #{...}"""
return { return {
"font": { "font": {
"bold": Font(name="Arial", size=10, bold=True), "bold": Font(name="Arial", size=10, bold=True),

View File

@ -110,7 +110,7 @@ class XLSXExport(models.AbstractModel):
@api.model @api.model
def _fill_workbook_data(self, workbook, record, data_dict): def _fill_workbook_data(self, workbook, record, data_dict):
""" Fill data from record with style in data_dict to workbook """ """Fill data from record with style in data_dict to workbook"""
if not record or not data_dict: if not record or not data_dict:
return return
try: try:
@ -143,7 +143,7 @@ class XLSXExport(models.AbstractModel):
@api.model @api.model
def _get_field_data(self, _field, _line): def _get_field_data(self, _field, _line):
""" Get field data, and convert data type if needed """ """Get field data, and convert data type if needed"""
if not _field: if not _field:
return None return None
line_copy = _line line_copy = _line

View File

@ -43,7 +43,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def get_external_id(self, record): def get_external_id(self, record):
""" Get external ID of the record, if not already exists create one """ """Get external ID of the record, if not already exists create one"""
ModelData = self.env["ir.model.data"] ModelData = self.env["ir.model.data"]
xml_id = record.get_external_id() xml_id = record.get_external_id()
if not xml_id or (record.id in xml_id and xml_id[record.id] == ""): if not xml_id or (record.id in xml_id and xml_id[record.id] == ""):
@ -75,7 +75,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def _delete_record_data(self, record, data_dict): def _delete_record_data(self, record, data_dict):
""" If no _NODEL_, delete existing lines before importing """ """If no _NODEL_, delete existing lines before importing"""
if not record or not data_dict: if not record or not data_dict:
return return
try: try:
@ -97,7 +97,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def _get_end_row(self, st, worksheet, line_field): def _get_end_row(self, st, worksheet, line_field):
""" Get max row or next empty row as the ending row """ """Get max row or next empty row as the ending row"""
_x, max_row = co.get_line_max(line_field) _x, max_row = co.get_line_max(line_field)
test_rows = {} test_rows = {}
max_end_row = 0 max_end_row = 0
@ -118,7 +118,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def _get_line_vals(self, st, worksheet, model, line_field): def _get_line_vals(self, st, worksheet, model, line_field):
""" Get values of this field from excel sheet """ """Get values of this field from excel sheet"""
vals = {} vals = {}
end_row = self._get_end_row(st, worksheet, line_field) end_row = self._get_end_row(st, worksheet, line_field)
for rc, columns in worksheet.get(line_field, {}).items(): for rc, columns in worksheet.get(line_field, {}).items():
@ -193,7 +193,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def _import_record_data(self, import_file, record, data_dict): def _import_record_data(self, import_file, record, data_dict):
""" From complex excel, create temp simple excel and do import """ """From complex excel, create temp simple excel and do import"""
if not data_dict: if not data_dict:
return return
try: try:
@ -263,7 +263,7 @@ class XLSXImport(models.AbstractModel):
@api.model @api.model
def _post_import_operation(self, record, operation): def _post_import_operation(self, record, operation):
""" Run python code after import """ """Run python code after import"""
if not record or not operation: if not record or not operation:
return return
try: try:

View File

@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError
class XLSXReport(models.AbstractModel): class XLSXReport(models.AbstractModel):
""" Common class for xlsx reporting wizard """ """Common class for xlsx reporting wizard"""
_name = "xlsx.report" _name = "xlsx.report"
_description = "Excel Report AbstractModel" _description = "Excel Report AbstractModel"

View File

@ -363,7 +363,7 @@ self['{}'] = self.env['{}'].search(self.safe_domain(self.domain))
rec.post_import_hook = input_dict.get("__POST_IMPORT__") rec.post_import_hook = input_dict.get("__POST_IMPORT__")
def _compute_output_instruction(self): def _compute_output_instruction(self):
""" From database, compute back to dictionary """ """From database, compute back to dictionary"""
for rec in self: for rec in self:
inst_dict = {} inst_dict = {}
prev_sheet = False prev_sheet = False

View File

@ -41,7 +41,7 @@ class ImportXLSXWizard(models.TransientModel):
@api.model @api.model
def view_init(self, fields_list): def view_init(self, fields_list):
""" This template only works on some context of active record """ """This template only works on some context of active record"""
res = super(ImportXLSXWizard, self).view_init(fields_list) res = super(ImportXLSXWizard, self).view_init(fields_list)
res_model = self._context.get("active_model", False) res_model = self._context.get("active_model", False)
res_id = self._context.get("active_id", False) res_id = self._context.get("active_id", False)