addons14/account_financial_report/report/abstract_report_xlsx.py
def write_line_from_dict(self, line_dict):
        """Write a line on current line"""
        for col_pos, column in self.columns.items():
            value = line_dict.get(column["field"], False)
            cell_type = column.get("type", "string")
            if cell_type == "string":
                if (
                    line_dict.get("account_group_id", False)
                    and line_dict["account_group_id"]
                ):
                    self.sheet.write_string(
                        self.row_pos, col_pos, value or "", self.format_bold
                    )
                else:
                    if (
                        not isinstance(value, str)
                        and not isinstance(value, bool)
                        and not isinstance(value, int)
                    ):
                        value = value and value.strftime("%d/%m/%Y")
                    self.sheet.write_string(self.row_pos, col_pos, value or "")
            elif cell_type == "amount":
                if (
                    line_dict.get("account_group_id", False)
                    and line_dict["account_group_id"]
                ):
                    cell_format = self.format_amount_bold
                else:
                    cell_format = self.format_amount
                self.sheet.write_number(
                    self.row_pos, col_pos, float(value), cell_format
                )
            elif cell_type == "amount_currency":
                if line_dict.get("currency_name", False):
                    format_amt = self._get_currency_amt_format_dict(line_dict)
                    self.sheet.write_number(
                        self.row_pos, col_pos, float(value), format_amt
                    )
            elif cell_type == "currency_name":
                self.sheet.write_string(
                    self.row_pos, col_pos, value or "", self.format_right
                )
        self.row_pos += 1
Write a line on current line
Write a line on current line
Write a line on current line
def write_line_from_dict(self, line_dict):
        for col_pos, column in self.columns.items():
            value = line_dict.get(column["field"], False)
            cell_type = column.get("type", "string")
            if cell_type == "string":
                if (
                    line_dict.get("account_group_id", False)
                    and line_dict["account_group_id"]
                ):
                    self.sheet.write_string(
                        self.row_pos, col_pos, value or "", self.format_bold
                    )
                else:
                    if (
                        not isinstance(value, str)
                        and not isinstance(value, bool)
                        and not isinstance(value, int)
                    ):
                        value = value and value.strftime("%d/%m/%Y")
                    self.sheet.write_string(self.row_pos, col_pos, value or "")
            elif cell_type == "amount":
                if (
                    line_dict.get("account_group_id", False)
                    and line_dict["account_group_id"]
                ):
                    cell_format = self.format_amount_bold
                else:
                    cell_format = self.format_amount
                self.sheet.write_number(
                    self.row_pos, col_pos, float(value), cell_format
                )
            elif cell_type == "amount_currency":
                if line_dict.get("currency_name", False):
                    format_amt = self._get_currency_amt_format_dict(line_dict)
                    self.sheet.write_number(
                        self.row_pos, col_pos, float(value), format_amt
                    )
            elif cell_type == "currency_name":
                self.sheet.write_string(
                    self.row_pos, col_pos, value or "", self.format_right
                )
        self.row_pos += 1
def write_line_from_dict ( self , line_dict ) : for col_pos , column in self . columns . items ( ) : value = line_dict . get ( column [ "field" ] , False ) cell_type = column . get ( "type" , "string" ) if cell_type == "string" : if ( line_dict . get ( "account_group_id" , False ) and line_dict [ "account_group_id" ] ) : self . sheet . write_string ( self . row_pos , col_pos , value or "" , self . format_bold ) else : if ( not isinstance ( value , str ) and not isinstance ( value , bool ) and not isinstance ( value , int ) ) : value = value and value . strftime ( "%d/%m/%Y" ) self . sheet . write_string ( self . row_pos , col_pos , value or "" ) elif cell_type == "amount" : if ( line_dict . get ( "account_group_id" , False ) and line_dict [ "account_group_id" ] ) : cell_format = self . format_amount_bold else : cell_format = self . format_amount self . sheet . write_number ( self . row_pos , col_pos , float ( value ) , cell_format ) elif cell_type == "amount_currency" : if line_dict . get ( "currency_name" , False ) : format_amt = self . _get_currency_amt_format_dict ( line_dict ) self . sheet . write_number ( self . row_pos , col_pos , float ( value ) , format_amt ) elif cell_type == "currency_name" : self . sheet . write_string ( self . row_pos , col_pos , value or "" , self . format_right ) self . row_pos += 1
Write a line on current line
Write a line on current line
"""Write a line on current line"""
self
line_dict