콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
1821 화면

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
2605
1
4월 24
2406
2
9월 24
1769
2
7월 24
2456
0
5월 24
1123