跳至内容
菜单
此问题已终结
2 回复
1679 查看

how can i calcualte  amount_taxed and amount_taxed  in and  stock_picking

形象
丢弃
最佳答案

Hi,

Try this code

from odoo import models, fields, api


class StockPicking(models.Model):

    _inherit = 'stock.picking'


    amount_taxed = fields.Monetary(string="Amount Taxed", compute='_compute_amount_taxed', store=True)


    @api.depends('move_ids.product_id', 'move_ids.move_line_ids.move_line_tax_ids')

    def _compute_amount_taxed(self):

        for picking in self:

            taxed_amount = 0.0

            for move in picking.move_ids:

                for move_line in move.move_line_ids:

                    # Sum up the taxes for each move line

                    for tax in move_line.move_line_tax_ids:

                        taxed_amount += tax.amount


            picking.amount_taxed = taxed_amount


Hope it helps


形象
丢弃
编写者 最佳答案

i get 

ValueError: Field stock.picking.amount_untaxed cannot find dependency 'move_ids' on model 'stock.picking'.

形象
丢弃
相关帖文 回复 查看 活动
1
8月 24
2435
1
4月 24
2278
2
9月 24
1618
2
7月 24
2247
0
5月 24
995