Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

i'm trying to add state named sourcing to sale order quotation .. everything is good i added a button to change draft to my state named sourcing .. the problem is when i change state to sourcing my quotation become order ..

how to stay in quotation 

here is my code 

python :

class devis_stage(models.Model):
_inherit = 'sale.order'

state = fields.Selection(selection_add=[('sourcing', 'Sourcing')])


@api.one
def sourcing(self):
self.state = 'sourcing'

view.xml:

<openerp>
<data>

<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>
</data>
</openerp>

sale_workflow.xml:

   <?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="act_quotation_sourcing" model="workflow.activity">
<field name="wkf_id" ref="sale.wkf_sale"/>
<field name="name">Sourcing</field>
<field name="kind">function</field>
<field name="action">write({'state':'sourcing'})</field>
</record>
<record id="trans_quotation_draft_to_sourcing" model="workflow.transition">
<field name="act_from" ref="sale.act_draft"/>
<field name="act_to" ref="act_quotation_sourcing"/>
<field name="signal">sourcing</field>
</record>
</data>
</openerp>
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jan. 23
3899
1
jan. 20
4791
1
jul. 23
2450
3
jul. 18
3773
3
jul. 24
2998