mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[12.0][ADD] stock_demand_estimate_matrix
This commit is contained in:
23
stock_demand_estimate_matrix/models/date_range.py
Normal file
23
stock_demand_estimate_matrix/models/date_range.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Copyright 2019 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class DateRange(models.Model):
|
||||
_inherit = "date.range"
|
||||
|
||||
days = fields.Integer(
|
||||
string="Days between dates",
|
||||
compute="_compute_days",
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
@api.multi
|
||||
@api.depends("date_start", "date_end")
|
||||
def _compute_days(self):
|
||||
for rec in self.filtered(lambda x: x.date_start and x.date_end):
|
||||
rec.days = abs((
|
||||
rec.date_end -
|
||||
rec.date_start
|
||||
).days) + 1
|
||||
Reference in New Issue
Block a user