(self)
return res
Method that compares a file against a BOE export config.

        @return: Action dictionary for showing comparison.
Method that compares a file against a BOE export config.
Method that compares a file against a BOE export config .
def button_compare_file(self):
        """Method that compares a file against a BOE export config.

        @return: Action dictionary for showing comparison.
        """
        self.ensure_one()
        active_id = self.env.context.get("active_id", False)
        active_model = self.env.context.get("active_model", False)
        if not active_id or not active_model:
            return False
        config = self.env[active_model].browse(active_id)
        data = base64.decodebytes(self.data)
        offset, lines = self._compare_boe_lines(config, data)
        # Allow a bit of difference according presence of final CR+LF
        if abs(offset - len(data)) > 2:
            raise exceptions.UserError(
                _(
                    "The length of the file is different from the expected one, "
                    "or there are conditional parts in the export configuration "
                    "that can't be evaled statically."
                )
            )
        self.write({"line_ids": lines, "state": "compare"})
        res = self.env.ref("l10n_es_aeat.action_wizard_compare_boe_file").read()[0]
        res["res_id"] = self.id
        return res
def button_compare_file ( self ) : self . ensure_one ( ) active_id = self . env . context . get ( "active_id" , False ) active_model = self . env . context . get ( "active_model" , False ) if not active_id or not active_model : return False config = self . env [ active_model ] . browse ( active_id ) data = base64 . decodebytes ( self . data ) offset , lines = self . _compare_boe_lines ( config , data ) # Allow a bit of difference according presence of final CR+LF if abs ( offset - len ( data ) ) > 2 : raise exceptions . UserError ( _ ( "The length of the file is different from the expected one, " "or there are conditional parts in the export configuration " "that can't be evaled statically." ) ) self . write ( { "line_ids" : lines , "state" : "compare" } ) res = self . env . ref ( "l10n_es_aeat.action_wizard_compare_boe_file" ) . read ( ) [ 0 ] res [ "res_id" ] = self . id return res