Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
4 Ответы
12216 Представления

How can I create a section i sale order line using code(programatically) in odoo. Please provide your valuable answers

Аватар
Отменить
Лучший ответ

A section is actually a dummy sale order line with a display type section. 
so you need to create new sale order line with `display_type` line_section and  adjust the position with sequence value

ref: https://github.com/odoo/odoo/blob/12.0/addons/sale/models/sale.py#L1219

Аватар
Отменить
Автор

How could I can create it in onchange?

How can the duumy sale order line be show in the list view after entered? Right now it is only seen in reports or the preview online function?

Лучший ответ

Hi,

You can create section programatically by using the following code                

class SaleOrder(models.Model):
_inherit = 'sale.order'

def custom_function(self):
order_lines = []
val = (0, 0, {
'display_type': 'line_section',
'name': 'SECTION NAME',
})
order_lines.append(val)
self.update({'order_line': order_lines})
Аватар
Отменить

How can the duumy sale order line be show in the list view after entered? Right now it is only seen in reports or the preview online function?

Related Posts Ответы Просмотры Активность
1
янв. 25
3289
2
авг. 24
5792
6
дек. 22
8710
1
февр. 22
2835
0
сент. 20
3567