[IMP] sale: Only create analytic line on Sales Order
[IMP] sale: Only create analytic line on Sales Order

Before creating a account analytic line related to a sale order, check that the sale order is in 'sale' state, i.e. not a quotation, not in done or canceled state.

The issue is that when validating an expense (for example, but it's the same for a timesheet), the analytic account line is created even if related to a canceled sale order which is obviously wrong. This was leading to confusions about what's displayed, what is existing and not displayed and whatever.

This was the behavior before this commit 48ea59d46e26b7b5a8eebfe06740482f1a263d72

hip-odoo/odoo,ygol/odoo,hip-odoo/odoo,hip-odoo/odoo,dfang/odoo,ygol/odoo,dfang/odoo,ygol/odoo,hip-odoo/odoo,dfang/odoo,ygol/odoo,dfang/odoo,ygol/odoo,hip-odoo/odoo,dfang/odoo,dfang/odoo,ygol/odoo,ygol/odoo,hip-odoo/odoo