Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1674 Lượt xem

how can i calcualte  amount_taxed and amount_taxed  in and  stock_picking

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

i get 

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 24
2435
1
thg 4 24
2278
2
thg 9 24
1618
2
thg 7 24
2247
0
thg 5 24
995