Skip to Content
Menu
This question has been flagged
2549 Views

Hi, 


I'm new Odoo and I use Odoo 8.

I want to add a new state for my quotations between drafts and sends quotations.

But I just can't :(. 



My problems are i don't see my new state in status tab and in statusbar new state appear at last of selection.


My proceed: 

     - models.py:

         # -*- coding: utf-8 -*-


from openerp import models, fields, api

class SaleStates(models.Model):

_inherit = 'sale.order'

state = fields.Selection(selection_add=[('new_state', "New State Quotation")])

@api.multi
def new_state(self):
self.state = 'new_state'

# SaleStates()

     - sale_order_workflow.xml:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="act_quotation_approved" model="workflow.activity">
<field name="wkf_id" ref="sale.wkf_sale"/>
<field name="name">New State</field>
<field name="kind">function</field>
<field name="action">action_new_state()</field>
</record>
<record id="trans_quotation_draft_to_new_state" model="workflow.transition">
<field name="act_from" ref="sale.act_draft"/>
<field name="act_to" ref="act_quotation_approved"/>
<field name="signal">new_state</field>
</record>
</data>
</openerp>

    - template.xml


<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="my_quotation_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="action_quotation_send" position="after">
<button name="new_state" string="new state" states="draft" type="workflow"
class="oe_highlight" groups="base.group_user"/>
</button>
<button name="action_quotation_send" position="attributes" groups="base.group_user">
<attribute name="states">draft,new_state,sent,progress,manual</attribute>
</button>
<button name="print_quotation" position="attributes" groups="base.group_user">
<attribute name="states">draft,new_state,sent,progress,manual</attribute>
</button>


<!--Je ne sais pas c 'est quoi du coup je begueillej un peu tu connais les bails-->

<field name="state" position="attributes" groups="base.group_user">
<attribute name="statusbar_visible">draft,new_state,sent,progress,done</attribute>
</field>

</field>
</record>

<record id="action_new_state_quotation" model="ir.actions.act_window">
<field name="name">Quotation Approved</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_id" ref="sale.view_quotation_tree"/>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="context">{'search_default_my_sale_orders_filter': 0}</field>
<field name="domain">[('state','in',('draft', 'new_state'))]</field>
<field name="search_view_id" ref="sale.view_sales_order_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a quotation, the first step of a new sale.
</p>
<p>
Odoo will help you handle efficiently the complete sale flow:
from the quotation to the sales order, the
delivery, the invoicing and the payment collection.
</p>
<p>
The social feature helps you organize discussions on each sales
order, and allow your customers to keep track of the evolution
of the sales order.
</p>
</field>
</record>

<menuitem action="action_new_state_quotation"
name="New State quotation"
id="menu_new_state_quotation"
parent="base.menu_sales"
sequence="4"/>
</data>
</openerp>
Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
189
2
Mar 24
706
2
Mar 24
1334
0
Sep 23
354
1
Sep 23
461