mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-17 18:29:08 +02:00
add new module
This commit is contained in:
21
inventory_groups/models/groups.py
Normal file
21
inventory_groups/models/groups.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from odoo import _, fields, models, api
|
||||
|
||||
|
||||
class Inventorygroups(models.Model):
|
||||
_name = "stock.groups"
|
||||
_parent_name = "parent_id"
|
||||
_rec_name = 'complete_name'
|
||||
|
||||
name = fields.Char(required=True)
|
||||
parent_id = fields.Many2one('stock.groups', "Parent Group")
|
||||
complete_name = fields.Char(
|
||||
'Complete Name', compute='_compute_complete__group_name',
|
||||
store=True)
|
||||
|
||||
@api.depends('name', 'parent_id.complete_name')
|
||||
def _compute_complete__group_name(self):
|
||||
for category in self:
|
||||
if category.parent_id:
|
||||
category.complete_name = '%s / %s' % (category.parent_id.complete_name, category.name)
|
||||
else:
|
||||
category.complete_name = category.name
|
||||
Reference in New Issue
Block a user