First you can see the file sale.py # Line 652. When u send a e-mail, it call the wizard mail.compose.message
with a context 'mark_so_as_sent': True
.
The next, you can look for mail.compose.message
in the samme file, you will see it sale.py # Line 1277. So it call the workflow quotation_sent
if you send e-mail.
On the file sale_workflow.xml, you will see some thing like that:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="act_sent" model="workflow.activity">
<field name="wkf_id" ref="wkf_sale"/>
<field name="name">sent</field>
<field name="kind">function</field>
<field name="action">write({'state':'sent'})</field>
</record>
<record id="trans_draft_sent" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_sent"/>
<field name="signal">quotation_sent</field>
</record>
</data>
</openerp>
Now you see, you only need to add new state into the state field and edit the workflow:
Python
state = fields.Selection(selection_add=[('not_approval', 'Quotation (Approval Required)')])
XML
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="act_not_approval" model="workflow.activity">
<field name="wkf_id" ref="wkf_approval"/>
<field name="name">not_approval</field>
<field name="kind">function</field>
<field name="action">write({'state':'not_approval'})</field>
</record>
<record id="trans_draft_sent" model="workflow.transition">
<field name="act_from" ref="act_draft"/>
<field name="act_to" ref="act_not_approval"/>
<field name="signal">quotation_sent</field>
</record>
</data>
</openerp>