Exemplo n.º 1
0
    def parse_Stmt(self, cr, node):
        """
        Parse a single Stmt node.

        Be sure to craft a unique, but short enough statement identifier,
        as it is used as the basis of the generated move lines' names
        which overflow when using the full IBAN and CAMT statement id.
        """
        statement = models.mem_bank_statement()
        statement.local_account = (self.xpath(
            node, './ns:Acct/ns:Id/ns:IBAN')[0].text if self.xpath(
                node, './ns:Acct/ns:Id/ns:IBAN') else self.xpath(
                    node, './ns:Acct/ns:Id/ns:Othr/ns:Id')[0].text)

        identifier = node.find(self.ns + 'Id').text
        if identifier.upper().startswith('CAMT053'):
            identifier = identifier[7:]
        statement.id = self.get_unique_statement_id(
            cr, "%s-%s" % (self.get_unique_account_identifier(
                cr, statement.local_account), identifier))

        statement.local_currency = self.xpath(node, './ns:Acct/ns:Ccy')[0].text
        statement.start_balance = self.get_start_balance(node)
        statement.end_balance = self.get_end_balance(node)
        number = 0
        for Ntry in self.xpath(node, './ns:Ntry'):
            transaction_detail = self.parse_Ntry(Ntry)
            if number == 0:
                # Take the statement date from the first transaction
                statement.date = str2date(transaction_detail['execution_date'],
                                          "%Y-%m-%d")
            number += 1
            transaction_detail['id'] = str(number).zfill(4)
            statement.transactions.append(transaction(transaction_detail))
        return statement
Exemplo n.º 2
0
    def parse_Stmt(self, cr, node):
        """
        Parse a single Stmt node.

        Be sure to craft a unique, but short enough statement identifier,
        as it is used as the basis of the generated move lines' names
        which overflow when using the full IBAN and CAMT statement id.
        """
        statement = models.mem_bank_statement()
        statement.local_account = (
            self.xpath(node, './ns:Acct/ns:Id/ns:IBAN')[0].text
            if self.xpath(node, './ns:Acct/ns:Id/ns:IBAN')
            else self.xpath(node, './ns:Acct/ns:Id/ns:Othr/ns:Id')[0].text)

        identifier = node.find(self.ns + 'Id').text
        if identifier.upper().startswith('CAMT053'):
            identifier = identifier[7:]
        statement.id = self.get_unique_statement_id(
            cr, "%s-%s" % (
                self.get_unique_account_identifier(
                    cr, statement.local_account),
                identifier)
            )

        statement.local_currency = self.xpath(node, './ns:Acct/ns:Ccy')[0].text
        statement.start_balance = self.get_start_balance(node)
        statement.end_balance = self.get_end_balance(node)
        number = 0
        for Ntry in self.xpath(node, './ns:Ntry'):
            transaction_detail = self.parse_Ntry(Ntry)
            if number == 0:
                # Take the statement date from the first transaction
                statement.date = str2date(
                    transaction_detail['execution_date'], "%Y-%m-%d")
            number += 1
            transaction_detail['id'] = str(number).zfill(4)
            statement.transactions.append(
                transaction(transaction_detail))
        return statement
Exemplo n.º 3
0
 def create_statement(self, cr):
     '''create a mem_bank_statement - override if you need a custom
     implementation'''
     return mem_bank_statement()
Exemplo n.º 4
0
 def create_statement(self, cr):
     '''create a mem_bank_statement - override if you need a custom
     implementation'''
     return mem_bank_statement()