当前位置: 首页>>代码示例>>Python>>正文


Python Pool.find方法代码示例

本文整理汇总了Python中trytond.pool.Pool.find方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.find方法的具体用法?Python Pool.find怎么用?Python Pool.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trytond.pool.Pool的用法示例。


在下文中一共展示了Pool.find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: prepare_move_lines

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import find [as 别名]
    def prepare_move_lines(self):
        move_lines = super(AccountVoucher, self).prepare_move_lines()
        Period = Pool().get('account.period')
        if self.voucher_type == 'receipt':
            if self.retenciones_soportadas:
                for retencion in self.retenciones_soportadas:
                    move_lines.append({
                        'debit': retencion.amount,
                        'credit': Decimal('0.0'),
                        'account': retencion.tax.account.id,
                        'move': self.move.id,
                        'journal': self.journal.id,
                        'period': Period.find(self.company.id, date=self.date),
                        'party': self.party.id,
                    })

        if self.voucher_type == 'payment':
            if self.retenciones_efectuadas:
                for retencion in self.retenciones_efectuadas:
                    move_lines.append({
                        'debit': Decimal('0.0'),
                        'credit': retencion.amount,
                        'account': retencion.tax.account.id,
                        'move': self.move.id,
                        'journal': self.journal.id,
                        'period': Period.find(self.company.id, date=self.date),
                        'party': self.party.id,
                    })

        return move_lines
开发者ID:HEGOArgentina,项目名称:11-modulos-ar,代码行数:32,代码来源:account_voucher_ar.py

示例2: create_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import find [as 别名]
    def create_move(self, date=None):
        """
        Create the account move for the payment

        :param date: Optional date for the account move
        :return: Active record of the created move
        """
        Currency = Pool().get('currency.currency')
        Period = Pool().get('account.period')
        Move = Pool().get('account.move')

        journal = self.gateway.journal
        date = date or self.date

        if not journal.debit_account:
            self.raise_user_error('missing_debit_account', (journal.rec_name,))

        period_id = Period.find(self.company.id, date=date)

        amount_second_currency = second_currency = None
        amount = self.amount

        if self.currency != self.company.currency:
            amount = Currency.compute(
                self.currency, self.amount, self.company.currency
            )
            amount_second_currency = self.amount
            second_currency = self.currency

        lines = [{
            'description': self.rec_name,
            'account': self.credit_account.id,
            'party': self.party.id,
            'debit': Decimal('0.0'),
            'credit': amount,
            'amount_second_currency': amount_second_currency,
            'second_currency': second_currency,
        }, {
            'description': self.rec_name,
            'account': journal.debit_account.id,
            'debit': amount,
            'credit': Decimal('0.0'),
            'amount_second_currency': amount_second_currency,
            'second_currency': second_currency,
        }]

        move, = Move.create([{
            'journal': journal.id,
            'period': period_id,
            'date': date,
            'lines': [('create', lines)],
            'origin': '%s,%d' % (self.__name__, self.id),
        }])
        Move.post([move])

        # Set the move as the move of this transaction
        self.move = move
        self.save()

        return move
开发者ID:priyankarani,项目名称:trytond-payment-gateway,代码行数:62,代码来源:transaction.py

示例3: transition_crear

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import find [as 别名]
    def transition_crear(self):
        valor_cuota_sin_interes = round(self.start.monto_prestamo / self.start.cantidad_cuotas,2)
        monto_interes_mensual = round((valor_cuota_sin_interes*self.start.interes_mensual)/100,2)
        valor_cuota_con_interes = valor_cuota_sin_interes + monto_interes_mensual

        CuotaPrestamo = Pool().get('asociadas.cuotaprestamo')
        mes_actual = self.start.mes_primera_cuota
        anio_actual = self.start.anio_primera_cuota

        #Crear Impacto Contable
        Move = Pool().get('account.move')
        Period = Pool().get('account.period')
        Currency = Pool().get('currency.currency')
        Date = Pool().get('ir.date')

        accounting_date = Date.today()
        company = Transaction().context.get('company')
        period_id = Period.find(company, date=accounting_date)        
        journal_id = 8 #Pagos
       
            
        Sequence = Pool().get('ir.sequence')

        move, = Move.create([{
                        'journal': journal_id,
                        'period': period_id,
                        'date': accounting_date,
                        'description': 'Prestamo ' + str(self.start.asociada.name),
                        'lines': [
                            ('create', [{
                                        'account': self.start.cuenta_debito.id,
                                        'debit': Decimal(self.start.monto_prestamo),                               
                                        'credit': Decimal('0.0'),
                                        'party': self.start.asociada,
                                        'description': 'Prestamo' + str(self.start.asociada.name),
                                        }, {
                                        'account': self.start.cuenta_credito.id,
                                        'debit':Decimal('0.0'),
                                        'credit':Decimal(self.start.monto_prestamo),
                                        'party': self.start.asociada,
                                        'description': 'Prestamo' + str(self.start.asociada.name),
                                        }]),
                            ],
                        }])
        
        move.save()
      
        for i in range(1, self.start.cantidad_cuotas+1):  
            vencimiento_actual = date(anio_actual,mes_actual,self.start.dia_vencimiento)  
            nueva_cuota = CuotaPrestamo(
                mes = mes_actual,
                anio = anio_actual,
                monto = valor_cuota_con_interes,
                porcentaje_interes = self.start.interes_mensual,
                interes = monto_interes_mensual,
                pagada = False,
                fecha_vencimiento = vencimiento_actual,
                asociada = self.start.asociada,
                monto_total_prestamo = self.start.monto_prestamo,
                cantidad_cuotas = self.start.cantidad_cuotas,
                mes_primera_cuota = self.start.mes_primera_cuota,
                anio_primera_cuota = self.start.anio_primera_cuota,
                cuenta_debito = self.start.cuenta_debito,
                cuenta_credito = self.start.cuenta_credito,
                fecha_creacion = accounting_date,
                )
            nueva_cuota.save()
            if mes_actual == 12:
                mes_actual = 1
                anio_actual += 1
            else:
                mes_actual += 1
        
       

        post_number = Sequence.get_id(move.period.post_move_sequence_used.id)
        move.post_number = post_number
        move.post_date = accounting_date
        move.state = 'posted' 
        move.save()
          
        
        return 'end'
开发者ID:geneos-tryton-cooperar,项目名称:asociadas,代码行数:85,代码来源:cuotaprestamo.py

示例4: default_fiscalyear

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import find [as 别名]
 def default_fiscalyear():
     FiscalYear = Pool().get('account.fiscalyear')
     return FiscalYear.find(
         Transaction().context.get('company'), exception=False)
开发者ID:iehoshia,项目名称:training_iesa,代码行数:6,代码来源:account.py


注:本文中的trytond.pool.Pool.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。