示例#1
0
    def create_gl_transactions(self, trans):
        
        "Make any GL transactions this needs"
        for trandict in trans:
            d2 = trandict.copy()
            
            if not d2.has_key('date_end'):
                d2['date_end'] = d2['date']

            try:
                tags = ','.join(d2.pop('tags'))
            except:
                tags = ''

            d2['company'] = d2['company'].id if isinstance (d2['company'], accountifie.gl.models.Company) else d2['company']

            lines = d2.pop('lines')
            trans_id = d2.pop('trans_id')
            bmo_id = d2.pop('bmo_id')

            lines = [{
                        'account': account.id if isinstance (account, accountifie.gl.models.Account) else account,
                        'amount': "{0:.2f}".format(amount),
                        'counterparty': counterparty.id if isinstance (counterparty, accountifie.gl.models.Counterparty) else counterparty,
                        'tags': tags
                        } for account, amount, counterparty, tags in lines]
            
            QMSF.getInstance().get().create_gl_transactions(d2, lines, trans_id, bmo_id)

            """
示例#2
0
    def create_gl_transactions(self, trans):

        "Make any GL transactions this needs"
        for trandict in trans:
            d2 = trandict.copy()

            if not d2.has_key('date_end'):
                d2['date_end'] = d2['date']

            try:
                tags = ','.join(d2.pop('tags'))
            except:
                tags = ''

            d2['company'] = d2['company'].id if isinstance(
                d2['company'],
                accountifie.gl.models.Company) else d2['company']

            lines = d2.pop('lines')
            trans_id = d2.pop('trans_id')
            bmo_id = d2.pop('bmo_id')

            lines = [{
                'account':
                account.id if isinstance(
                    account, accountifie.gl.models.Account) else account,
                'amount':
                "{0:.2f}".format(amount),
                'counterparty':
                counterparty.id if isinstance(
                    counterparty, accountifie.gl.models.Counterparty) else
                counterparty,
                'tags':
                tags
            } for account, amount, counterparty, tags in lines]

            QMSF.getInstance().get().create_gl_transactions(
                d2, lines, trans_id, bmo_id)
            """
示例#3
0
 def delete_from_gl(self):
     "Find and remove all GL entries which depend on self"        
     bmo_id = '%s.%s' %(self.short_code, self.id)
     QMSF.getInstance().get().delete_bmo_transactions(self.company.id, bmo_id)
示例#4
0
 def delete_from_gl(self):
     "Find and remove all GL entries which depend on self"
     bmo_id = '%s.%s' % (self.short_code, self.id)
     QMSF.getInstance().get().delete_bmo_transactions(
         self.company.id, bmo_id)