This question has been flagged
2 Replies
9031 Views

Hi everyone

I try to create Sale Oder in module Sale directly when I click "Save" button in create Quotation form, it means I skip creating Quotation step when I click it. My system doesn't need "comfirm sale" button, because it creates a sale order directly, and I can hide this button.

I try changing "state" value in default from "draft" to "manual" in sale.py, but it doesn't work. So, How do I do it?

Help me, please

Thank you.

Avatar
Discard
Best Answer

You will have to modify sale_order function for create to call the workflow:

wf_service.trg_validate(uid, 'sale.order', ids[0], 'order_confirm', cr)

That way creating a new quotation will automatically go through workflow and create a sale order.

Avatar
Discard
Author Best Answer

Hi Mariusz Mizgier
I know your code, It same in function "action button confirm" and it set confirm for the quotation. But "sale_order" is a class, I cant found a function with name "sale_order" or I dont know which function create a quotation to add your code here.

And I will create a module to inherit "sale" module, so, How do I modify that function to create sale order directly

Please explain more for me, please!!!

Thank you so much!

Avatar
Discard

I've created a small module for you - check it out at https://drive.google.com/file/d/0B_0MqUxRHKNjVUdGdkRjdEFJbVk/edit?usp=sharing This overrides default create method then auto-confirms quotation to make it sale order. You can make some tweaks to hide buttons in form view.

Hi Mariusz Mizgier

received you module and it worked. Thank you so much, you are very kind.
Thank you again! 

2014-08-01 17:16 GMT+07:00 Mariusz Mizgier <mariusz.mizgier@currenda.pl>:

I've created a small module for you - check it out at https://drive.google.com/file/d/0B_0MqUxRHKNjVUdGdkRjdEFJbVk/edit?usp=sharing This overrides default create method then auto-confirms quotation to make it sale order. You can make some tweaks to hide buttons in form view.

--
Mariusz Mizgier Sent by OpenERP S.A. using Odoo. Access your messages and documents in Odoo



--
Trần Như Văn
MSSV: 51104177
K11 Bách Khoa Tp.HCM
Khoa: Khoa học và Kĩ thuật máy tính

That's great to hear, if you can be so kind and mark the question as solved that would be great ;)

Hi Mariusz Mizgier

I have a little problem. That is modifying a function, which return default value of a column. I'm very glad if you help me, please!
I wrote "super(<my_class>, self).<my_function>(cr, uid, context)" in the function content, but it didn't override the function I want. So, when I run openERP, in module "Warehouse" and create a "Incoming Products", the Location have been changed value default as i override, but after that, it return old default value

Thank you so much.

--
Trần Như Văn
MSSV: 51104177
K11 Bách Khoa Tp.HCM
Khoa: Khoa học và Kĩ thuật máy tính