Hello, I am looking at the code of the invoice form view but haven't been able to find it. I want to learn how does Odoo disables de edit of a validated invoice, if I click the edit button on a validated invoice I can modify only a few fields like the incoterm and the sales team. thanks ✌️
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
The answer is in the python code, in the fields definition there is the states parameter that the account.invoice uses on its fields to disable modifying validated invoices, actually it only allows to modify those fields while in draft state.
states={'draft': [('readonly', False)]}
Example field definition from account.invoice:
date_invoice = fields.Date(string='Invoice Date', readonly=True, states={'draft': [('readonly', False)]}, index=True, help="Keep empty to use the current date", copy=False)
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Feb 23
|
3684 | ||
|
2
Apr 22
|
3381 | ||
|
3
Mar 19
|
2795 | ||
|
0
Apr 23
|
882 | ||
|
0
Jan 23
|
805 |