Thursday, February 2, 2023
4 changes · master
Resolved issues and error corrections
This fixes an issue where updating a many-to-many relationship could cause far more related records to be recalculated than necessary. The change reduces unnecessary background work, improving performance for databases with large linked record sets while keeping computed values accurate.
Original PR description
The issue occurs when a computed field depends on a many2many field with a corresponding inverse field on its comodel. Consider two models like ```py class User(models.Model): _name = _description =…
The issue occurs when a computed field depends on a many2many field with a corresponding inverse field on its comodel. Consider two models like
```py
class User(models.Model):
_name = _description = 'test_new_api.user'
group_ids = fields.Many2many('test_new_api.group')
group_count = fields.Integer(compute='_compute_group_count', store=True)
@api.depends('group_ids')
def _compute_group_count(self):
for user in self:
user.group_count = len(user.group_ids)
class Group(models.Model):
_name = _description = 'test_new_api.group'
user_ids = fields.Many2many('test_new_api.user')
```
When a user is added to a group with
```py
group.write({'user_ids': [Command.link(user.id)]})
```
we expect the field `group_count` to be recomputed on `user` only, but it is actually triggered on *all* the records in `group.user_ids`. This is a real performance issue when there are many records in the relation.
The explanation comes from the fact that
* the framework considers the field `user_ids` is modified on `group`;
* the field `group_count` implicitly depends on `group_ids.user_ids`, which makes it triggered on the users `u` such that `u.group_ids` intersects `group`.
The solution consists in handling the dependencies on inverse many2many field in the field itself. The field no longer adds the implicit dependency on its inverse field in the trigger tree, but instead determines which records in the comodel are actually impacted by the relation change in the method field.write().The purchase order form now displays the 'Deliver to' field across the full row when storage locations are enabled. This fixes a visual layout issue, making the form clearer and easier to use during purchase order creation.
Original PR description
To reproduce the issue: 1. Install [Inventory], [Purchase] on Apps 2. [Settings]>[Inventory]>[Storage Locations]: enable 3. On [Purchase], Create. 'Deliver to' field is ill-positioned Desired view: use the full width of the row Applicable versions: 16.0 - master opw-314167 --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This fixes how quantities are rounded in manufacturing bills of materials by using Odoo's standard product unit precision. It helps ensure component quantities are displayed and calculated consistently without relying on a missing precision setting.
Original PR description
before this commit, the precision given for the field product_qty in mrp.bom model is Unit of Measure, which is not existing by default in odoo decimal precisions. after this commit, precision will be updated to default Product Unit of Measure precision --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
This update fixes how subscription-related operations are handled in batches, helping reduce errors when multiple records are processed together. It should make subscription management more reliable for teams working with larger volumes of sales subscriptions.
Original PR description
The goal of this PR is to batch operation for sale_subscription