Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
4731 Lượt xem

Hi everyone !

I want to create an action server which will transform all Quotations records to Sales order instead of Confirm each quotations to sales order.

Can ayone help me ? Thanks 

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks a lot ! it's worked. But i have another problem.
I want to make domain on this field to show only the records related to him.


Gimage0

Gestion congés is many2one field. so i want to show in this field records concerned only the employe

Thanks in advance !

i use odoo online, and odoo studio

Câu trả lời hay nhất

Hi,

<record id="action_confirm_order" model="ir.actions.server">
 
    <field name="name">Confirm Orders</field>
      <field name="model_id" ref="sale.model_sale_order"/>
      <field name="state">code</field>
      <field name="binding_view_types">list</field>
      <field name="code">
for record in records:
  record.action_confirm()
      </field>


</record>

or you can create server action by going to Settings--> Technical--> Server Actions


Hope it will help you :)

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Thank you this also helped me a lot.

Now I can import my sales and bulk confirm quotations to sales orders and then bulk complete delivery orders etc. Thanks!

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Yes, I can assist you with that. Do the following steps you may take to construct an action server that will convert all Quotation data into Sales orders:

  1. Specify the action: Begin by identifying the action you wish to do. You wish to convert all Quotation records into Sales orders in this situation. Give your action a name and a description to make it easier to recognize afterwards.
  2. Define the trigger: The trigger that will activate the action server must be defined next. In this scenario, you want the action to be triggered whenever a Quotation record is created or changed. This trigger may be defined using an onchange or oncreate function.
  3. Create the following code: It is now time to develop the code to convert the Quotation data into Sales orders. As a starting point, here's some sample code:
    @api.model
    def create(self, vals):
    res = super(SaleOrder, self).create(vals)
    if res.state == 'draft' and res.is_quotation:
    res.action_confirm()
    return res
  4. Test the code: Before deploying your action server, you should test the code to ensure it works as planned. Create a new Quotation record and update it to test if it is immediately converted into a Sales Order.
  5. Deploy the action server: Finally, you may put your action server into production. Check it again to ensure that everything is operating properly.

That's all! Following these steps, you should be able to establish an action server that will change all Quotation records into Sales orders automatically. Please let me know if you have any queries or require any other support.

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for your assistance but @Sahar Dagher replied to me before.
Can i have your whatsApp number for anothers problem ? am a newer in Odoo
+225 05 45 14 53 91.
Thanks a lot !

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 23
1677
1
thg 11 20
2683
2
thg 6 19
4690
4
thg 3 15
6740
4
thg 6 25
1825