Daily updates from Odoo
Navigate
Branch
Monday, August 26, 2019
25 changes
New functionality added to Odoo
This update adds stronger links between the Documents app and HR, payroll, recruitment, and fleet records, making it easier to store and find related files. It also fixes a Mexico electronic invoicing issue that could affect invoice creation or journal entry cancellation, and refreshes manufacturing demo data.
Enhancements to existing features
This update removes an unnecessary wrapper from the event questions website template. It does not change what users see, but keeps the underlying module simpler and easier to maintain.
Original PR description
Description of the issue/feature this PR addresses: Since this is template extension, the `<data>` element has no effect. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Invoice creation is made faster by avoiding repeated processing of the same field during internal calculations. This reduces unnecessary work and improves performance by about 5% without changing user-facing workflows.
Original PR description
The same field was added multiple time as a trigger. Speed up invoice creation by 5%. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This change improves invoice creation performance and fixes related company and partner ranking behavior. Businesses should see slightly faster accounting workflows and more reliable partner information when invoices are posted.
Original PR description
Speed up invoice creation by 5% allowing the same field being several times in a depends. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This change lets Odoo apply business rules automatically when records are created or updated, instead of relying mainly on screen-based onchange behavior. It should make imports, automated processes, and module extensions more consistent and easier to maintain across apps like Accounting, CRM, Sales, Inventory, Events, HR, and Calendar.
Original PR description
Support for compute, with readonly=False as an alternative to onchange & conditional defaults. ### Rationale Most onchange includes business logic (ex: changing a partner on an invoice sets the…
Support for compute, with readonly=False as an alternative to onchange & conditional defaults.
### Rationale
Most onchange includes business logic (ex: changing a partner on an invoice sets the
fiscal position, and the payment terms). But the business logic should not be exclusive to
the user interface. Thus, most of these onchanges should actually be compute fields with
store=True and readonly=False.
Compute fields are usually orthogonal between each others, thus simpler to implement and
inherits. Example: on an invoice, it's easy to implement _compute_fiscal_position (it's a
related partner_id.fiscal_position_id), but very complex to implement _onchange_partner_id
(it has impact on lots of different concepts depending on installed modules: fiscal positions,
payment terms, address, ...). By splitting this big onchange into smaller compute, it should
simplify the code and inheritability.
USE CASE 1:
If onchanges are replaced by compute fields, the code to create an invoice, or automated tests
it is simplified as you can let the business logic do its job:
self.env['account.invoice'].create({
'partner_id': 1
'line_ids': [{
'product_id': 1
})
)}
-> the compute fields will compute the right fiscal position, taxes, customer address, etc. It's
not the role of the sale order to implement this logic anymore.
This simplifies creation of records in the code, but also import. (you import only some data, and you can let the business logic do the rest: import customers of your invoice, and the system will setup the journal, currency, fiscal position, taxes, etx)
USE CASE 2:
Let's say the module l10n_mx want to add a TAXCODE field on an invoice,
there is two way to do it:
@api.onchange['partner_id')
def _change_partner_id(self):
super()
self.taxcode = self.partner_id.taxcode
or, the new approach:
@api.depends('partner_id')
def _compute_taxcode(self):
self.taxcode = self.partner_id.taxcode
The onchange approach creates a big issue: you will have to manage this logic by creating
bridge modules for every module that creates an invoice (e.g. l10n_mx_sale and
l10n_mx_subsription).
With the new approach, the TAXCODE is delegated to the invoice, and handled automatically
at creation, unless provided explicitly. Every module who create an invoice will have the new
business logic applied automatically: no need to create bridge modules.
Having some data that are computed downstream and others upstream, and some backend and others for the interface only is, in my opinion, a big design flaw in Odoo's framework. It is much easier if everything is computed in the same direction, with only one dependency tree, and one concept. (imagine computed fields are a like an excel cell, whose formula depends on others cell; imagine the mess if Excel would have introduced "onchange")
### Technicals
The main change is to evaluate computed fields only when we need it, instead of "at every write & create". Thus, computed fields are evaluated at the end of the transaction (commit), when you read a field that is marked as "to recompute", or when you search on a field that have record marked as "to recompute".
As opposed to the current version, the value in cache is usually not invalidated. Instead, we use the existing "todo" concept of the framework to mark fields to be recomputed. Except that we don't process the "todo" at each write() / create() anymore.
That allows multiple speed improvements:
- do not recompute fields, when we write the same value than already in the cache (when validating an invoice, a lot of computed fields are currently evaluated several times during the time of building the invoice. -> the company_id is set by default, but then computed as related to the journal_id --> triggers most computed fields)
- in case of multiple write/create, the computed fields are evaluated only once: if you add lines one by one on an invoice, the total/taxes of the invoice will still be computed only once, at the end of the transaction.
So, the following code **will evaluate invoice's computed fields only once** (e.g., the subtotal & taxes):
invoice = Invoice.create(...)
invoice.write(...)
for line in ...:
InvoiceLine.create({... 'invoice_id': invoice.id)
But the triggers to evaluate compute fields' dependencies are still called once every create/write. Thus, it's still a good optimization to create all the lines at once to avoid the triggers. (but I think the triggers cost can be reduced a lot, see bellow)
### Compatibilities
This version of the ORM is mostly compatible with the current version in master (all the tests of the base module passed without modifications). But there are subtles impacts that requires to fix some business modules. The main ones are:
- if you perform direct SQL queries, you might want to do self.recompute() or self.recompute_fields(...) to evaluate and write the computed values before the SQL queries. (In master, you had to do it in computed fields, but you were safe after a write().
- there are some bugs to fix in business modules that were not noticeable because function fields were updated, at the end of write() or create(). (the main ones are missing dependencies in @depends() who were not a big deal before and can create bugs now)
- recursive fields feature has been removed. Instead, explicitly call a self.add_todo() on children to mark them as to "recompute". --> it's actually very easy to put them back, but as they are not used a lot, I think it's better to remove this feature from the framework and explicitly manage recursivity in the business code.
### Side Effect
Performances seem much better with this refactoring. The following code is **2.32x faster** with demo data (0.0086s vs 0.0037s):
for partner in self.env['res.partner'].search([]):
if partner.state_id:
cn = partner.state_id.country_id.name
Writing and creating complex records (with related fields, computed fields) seems faster too, but I still have to do the benchmark on real business modules. The method testme() in this branch, that create a complex object with one2many, multiple related and computed fields is:
- 1.82x faster: 0.0351s vs 0.0192s
- 1.66x less SQL queries: 50 vs 30
Stack trace is shorter when crashing in computed fields.
This branch will also allow to remove computed fields' triggers using inverse fields instead or hard SQL queries. I expect this to speed up most write() / create() by reducing SQL queries by an extra ~35%, which should translates into an extra speed improvement.
### Misc Notes
- record.field = 3 is now 100% equivalent to record.write({'field': 3})
- record.write(...) doet not write, but update in-memory
- _inherits are not anymore handled by write(...), but by related fields inverse's method
- prefetch should be improved (what about passing the record set instead of an iterable on ids)
- recompute computes in-memory, but does not write anymore
- stored fields have only one value in cache (cache does not depend on the context for those fields)
- @depends are evaluated in memory through inverse fields when possible, instead of hard SQL queries
- towrite holds value that have changed but not written to the DB anymore --> use towrite_flush() before direct SQL queries
- ACLs checks are made in write(). --> _write(...) which become a low level function that do not check ACL
- removed "global" from ir.rule and check if groups are set instead (global is a python protected keyword)
- boolean: is false at pg level instead of python level
### Status
- the compute alternative to onchange works perfectly
- base module installs and pass all tests
- but there are still bugs to fix, and business modules to review
It's a quick POC written in a few evenings; it still requires a huge cleanup.
Once these are done, ideas for future improvements: https://pad.odoo.com/p/r.896af7a5c2a2fc86575f8c5b4d306419
### About onchange
Onchange will remain supported in v13, but should be limited to pure UI changes, without business logic. (so only a few; pretty much everything should be implemented with computed fields instead)
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-prThis change explores replacing many screen-only automatic updates with reusable business rules that also work when records are created by imports, integrations, or automated processes. It should make invoices, sales, CRM, HR leave, mail activities, and products behave more consistently while reducing duplicated logic across modules.
Original PR description
POC moved to branch: master-nochange-fp Support for compute, with readonly=False as an alternative to onchange & conditional defaults Most onchange includes business logic (ex: changing a partner on…
POC moved to branch: master-nochange-fp
Support for compute, with readonly=False as an alternative to onchange & conditional defaults
Most onchange includes business logic (ex: changing a partner on an invoice sets the
fiscal position, and the payment terms). But the business logic should not be exclusive to
the user interface. Thus, most of these onchanges should actually be compute fields with
store=True and readonly=False.
Compute fields are usually orthogonal between each others, thus simpler to implement and
inherits. Example: on an invoice, it's easy to implement _compute_fiscal_position (it's a
related partner_id.fiscal_position_id), but very complex to implement _onchange_partner_id
(it has impact on lots of different concepts depending on installed modules: fiscal positions,
payment terms, address, ...). By splitting this big onchange into smaller compute, it should
simplify the code and inheritability.
USE CASE 1:
If onchanges are replaced by compute fields, the code to create an invoice, or automated tests
it is simplified as you can let the business logic do its job:
self.env['account.invoice'].create({
'partner_id': 1
'line_ids': [{
'product_id': 1
})
)}
-> the compute fields will compute the right fiscal position, taxes, customer address, etc. It's
not the role of the sale order to implement this logic anymore.
USE CASE 2:
Let's say the module l10n_mx want to add a TAXCODE field on an invoice,
there is two way to do it:
@api.onchange['partner_id')
def _change_partner_id(self):
super()
self.taxcode = self.partner_id.taxcode
or, the new approach:
@api.depends('partner_id')
def _compute_taxcode(self):
self.taxcode = self.partner_id.taxcode
The onchange approach creates a big issue: you will have to manage this logic by creating
bridge modules for every module that creates an invoice (e.g. l10n_mx_sale and
l10n_mx_subsription).
With the new approach, the TAXCODE is delegated to the invoice, and handled automatically
at creation, unless provided explicitly. Every module who create an invoice will have the new
business logic applied automatically: no need to create bridge modules.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-prOdoo now loads IoT Box drivers automatically when the box starts or connects to an Odoo instance, reducing manual setup and helping devices become ready faster. Administrators can turn off automatic loading when they need to preserve custom changes made directly on the box.
Original PR description
Automatically load the IoT Drivers when Odoo starts on the IoT Box or when the connection to the Odoo instance is done. Allow to deactivate the automatic load to avoid overriding modifications made on the Box. TaskID: 2009683 -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Customer-facing POS displays are now configured and controlled per IoT device instead of through the IoT Box screen module. This makes device management more consistent, prevents extra browser tabs when display URLs change, and reduces unnecessary display refreshes during order edits.
Original PR description
Linked to odoo/enterprise#5266 - Move all the logic that was inside hw_screen into an IoT Driver in order to have consistency between devices. - Move the configuration of screen_url from the IoT Box form to the IoT Device. - If an URL different than the default one is used, refresh the page every minute. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Editable list views now let users adjust column widths directly from the column headers. This makes dense records easier to read and work with, while supporting tests were updated to keep list behavior reliable.
Original PR description
Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
The website editor experience has been redesigned so editing options are shown in a clearer side panel instead of older dropdown and overlay controls. This makes page and email design tools easier to use and also cleans up editor asset organization to avoid duplicate styling resources.
Original PR description
* website, mass_mailing, point_of_sale, website_form
This update improves day-to-day manufacturing and inventory screens by hiding fields that are not relevant unless related features are active, clarifying labels, and narrowing product choices when creating lots or serial numbers. It also includes small fixes for sales and mass mailing compatibility after recent data model changes.
Original PR description
Mainly to benefit from the revert from @d-fence
This update adds automated checks for key eLearning course flows, including joining a public course, accessing course content, and completing lessons in the fullscreen player. It also fixes YouTube lesson auto-completion so learners receive completion credit when videos near the end.
Adds a guided workflow to recognize expenses or revenue in the period they belong to, while keeping taxes reported in the original invoice period. This helps accounting teams handle bills or invoices received after the relevant period without manual journal entry workarounds.
Original PR description
Task 2006617 ======= Purpose ======= Accruals are revenues and expenses that are incurred during an accounting period for which no invoices or payments were received or made. => We suggest a wizard…
Task 2006617
=======
Purpose
=======
Accruals are revenues and expenses that are incurred during an accounting period for which no invoices or payments were received or made.
=> We suggest a wizard allowing recognizing the Expense/Revenue in a different period keeping tax return in the invoice period.
Example:
A vendor bill received in February which was for the December consumption.
You should recognize the expense in December but the tax return is still due to February.
1) Regular Vendor Bill in february
Account D C
600 ACHAT 10000
411 TVA 2100
440 FOUR 12100
2) Action opening a wizard that allows specifying when we have to move the expense.
- Targeted date, accrued account (expense, revenue, taxes, ...)
- Action from account.move.line ?
3) Wizard result
a) The expense account is replaced by the accrued expense account in the original vendor bill journal entry (february)
Compte D C
444 FAE 10000
411 TVA 2100
440 FOUR 12100
b) A new accrual journal entry is created for the original expense account in december
Compte D C
600 ACHAT 10000
444 FAE 10000
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-prFollower actions are now easier to access on small screens, so users can follow or unfollow records and manage followers from mobile devices. The follower menu also has better spacing and larger tap areas, making it more comfortable to use on touch screens.
Original PR description
Pad:https://pad.odoo.com/p/r.0fa02394ca0736744b1793b5ff5c3f96 Task:https://www.odoo.com/web#id=1928573&action=333&active_id=131&model=project.task&view_type=form&menu_id=4720
This pull request adds shared support for Latin American customer identification and invoice document numbering, then uses it to modernize Argentina, Chile, and Peru localization features. Businesses in these countries get more accurate partner records, invoice sequencing, tax handling, and local geographic/accounting data needed for compliance and future electronic invoicing.
Original PR description
Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Adds official VAT purchase and sales reporting for Argentina, including detailed invoice tax breakdowns and flexible pivot analysis. Adds a Chilean F29 tax return proposal tool to help businesses review tax information already reported to the government.
Customer-facing POS displays are now managed as individual IoT devices instead of being configured only at the IoT Box level. This makes it easier for businesses to use different display URLs per device and keep screens updated automatically when settings change.
Original PR description
Linked to odoo/odoo#35707 - Move all the logic that was inside hw_screen into an IoT Driver in order to have consistency between devices. - Move the configuration of screen_url from the IoT Box form to the IoT Device. - If an URL different than the default one is used, refresh the page every minute.
IoT Box drivers now load automatically when Odoo starts on the IoT Box or when it connects to an Odoo instance. This reduces manual setup and helps devices become ready faster, while still allowing automatic loading to be disabled to preserve custom changes on the Box.
Original PR description
Automatically load the IoT Drivers when Odoo starts on the IoT Box or when the connection to the Odoo instance is done. Allow to deactivate the automatic load to avoid overriding modifications made on the Box. TaskID: 2009683
Resolved issues and error corrections
This update fixes error handling screens so they work properly in Microsoft Edge and Android WebView. It replaces newer JavaScript syntax with a more widely supported approach, reducing the risk of crashes or broken error messages for users on those browsers.
Original PR description
As of August 20 2019, Microsoft Edge partially supports ECMA2018. For instance, `Promise.prototype.finally()` can be used, but the spread operator does not work on objects. Note that we use `_.extend()` instead of `Object.assign()`, because Android WebView does not support `Object.assign()` as of August 20 2019. Task-ID 2056070
Creating a subcontractor contact could previously trigger an error and interrupt the workflow. This fix adds the missing subcontractor contact type so users can create subcontractors normally in manufacturing subcontracting processes.
Original PR description
Task:https://www.odoo.com/web?#id=2058434&action=327&model=project.task&view_type=form&menu_id=4720 Pad: https://pad.odoo.com/p/r.5f086f8c1b740d7bb62a0e035f2b9447 Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
The Return Picking wizard now correctly shows the refund option when used from Sales. This prevents users from missing an important refund setting during product returns, reducing manual follow-up and billing mistakes.
Original PR description
Task: https://www.odoo.com/web?#id=2058574&action=327&model=project.task&view_type=form&menu_id=4720 Pad: https://pad.odoo.com/p/r.3560886c962a4a293470e4968cf6aa03
This fix updates several Odoo Enterprise screens so they work correctly in Microsoft Edge and Android WebView. It helps users access document search, messaging, and VoIP features reliably across supported browsers and devices.
Original PR description
*: documents, mail_enterprise, voip As of August 20 2019, Microsoft Edge partially supports ECMA2018. For instance, `Promise.prototype.finally()` can be used, but the spread operator does not work on objects. Note that we use `_.extend()` instead of `Object.assign()`, because Android WebView does not support `Object.assign()` as of August 20 2019. Task-ID 2056070
This fixes an issue in the Mexican electronic invoicing module where required invoice data could be skipped during processing. It helps users save customer invoices and cancel journal entries without unexpected errors.
Original PR description
[FIX] l10n_mx_edi: Non-computed fields on Journal Entry = - l10n_mx_edi_cfdi_uuid - l10n_mx_edi_cfdi As part of computed fields that are skipped in loops and are not initialized then they begin to cause troubles. Be it in the creation of Invoices or When trying to cancel a Journal Entry. When creating a new Customer Invoices for l10n_mx it is not allowed to save as following error arises.  When trying to cancel a Journal Entry <img width="1462" alt="Screen Shot 2019-08-21 at 2 35 38 AM" src="https://user-images.githubusercontent.com/7598010/63412981-6a87d480-c3be-11e9-8294-57334288aecb.png">
Features or functions removed from Odoo
The website sitemap template no longer includes unused fields that were never populated. This cleanup reduces confusion in the code without changing how website visitors or search engines experience the sitemap.
Original PR description
Sitemap generation python side set `__priority` and `__lastmod`. Sitemap view tries to read `priority` and `lastmod` which is never set. It also tried to read `changefreq` which is also never set. Code introduced with 54d30d5194 Related to #35464
Code cleanup and technical improvements
This change updates how sales-related user access groups are managed, replacing the previous generated view approach with explicit fields for Sales and Sales Teams. It also makes group changes more consistent by removing linked higher-level access when needed and warning users when a change will affect related groups.
Original PR description
Description of the issue/feature this PR addresses: Current behavior before PR: Desired behavior after PR is merged: -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr