I have added some fields in product.template. I need to display the field in sale_order_line in sales module. How can I make it possible?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Hi,
You can write a onchange function for the product field in the order line. In the onchange function write the value to new field or you can make the new field as related field.
@api.onchange('product_id')
def function_name(self):
if self.product_id:
self.new_field_name = self.product_id.field_in_product
Thanks
thank you Niyas :)
Hi Sarina,
You can change price_unit field to a functional field.
@api.one
@api.depends('mrp', 'discount')
def _compute_price_unit(self)
self.price_unit = self.mrp - self.discount
price_unit = fields.Float('Unit Price', compute='_compute_price_unit', store=True)
If you don't want to store the value in database, then you can use this:
@api.one
def _compute_price_unit(self)
self.price_unit = self.mrp - self.discount
price_unit = fields.Float('Unit Price', compute='_compute_price_unit')
Can I calculate price_unit in sale_order line if I put a new field in sale order line like
price_unit=mrp-discount
Please see the the above answer for price_unit calculation by functional field
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
lip 25
|
4964 | ||
|
2
gru 24
|
7982 | ||
How to ORDER BY? [Odoo 10]
Rozwiązane
|
|
2
lis 24
|
28788 | |
|
2
maj 24
|
7660 | ||
|
3
mar 24
|
7110 |