[IMP] update dotfiles
parent
c433fadc11
commit
6edf2c56b7
|
@ -24,7 +24,7 @@ except ImportError:
|
|||
|
||||
|
||||
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):
|
||||
for i in range(value.count("?(")):
|
||||
if value and "?(" in value and ")" in value:
|
||||
|
@ -38,7 +38,7 @@ def adjust_cell_formula(value, k):
|
|||
|
||||
|
||||
def get_field_aggregation(field):
|
||||
""" i..e, 'field@{sum}' """
|
||||
"""i..e, 'field@{sum}'"""
|
||||
if field and "@{" in field and "}" in field:
|
||||
i = field.index("@{")
|
||||
j = field.index("}", i)
|
||||
|
@ -52,7 +52,7 @@ def get_field_aggregation(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:
|
||||
i = field.index("${")
|
||||
j = field.index("}", i)
|
||||
|
@ -87,7 +87,7 @@ def get_field_style(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:
|
||||
i = field.index("#?")
|
||||
j = field.index("?", i + 2)
|
||||
|
@ -128,7 +128,7 @@ def fill_cell_style(field, field_style, styles):
|
|||
|
||||
|
||||
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:
|
||||
i = line_field.index("[")
|
||||
j = line_field.index("]")
|
||||
|
@ -162,7 +162,7 @@ def split_row_col(pos):
|
|||
|
||||
|
||||
def openpyxl_get_sheet_by_name(book, name):
|
||||
""" Get sheet by name for openpyxl """
|
||||
"""Get sheet by name for openpyxl"""
|
||||
i = 0
|
||||
for sheetname in book.sheetnames:
|
||||
if sheetname == name:
|
||||
|
|
|
@ -19,7 +19,7 @@ class XLSXStyles(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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 {
|
||||
"font": {
|
||||
"bold": Font(name="Arial", size=10, bold=True),
|
||||
|
|
|
@ -110,7 +110,7 @@ class XLSXExport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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:
|
||||
return
|
||||
try:
|
||||
|
@ -143,7 +143,7 @@ class XLSXExport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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:
|
||||
return None
|
||||
line_copy = _line
|
||||
|
|
|
@ -43,7 +43,7 @@ class XLSXImport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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"]
|
||||
xml_id = record.get_external_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
|
||||
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:
|
||||
return
|
||||
try:
|
||||
|
@ -97,7 +97,7 @@ class XLSXImport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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)
|
||||
test_rows = {}
|
||||
max_end_row = 0
|
||||
|
@ -118,7 +118,7 @@ class XLSXImport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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 = {}
|
||||
end_row = self._get_end_row(st, worksheet, line_field)
|
||||
for rc, columns in worksheet.get(line_field, {}).items():
|
||||
|
@ -193,7 +193,7 @@ class XLSXImport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
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:
|
||||
return
|
||||
try:
|
||||
|
@ -263,7 +263,7 @@ class XLSXImport(models.AbstractModel):
|
|||
|
||||
@api.model
|
||||
def _post_import_operation(self, record, operation):
|
||||
""" Run python code after import """
|
||||
"""Run python code after import"""
|
||||
if not record or not operation:
|
||||
return
|
||||
try:
|
||||
|
|
|
@ -6,7 +6,7 @@ from odoo.exceptions import ValidationError
|
|||
|
||||
|
||||
class XLSXReport(models.AbstractModel):
|
||||
""" Common class for xlsx reporting wizard """
|
||||
"""Common class for xlsx reporting wizard"""
|
||||
|
||||
_name = "xlsx.report"
|
||||
_description = "Excel Report AbstractModel"
|
||||
|
|
|
@ -363,7 +363,7 @@ self['{}'] = self.env['{}'].search(self.safe_domain(self.domain))
|
|||
rec.post_import_hook = input_dict.get("__POST_IMPORT__")
|
||||
|
||||
def _compute_output_instruction(self):
|
||||
""" From database, compute back to dictionary """
|
||||
"""From database, compute back to dictionary"""
|
||||
for rec in self:
|
||||
inst_dict = {}
|
||||
prev_sheet = False
|
||||
|
|
|
@ -41,7 +41,7 @@ class ImportXLSXWizard(models.TransientModel):
|
|||
|
||||
@api.model
|
||||
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_model = self._context.get("active_model", False)
|
||||
res_id = self._context.get("active_id", False)
|
||||
|
|
Loading…
Reference in New Issue