Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Product Variant Default Code

Entity: product.product

Compute Method: _compute_default_code

Inputs Method Outputs
self.env.cr.flush()
for rec in self:
            if not rec.manual_code:
                new_code = rec._generate_default_code()
                # Only write if the value actually changed to avoid unnecessary
                # write_date updates that can cause PostgreSQL serialization errors
                if rec.default_code != new_code:
                    rec.default_code = new_code

Back to entity