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

I want to modify the Quotation Template to include price_unit 

Ảnh đại diện
Huỷ bỏ
Tác giả

from odoo import api, fields, models, _

class QuotationTemplateCustom(models.Model):
_inherit = "sale.order.template.line"

unit_price = fields.Float(string="Unit Price")

class UnitPriceChange(models.Model):
_inherit = "sale.order.line"
quotation_template_custom_id = fields.Many2one("sale.order.template.line", string="Quotation Template Custom")
price_unit = fields.Float(string="Unit Price")

@api.onchange('quotation_template_custom_id')
def onchange_quotation_template_custom_id(self):
self.price_unit = self.quotation_template_custom_id.unit_price

Tác giả

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sale_order_template_view_form_inherit_custom" model="ir.ui.view">
<field name="name">sale.order.template.form.inherit.custom</field>
<field name="model">sale.order.template</field>
<field name="inherit_id" ref="sale_management.sale_order_template_view_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook/page/field[@name='sale_order_template_line_ids']/tree/field[@name='name']" position="after">
<field name="unit_price"/>
</xpath>
</field>
</record>
</odoo>

Tác giả

Thanks Niyas but I won't to use a custom addon to resolve this. Just shared my code

Câu trả lời hay nhất

hi,

i made free module to solve the issue 

https://apps.odoo.com/apps/modules/15.0/sale_qotation_pricelist/

Ảnh đại diện
Huỷ bỏ

that module is unavailable now at that link.

Câu trả lời hay nhất

Hi,

if you are using enterprise edition and access to studio, you can do it from the studio.

Else you have to create a module, that inherit and change the template. For changing an existing report in odoo, see this: https://www.youtube.com/watch?v=l2tvrpfOR1E

Thanks

Ảnh đại diện
Huỷ bỏ