本文整理汇总了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
示例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
示例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'
示例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)