Skip to Content
Menu
This question has been flagged
1571 Views

i added a new state 'sourcing' and a button to change state to sourcing .. when i click the button state changes to sourcing in states bar but the problem is my quotation changes to sales order

how can i stop this

#state adding

<record id="sale_order_custom_state" model="ir.ui.view">
<field
name="name">sale.order.form.changed</field>
<field
name="model">sale.order</field>
<field
name="inherit_id" ref="sale.view_order_form"/>
<field
name="priority">1000</field>
<field
name="arch" type="xml">
<xpath
expr="(/form/header/button)[1]" position="before">
<button
name="sourcing" states="draft" string="Sourcing" type="object" class="oe_highlight" />
<button
name="action_quotation_send" string="Send by Email" type="object" states="sourcing" class="oe_highlight" groups="base.group_user"/>
<button
name="print_quotation" string="Print" type="object" states="sourcing" class="oe_highlight" groups="base.group_user"/>
<button
name="action_button_confirm" states="sourcing" string="Confirm Sale" type="object" groups="base.group_user"/>
<button
name="cancel" states="sourcing" string="Cancel Quotation" groups="base.group_user"/>
</xpath>
<xpath
expr="/form/header/field[@name='state']" position="replace">
<field
name="state" widget="statusbar" statusbar_visible="draft,sourcing,sent,progress,done" statusbar_colors='{"invoice_except":"red","waiting_date":"blue"}'/>
</xpath>
...

</field>

</record>



#button methode
@api.multi
def sourcing(self):
self.state = 'sourcing'
if self.opportunity:
ids = self.env['crm.case.stage'].search([("name", "=", "F.Z: Sourcing")])
self.opportunity.stage_id = ids[0].id

Avatar
Discard
Related Posts Replies Views Activity
1
Mar 16
24678
0
Mar 15
2443
2
Mar 15
7012
5
Apr 20
8609
1
Dec 24
28