mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
release chart
This commit is contained in:
17
app_stock_location_chart/models/stock_location.py
Normal file
17
app_stock_location_chart/models/stock_location.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
|
||||
|
||||
class Location(models.Model):
|
||||
_name = "stock.location"
|
||||
_inherit = ['stock.location', 'image.mixin']
|
||||
|
||||
child_all_count = fields.Integer(
|
||||
'Indirect Surbordinates Count',
|
||||
compute='_compute_child_all_count', store=False)
|
||||
|
||||
@api.depends('child_ids.child_all_count')
|
||||
def _compute_child_all_count(self):
|
||||
for rec in self:
|
||||
rec.child_all_count = len(rec.child_ids) + sum(child.child_all_count for child in rec.child_ids)
|
||||
Reference in New Issue
Block a user