Python 从stock.picking模型获取产品税
我想计算Python 从stock.picking模型获取产品税,python,openerp,odoo-8,Python,Openerp,Odoo 8,我想计算库存.拣选模型的总含税。这是我的密码: @api.multi @api.depends('move_lines', 'move_lines.product_qty', 'move_lines.product_uos_qty') def _amount_all(self): print '_amount_all dans StockPicking' for picking in self: picking.amount_untaxe
库存.拣选模型的总含税。这是我的密码:
@api.multi
@api.depends('move_lines', 'move_lines.product_qty',
'move_lines.product_uos_qty')
def _amount_all(self):
print '_amount_all dans StockPicking'
for picking in self:
picking.amount_untaxed = 0.0
picking.amount_total = 0.0
val2 = val1 = val = 0.0
for line in picking.move_lines:
print line.product_id.id
# using to get product taxes
taxes=self.env['account.tax'].compute_all(line.price_unit,line.product_uom_qty,line.product_id.id)
print taxes
val1 += taxes['total']
val += taxes['total_included']
for tax in taxes['taxes']:
val2 += tax.get('amount', 0.0)
picking.amount_untaxed = val1
picking.amount_tax = val2
picking.amount_total = val
但行taxes=self.env['account.tax'].compute\u all(行.价格单位,行.产品数量,行.产品id.id)
始终返回空税
注:从报价表中我可以得到税额