Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1536 Vistas

how can i calcualte  amount_taxed and amount_taxed  in and  stock_picking

Avatar
Descartar
Mejor respuesta

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


Avatar
Descartar
Autor Mejor respuesta

i get 

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

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 24
2230
1
abr 24
2072
2
sept 24
1436
2
jul 24
2004
0
may 24
858