【问题标题】:How related amount with currency金额与货币的关系
【发布时间】:2017-10-23 11:03:07
【问题描述】:

我想将金额与货币相关联以创建分析条目。

@api.multi
def action_test(self):
    for order in self:
        for line in order.order_line:
            amount = (self.credit or 0.0) - (self.debit or 0.0)
            if line.account_analytic_id:
                vals_line= {
                    'name': line.name,
                    'date': order.date_order,
                    'account_id': line.account_analytic_id.id,
                    'tag_ids': [(6, 0, line.analytic_tag_ids.ids)],
                    'unit_amount': line.product_qty,
                    'product_id': line.product_id and line.product_id.id or False,
                    'amount': order.company_currency_id.with_context(date=order.date_order or fields.Date.context_today(self)).compute(amount, line.account_analytic_id.currency_id) if line.account_analytic_id.currency_id else amount,
                    #'general_account_id': self.account_id.id,
                    #'ref': order.ref,
                    'move_id': line.id,
                    #'user_id': order.invoice_id.user_id.id or self._uid,
                }
                self.env['account.analytic.line'].create(vals_line)

【问题讨论】:

    标签: openerp odoo-8 odoo-9 odoo-10 odoo-view


    【解决方案1】:

    如果您想要返回金额,请添加一个类似于金额字段的空白字段(浮点数或整数)并尝试:

    vals_line = {
    'amount' : line.amount
    }
    

    【讨论】:

      【解决方案2】:

      你可以试试:

       vals_line= {
           'currency_id': line.currency_id
            }
      

      【讨论】:

      • 您好,如何比较两行采购行和发票行
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-08-21
      • 2020-11-26
      • 1970-01-01
      • 2020-12-20
      • 2021-11-22
      • 1970-01-01
      相关资源
      最近更新 更多