Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
856 Vizualizări

Good evening everyone.

simple question, if I select a product / print label / type Dymo / select price list 22% = the pdf has the price without taxes.

How can I see the price with public taxes?

Thanks for your help

------------

buonasera a tutti.

domanda semplice, se seleziono un prodotto / stampa etichetta / tipo dymo / seleziono listino 22% = il pdf ha il prezzo senza tasse.

Come posso fare per vedere il prezzo con le tasse al pubblico? 

grazie per l'aiuto

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Hi, sorry but I was out for work, thanks for your reply.

I don't understand where to start, I have Odoo 17 online and I don't see how to get in

" from odoo import models, fields, api "

Thanks again

Robert





Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

you can try this code:

from odoo import models, fields, api

class ProductProduct(models.Model):
    _inherit = 'product.product'

    @api.depends('list_price', 'taxes_id')
def _compute_price_with_taxes(self):
        for product in self:
taxes = product.taxes_id.compute_all(product.list_price, product.currency_id, 1)
            product.price_with_taxes = taxes['total_included']

price_with_taxes = fields.Float(string="Price With Taxes", compute='_compute_price_with_taxes', store=True)

XML :


<!-- views/product_views.xml -->

<odoo>

    <data>

<record id="product_template_form_inherit" model="ir.ui.view">

<field name="name">product.product_template_form_inherit</field>

<field name="model">product.template</field>

<field name="inherit_id" ref="product.product_template_form_view"/>

            <field name="arch" type="xml">

                <field name="list_price" position="after">

                    <field name="price_with_taxes"/>

                </field>

            </field>

        </record>

    </data>

</odoo>


<template id="product_report_template">

<t t-call="report.html_container">

        <t t-foreach="docs" t-as="o">

            <div class="page">

<h2><t t-esc="o.name"/></h2>

                <p>Base Price: <t t-esc="o.base_price"/></p>

                <p>Tax Rate: <t t-esc="o.tax_rate"/></p>

<p>Price With Taxes: <t t-esc="o.price_with_taxes"/></p>

            </div>

        </t>

    </t>

</template>


Hope it helps

Imagine profil
Abandonează