Skip to content
Extraits de code Groupes Projets
Valider fc875523 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[clean] split partner.product.family model

parent 0a7929a3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import res_partner from . import res_partner
from . import res_partner_product_family
...@@ -59,35 +59,6 @@ class ResPartner(models.Model): ...@@ -59,35 +59,6 @@ class ResPartner(models.Model):
on_delete='restrict') on_delete='restrict')
class ResPartnerProductFamily(models.Model):
_name = "res.partner.product.family"
_description = "Famille / Catégorie Produit"
_parent_name = "parent_id"
_parent_store = True
_rec_name = 'name'
_order = 'parent_path, name'
name = fields.Char('Catégorie / Famille produit',
index=True, required=True)
color = fields.Integer(string='Couleur')
parent_id = fields.Many2one(
comodel_name='res.partner.product.family',
string='Catégorie produit (parent)',
index=True,
ondelete='cascade')
parent_path = fields.Char(index=True)
child_ids = fields.One2many(
comodel_name='res.partner.product.family',
inverse_name='parent_id',
string='Famille produit')
@api.constrains('parent_id')
def _check_origin_recursion(self):
if not self._check_recursion():
raise ValidationError(
'Vous ne pouvez pas créer des familles récursives.')
class ResPartnerSector(models.Model): class ResPartnerSector(models.Model):
_name = "res.partner.sector" _name = "res.partner.sector"
_description = "Secteur" _description = "Secteur"
......
# Copyright 2020 Le Filament (<https://le-filament.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResPartnerProductFamily(models.Model):
_name = "res.partner.product.family"
_description = "Famille / Catégorie Produit"
_parent_name = "parent_id"
_parent_store = True
_rec_name = 'name'
_order = 'parent_path, name'
name = fields.Char('Catégorie / Famille produit',
index=True, required=True)
color = fields.Integer(string='Couleur')
parent_id = fields.Many2one(
comodel_name='res.partner.product.family',
string='Catégorie produit (parent)',
index=True,
ondelete='cascade')
parent_path = fields.Char(index=True)
child_ids = fields.One2many(
comodel_name='res.partner.product.family',
inverse_name='parent_id',
string='Famille produit')
@api.constrains('parent_id')
def _check_origin_recursion(self):
if not self._check_recursion():
raise ValidationError(
'Vous ne pouvez pas créer des familles récursives.')
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter