Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2883 มุมมอง

Hello. I've inherited the product's view from the product.template model in a new tree view, but I've only added 5 fields to my new view. I would like to add the dollar symbol before the price in one of the fields. I've tried wth this code and is not working.

class ProductInventario(models.Model):
_inherit = 'product.template'

total_cost = fields.Float(string="Costo Total", compute="_total_cost", required=False)
company_id = fields.Many2one('res.company', 'Company', default=lambda self: self.env.user.company_id.id, index = 1)
currency_id = fields.Many2one('res.currency', 'Currency',
default=lambda self: self.env.user.company_id.currency_id.id, required=True)


This is my xml code:

id="product_custom_tree_view" model="ir.ui.view">
name="name">product.template.product.tree
name="model">product.template
name="arch" type="xml">
string="Product">
name="qty_available" string="Inventario Total"/>
name="standard_price" widget="monetary" options="{'currency_field': 'currency_id'}" string="Costo por unidad"/>
name="total_cost" widget="monetary" options="{'currency_field': 'currency_id'}"/>



อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Hi. Thanks, Ayoub. That was what I needed:) Now it's working.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Try to add currency_id field in your tree view and make it invisible

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Duplicate Products Tree View แก้ไขแล้ว
1
พ.ย. 22
2435
3
ส.ค. 24
1934
0
ส.ค. 21
2113
2
มี.ค. 15
8365
0
ส.ค. 22
3063