Odoo Help


States In Sale Orders

David Todd
on 5/19/16, 1:55 PM 1,125 views

There's probably a better way of doing this...

We're trying to modify our Sale Order Tree to have either a single column or multiple columns that will show which state each part of the selling process we are in. To be specific, we're interested in seeing the actual state the invoices and delivery orders are in. 

I know that the sale_order_tree view has a field called invoice_status, but this is very misleading as it only says whether or not an invoice has been created, not the state the invoice is in. 

My solution so far is to have two fields inside sale.order model:

(The fields are of type char and are compute)

Name: x_delivery_state_calc
delivery = self.env['stock.picking'].search([('origin','=',self.name)]) self.x_delivery_state = delivery.state

Name: x_invoice_state_calc

invoice = self.env['account.invoice'].search([('origin','=',self.name)]) self.x_invoice_state = invoice.state

This actually gives errors, but it's basically the same as doing (I'm interested in why it does that, but not the main purpose of this question):

for record in self:

invoice = self.env['account.invoice'].search([('origin','=',record['name'])]

record['x_invoice_state'] = invoice.state

Note that the fields I'm writing to are the same, but without the _calc. These fields are readonly selection type with the selection options being the states from both account_invoice.state and stock_picking.state.

I've also tried writing directly to the _calc field, but I know compute fields aren't stored in the database.

No matter how I write the value, I am unable to get those fields to show the data I want (ignore the top one, I manually added that to the database)

The data is available in the shell however, so I'm confused about why it is not available for the GUI

Triggering x_invoice_state_calc does write the data to the field, but not to the database. Is there a way that I can force this? Or is the compute just not happening? 

Ideally we would like for these fields to update to reflect the current state every time that you enter the sale orders tree


Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 5/19/16, 8:17 PM

There is not a 1:1 relationship between Sales Orders and Delivery Orders and Invoices. You can have one Sales Order, 2 Delivery Orders and 3 Invoices. Perhaps take a step back with this knowledge and reassess. At earlier versions there was 'invoiced_rate' and 'shipped_rate' which would allow a progress bar to be shown. Order is 50% shipped and 100% paid for. Perhaps that would be better?

Thanks for getting back to me. Yes I was aware that there could be multiple invoices and delivery orders, but for our uses there is going to be one of each for every sale order created. After spending a couple days on this problem, we decided to simply add extra menu items in the Sales dashboard that lead to tree views of the invoices and delivery orders. I did check those fields that you suggested and they don't seem to exist in Odoo 9, or maybe I'm checking in the wrong spot

David Todd
on 5/20/16, 10:22 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/19/16, 1:55 PM
Seen: 1125 times
Last updated: 12/29/16, 3:04 PM