Ive created some delivery methods which I want to assign to my sale order records. Manually this can be done by clicking on "Add Shipping" button from sale order create view. but How can I do this using ORM? I know I can create a sale record object using record = self.env['sale.order'].create({}). How can I assign a delivery method to it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 회계
- 재고 관리
- PoS
- Project
- MRP
신고된 질문입니다
if you have just one shipping method you can create Shipping method in data.xml folder with( noupdate="1") option and then you can use it in your create function like this
data.xml file :
<record id="record_in_xml_id" model="delivery.carrier">
<field name="name"></field>
<field name="type"></field>
all necessary fields
</record>
in python file
shipping_id = self.env.ref('module_name.record_in_xml_id')
sale_order_obj.create({
all necessary fields
'shipping_id' : shipping_id.id
})
I don't want to create a shipping method manually. Odoo already has a shipping method and it can be added to the sale order using the 'Add Shipping' button. I want to do this process using odoo ORM and assign a shipping method to an existing sale order object. any ideas?
Hello,
Maybe my answer to another question would help?
Wait, you are the same person... Never mind.
Thanks,
관련 게시물 | 답글 | 화면 | 활동 | |
---|---|---|---|---|
|
1
4월 24
|
6497 | ||
|
1
8월 21
|
2437 | ||
|
0
11월 20
|
2371 | ||
|
0
10월 20
|
2776 | ||
|
1
12월 22
|
3442 |