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

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

아바타
취소
관련 게시물 답글 화면 활동
1
11월 22
2505
3
8월 24
2090
0
8월 21
2208
2
3월 15
8474
0
8월 22
3163