summaryrefslogtreecommitdiff
path: root/addons/stock_landed_costs
diff options
context:
space:
mode:
authorRaphael Collet <rco@odoo.com>2020-04-07 13:51:30 +0000
committerRaphael Collet <rco@odoo.com>2020-05-18 09:51:43 +0000
commitea3e39506a2b360545ec0cd1d3235e69ad16ea6c (patch)
tree9d103c7a40911c988e1a3cbecfd8d6a76a3a9a85 /addons/stock_landed_costs
parent2e56191c8b86d05bbce17790de8a4732c0478013 (diff)
[IMP] models: use slots for BaseModel
This restricts the attributes of a BaseModel instance to `env`, `_ids` and `_prefetch_ids`. This way, one can only assign fields on a record; other assignments are programming errors. This also reduces the memory footprint of records from 168 to 64 bytes (-62%), and makes their instanciation faster. closes odoo/odoo#51075 Related: odoo/enterprise#10529 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/stock_landed_costs')
-rw-r--r--addons/stock_landed_costs/models/stock_landed_cost.py2
1 files changed, 0 insertions, 2 deletions
diff --git a/addons/stock_landed_costs/models/stock_landed_cost.py b/addons/stock_landed_costs/models/stock_landed_cost.py
index 0b8c3287aca..66f5a6e9a45 100644
--- a/addons/stock_landed_costs/models/stock_landed_cost.py
+++ b/addons/stock_landed_costs/models/stock_landed_cost.py
@@ -334,8 +334,6 @@ class StockLandedCostLine(models.Model):
@api.onchange('product_id')
def onchange_product_id(self):
- if not self.product_id:
- self.quantity = 0.0
self.name = self.product_id.name or ''
self.split_method = self.product_id.product_tmpl_id.split_method_landed_cost or self.split_method or 'equal'
self.price_unit = self.product_id.standard_price or 0.0