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


Python Pool.post方法代码示例

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


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

示例1: create_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [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

示例2: transition_pay_

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def transition_pay_(self):
        result = super(WizardSalePayment, self).transition_pay_()        
        Sale = Pool().get('sale.sale')
        sale = Sale(Transaction().context['active_id'])
        
        Invoice = Pool().get('account.invoice')
        
        AFIP_Transaction = Pool().get('account_invoice_ar.afip_transaction')
  
        if sale.invoices:
           for invoice in sale.invoices:
	     if invoice.state == 'draft':
               invoice.description = sale.reference
               invoice.reference = sale.reference
               invoice_id = invoice.id
               Invoice.post([invoice])
                             
               
               #afip_transaction = AFIP_Transactions.search(['invoice','=',invoice_id])
               #with Transaction().new_cursor():
		 #for transaction in afip_transaction:
		   #transaction.sale = sale.id
		 #Transaction().cursor.commit()	
              
       
        for payment in sale.payments:
                    invoice = sale.invoices[0]
                    payment.invoice = invoice.id
                    if payment.party != invoice.party:
                        payment.party = invoice.party
                    payment.save()
        
        Sale.workflow_to_end([sale])
	return result
开发者ID:fransuar,项目名称:fran_tryton_sale_pos_ar,代码行数:36,代码来源:sale.py

示例3: transition_create_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def transition_create_move(self):
        Move = Pool().get('account.move')

        if self.show_move.counterpart == self.show_move.stock_account:
            self.raise_user_error('same_account')
        move = self.get_move()
        move.save()
        Move.post([move])
        return 'update_price'
开发者ID:kret0s,项目名称:tryton3_8,代码行数:11,代码来源:product.py

示例4: paid

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def paid(cls, recibos):
        Move = Pool().get('account.move')

        moves = []
        for recibo in recibos:
            moves.append(recibo.create_paid_move())

        cls.write(recibos, {
                'state': 'paid',
                })
        Move.post(moves)
开发者ID:gcoop-libre,项目名称:cooperative_ar,代码行数:13,代码来源:recibo.py

示例5: confirmed

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def confirmed(cls, recibos):
        Move = Pool().get('account.move')

        moves = []
        for recibo in recibos:
            recibo.set_number()
            moves.append(recibo.create_confirmed_move())

        cls.write(recibos, {
                'state': 'confirmed',
                })
        Move.post(moves)
开发者ID:gcoop-libre,项目名称:cooperative_ar,代码行数:14,代码来源:recibo.py

示例6: post

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
 def post(cls, invoices):
     Move = Pool().get('account.move')
     moves = []
     for invoice in invoices:
         if invoice.type == u'out_invoice' or invoice.type == u'out_credit_note':
             if not invoice.invoice_type:
                 invoice.raise_user_error('not_invoice_type')
         invoice.set_number()
         moves.append(invoice.create_move())
     cls.write(invoices, {'state': 'posted',})
     Move.post(moves)
     for invoice in invoices:
         if invoice.type in ('out_invoice', 'out_credit_note'):
             invoice.print_invoice()
开发者ID:geneos-tryton-cooperar,项目名称:cooperar-secuencia-factura,代码行数:16,代码来源:invoice.py

示例7: confirmed

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def confirmed(cls, recibos):
        Move = Pool().get('account.move')

        moves = []
        for recibo in recibos:
            recibo.journal = Pool().get('account.journal').search([('code','=','EXP')])[0]    
            recibo.save()   
            recibo.set_number()
            moves.append(recibo.create_confirmed_move())

        cls.write(recibos, {
                'state': 'confirmed',
                })
        Move.post(moves)
开发者ID:geneos-tryton-cooperar,项目名称:cooperative_ar,代码行数:16,代码来源:recibo.py

示例8: transition_debit

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def transition_debit(self):
        IssuedCheck = Pool().get('account.issued.check')
        Move = Pool().get('account.move')
        MoveLine = Pool().get('account.move.line')
        period_id = Pool().get('account.period').find(1,
            date=self.start.date)

        for check in IssuedCheck.browse(Transaction().context.get(
            'active_ids')):
            if check.state != 'issued':
                self.raise_user_error('check_not_issued',
                    error_args=(check.name,))
            if not self.start.bank_account.journal.issued_check_account:
                self.raise_user_error('no_journal_check_account',
                    error_args=(self.start.bank_account.journal.name,))
            move, = Move.create([{
                'journal': self.start.bank_account.journal.id,
                'period': period_id,
                'date': self.start.date,
                }])

            lines = []
            lines.append({
                'debit': check.amount,
                'credit': Decimal('0.00'),
                'account':
                    self.start.bank_account.journal.issued_check_account.id,
                'move': move.id,
                'journal': self.start.bank_account.journal.id,
                'period': period_id,
                'party': check.receiving_party.id,
                })

            lines.append({
                'account': self.start.bank_account.journal.debit_account.id,
                'debit': Decimal('0.00'),
                'credit': check.amount,
                'move': move.id,
                'journal': self.start.bank_account.journal.id,
                'period': period_id,
                'date': self.start.date,
                'party': check.receiving_party.id
                })
            MoveLine.create(lines)

            IssuedCheck.write([check], {'state': 'debited'})
            Move.post([move])

        return 'end'
开发者ID:HEGOArgentina,项目名称:11-modulos-ar,代码行数:51,代码来源:account_check_ar.py

示例9: close

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def close(cls, assets, account=None):
        """
        Close the assets.
        If account is provided, it will be used instead of the expense account.
        """
        Move = Pool().get('account.move')

        cls.clear_lines(assets)
        moves = []
        for asset in assets:
            move = asset.get_closing_move(account)
            move.save()
            moves.append(move)
            cls.write([asset], {
                    'move': move.id,
                    })
        Move.post(moves)
开发者ID:kret0s,项目名称:tryton3_8,代码行数:19,代码来源:asset.py

示例10: post

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def post(cls, invoices):
        Move = Pool().get('account.move')

        cls.set_number(invoices)
        moves = []
        for invoice in invoices:
            move = invoice.get_move()
            if move != invoice.move:
                invoice.move = move
                moves.append(move)
            if invoice.state != 'posted':
                invoice.state = 'posted'
                #invoice.state = invoice.update_invoice_status()
        if moves:
            Move.save(moves)
        cls.save(invoices)
        Move.post([i.move for i in invoices if i.move.state != 'posted'])
开发者ID:iehoshia,项目名称:training_iesa,代码行数:19,代码来源:account.py

示例11: create_invoice

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def create_invoice(self, invoice_type):
        """
        Sale creates draft invoices. But if the invoices are created from
        shipments, then they should be automatically opened
        """
        Invoice = Pool().get('account.invoice')

        invoice = super(Sale, self).create_invoice(invoice_type)

        if not invoice:
            return invoice

        if self.invoice_method == 'shipment' and invoice_type == 'out_invoice':
            # Invoices created from shipment can be automatically opened
            # for payment.
            Invoice.post([invoice])

        return invoice
开发者ID:rajatguptarg,项目名称:trytond-pos,代码行数:20,代码来源:sale.py

示例12: post

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def post(cls, invoices):
        Move = Pool().get('account.move')

        moves = []
        for invoice in invoices:
            if invoice.type == u'out_invoice' or invoice.type == u'out_credit_note':
                invoice.check_invoice_type()
                if invoice.pos:
                    if invoice.pos.pos_type == 'electronic':
                        invoice.do_pyafipws_request_cae()
                        if not invoice.pyafipws_cae:
                            invoice.raise_user_error('not_cae')
            invoice.set_number()
            moves.append(invoice.create_move())
        cls.write(invoices, {
                'state': 'posted',
                })
        Move.post(moves)
开发者ID:pablopadulles,项目名称:account_invoice_ar,代码行数:20,代码来源:invoice.py

示例13: transition_held

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def transition_held(self):
        ThirdCheck = Pool().get('account.third.check')
        Move = Pool().get('account.move')
        MoveLine = Pool().get('account.move.line')
        Date = Pool().get('ir.date')

        date = Date.today()
        period_id = Pool().get('account.period').find(1, date)
        for check in ThirdCheck.browse(
            Transaction().context.get('active_ids')):
            if check.state != 'draft':
                self.raise_user_error('check_not_draft',
                    error_args=(check.name,))
            else:
                move, = Move.create([{
                    'journal': self.start.journal.id,
                    'period': period_id,
                    'date': date,
                }])
                lines = []
                lines.append({
                    'account': self.start.journal.third_check_account.id,
                    'move': move.id,
                    'journal': self.start.journal.id,
                    'period': period_id,
                    'debit': check.amount,
                    'credit': Decimal('0.0'),
                    'date': date,
                    'maturity_date': check.date,
                })
                lines.append({
                    'account': self.start.journal.credit_account.id,
                    'move': move.id,
                    'journal': self.start.journal.id,
                    'period': period_id,
                    'debit': Decimal('0.0'),
                    'credit': check.amount,
                    'date': date,
                })
                MoveLine.create(lines)
                ThirdCheck.write([check], {'state': 'held'})
                Move.post([move])
        return 'end'
开发者ID:silix,项目名称:account_check_ar,代码行数:45,代码来源:account_check_ar.py

示例14: do_pay

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def do_pay(self, action):
        Line = Pool().get('account.move.line')
        Move = Pool().get('account.move')

        sort_key = lambda line: (line.party, line.account)

        # Sorted by party after removing lines without party
        move_lines = sorted(
            filter(
                lambda line: line.party,
                Line.browse(Transaction().context['active_ids'])
            ),
            key=sort_key
        )

        moves = []
        for party_account, lines in groupby(move_lines, key=sort_key):
            lines = list(lines)
            move = self.get_move(lines, *party_account)
            move.save()
            moves.append(move)

            # Reconcile the lines
            Line.reconcile(
                lines + [line for line in move.lines if line.party]
            )

        move_ids = map(int, moves)

        self.start.moves = moves
        # Post all the moves
        Move.post(moves)
        # Assign Check Number to all moves
        Move.assign_check_number(moves)

        data = {
            'moves': move_ids,
            'journal': self.start.journal.id,
        }
        return action, data
开发者ID:openlabs,项目名称:trytond-check,代码行数:42,代码来源:check.py

示例15: _create_account_stock_move

# 需要导入模块: from trytond.pool import Pool [as 别名]
# 或者: from trytond.pool.Pool import post [as 别名]
    def _create_account_stock_move(self):
        '''
        Create account move for stock move
        '''
        AccountMove = Pool().get('account.move')
        if self.product.type != 'goods':
            return
        type_ = self._get_account_stock_move_type()
        if not type_:
            return
        assert not self.account_move, 'account move field not empty'
        if type_ == 'supplier_customer':
            account_move_lines = self._get_account_stock_move_lines(
                'in_supplier')
            account_move_lines.extend(self._get_account_stock_move_lines(
                    'out_customer'))
        elif type_ == 'customer_supplier':
            account_move_lines = self._get_account_stock_move_lines(
                'in_customer')
            account_move_lines.extend(self._get_account_stock_move_lines(
                    'out_supplier'))
        else:
            account_move_lines = self._get_account_stock_move_lines(type_)

        amount = Decimal('0.0')
        for line in account_move_lines:
            amount += line.debit - line.credit
        move_line = self._get_account_stock_move_line(amount)
        if move_line:
            account_move_lines.append(move_line)

        account_move = self._get_account_stock_move(account_move_lines)
        account_move.save()
        with Transaction().set_user(0, set_context=True):
            AccountMove.post([account_move])
        self.write([self], {
                'account_move': account_move.id,
                })
        return account_move
开发者ID:silpol,项目名称:tryton-bef,代码行数:41,代码来源:stock.py


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