mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
@@ -5,15 +5,13 @@
|
||||
"name": "Stock Average Daily Sale",
|
||||
"summary": """
|
||||
Allows to gather delivered products average on daily basis""",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "16.0.1.1.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV,BCIM,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-reporting",
|
||||
"depends": [
|
||||
"sale",
|
||||
"stock_storage_type_putaway_abc",
|
||||
"product_abc_classification",
|
||||
"product_abc_classification_sale_stock",
|
||||
"product_route_mto",
|
||||
],
|
||||
"data": [
|
||||
@@ -22,7 +20,6 @@
|
||||
"security/stock_average_daily_sale_demo.xml",
|
||||
"views/stock_average_daily_sale_config.xml",
|
||||
"views/stock_average_daily_sale.xml",
|
||||
"views/abc_classification_profile.xml",
|
||||
"views/stock_warehouse.xml",
|
||||
"data/ir_cron.xml",
|
||||
],
|
||||
|
||||
@@ -6,45 +6,42 @@
|
||||
model="stock.average.daily.sale.config"
|
||||
id="stock_average_daily_sale_config_level_a"
|
||||
>
|
||||
<field
|
||||
name="abc_classification_profile_id"
|
||||
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
|
||||
/>
|
||||
<field name="abc_classification_level">a</field>
|
||||
<field name="period_value">2</field>
|
||||
<field name="period_name">week</field>
|
||||
<field name="standard_deviation_exclude_factor">3</field>
|
||||
<field name="safety_factor">0.3</field>
|
||||
<field name="number_days_qty_in_stock">2</field>
|
||||
<field name="exclude_weekends">1</field>
|
||||
<field name="warehouse_id" ref="stock.warehouse0" />
|
||||
<field name="company_id" ref="base.main_company" />
|
||||
</record>
|
||||
<record
|
||||
model="stock.average.daily.sale.config"
|
||||
id="stock_average_daily_sale_config_level_b"
|
||||
>
|
||||
<field
|
||||
name="abc_classification_profile_id"
|
||||
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
|
||||
/>
|
||||
<field name="abc_classification_level">b</field>
|
||||
<field name="period_value">13</field>
|
||||
<field name="period_name">week</field>
|
||||
<field name="standard_deviation_exclude_factor">3</field>
|
||||
<field name="safety_factor">0.3</field>
|
||||
<field name="number_days_qty_in_stock">2</field>
|
||||
<field name="exclude_weekends">1</field>
|
||||
<field name="warehouse_id" ref="stock.warehouse0" />
|
||||
<field name="company_id" ref="base.main_company" />
|
||||
</record>
|
||||
<record
|
||||
model="stock.average.daily.sale.config"
|
||||
id="stock_average_daily_sale_config_level_c"
|
||||
>
|
||||
<field
|
||||
name="abc_classification_profile_id"
|
||||
ref="product_abc_classification_sale_stock.abc_classification_profile_sale_stock"
|
||||
/>
|
||||
<field name="abc_classification_level">c</field>
|
||||
<field name="period_value">26</field>
|
||||
<field name="period_name">week</field>
|
||||
<field name="standard_deviation_exclude_factor">3</field>
|
||||
<field name="safety_factor">0.3</field>
|
||||
<field name="number_days_qty_in_stock">2</field>
|
||||
<field name="exclude_weekends">1</field>
|
||||
<field name="warehouse_id" ref="stock.warehouse0" />
|
||||
<field name="company_id" ref="base.main_company" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# Copyright 2024 Camptocamp SA (http://www.camptocamp.com)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo.tools.sql import column_exists, create_column
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
if not column_exists(cr, "stock_average_daily_sale_config", "exclude_weekends"):
|
||||
_logger.info("Create stock_average_daily_sale_config column exclude_weekends")
|
||||
create_column(
|
||||
cr, "stock_average_daily_sale_config", "exclude_weekends", "boolean"
|
||||
)
|
||||
cr.execute("UPDATE stock_average_daily_sale_config SET exclude_weekends = True")
|
||||
@@ -1,4 +1,3 @@
|
||||
from . import stock_warehouse # isort:skip
|
||||
from . import stock_average_daily_sale_config # isort:skip
|
||||
from . import stock_average_daily_sale # isort:skip
|
||||
from . import abc_classification_profile
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright 2023 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AbcClassificationProfile(models.Model):
|
||||
|
||||
_inherit = "abc.classification.profile"
|
||||
|
||||
stock_average_daily_sale_config_ids = fields.One2many(
|
||||
comodel_name="stock.average.daily.sale.config",
|
||||
inverse_name="abc_classification_profile_id",
|
||||
string="Average Daily Sale Configurations",
|
||||
)
|
||||
@@ -18,17 +18,11 @@ _logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StockAverageDailySale(models.Model):
|
||||
|
||||
_name = "stock.average.daily.sale"
|
||||
_auto = False
|
||||
_order = "abc_classification_level ASC, product_id ASC"
|
||||
_description = "Average Daily Sale for Products"
|
||||
|
||||
abc_classification_profile_id = fields.Many2one(
|
||||
comodel_name="abc.classification.profile",
|
||||
required=True,
|
||||
index=True,
|
||||
)
|
||||
abc_classification_level = fields.Selection(
|
||||
selection=ABC_SELECTION, required=True, readonly=True, index=True
|
||||
)
|
||||
@@ -182,14 +176,16 @@ class StockAverageDailySale(models.Model):
|
||||
NOW()::date - '1 day'::interval as date_to,
|
||||
-- start of the analyzed period computed from the original cfg
|
||||
(NOW() - (period_value::TEXT || ' ' || period_name::TEXT)::INTERVAL):: date as date_from,
|
||||
-- the number of business days between start and end computed by
|
||||
-- removing saturday and sunday
|
||||
-- the number of days between start and end computed by
|
||||
-- removing saturday and sunday if weekends should be excluded
|
||||
(SELECT count(1) from (select EXTRACT(DOW FROM s.d::date) as dd
|
||||
FROM generate_series(
|
||||
(NOW() - (period_value::TEXT || ' ' || period_name::TEXT)::INTERVAL):: date ,
|
||||
(NOW()- '1 day'::interval)::date,
|
||||
'1 day') AS s(d)) t
|
||||
WHERE dd not in(0,6)) AS nrb_days_without_sat_sun
|
||||
WHERE exclude_weekends = False
|
||||
OR (exclude_weekends = True AND dd not in(0,6))
|
||||
) AS nbr_days
|
||||
FROM
|
||||
stock_average_daily_sale_config
|
||||
),
|
||||
@@ -215,9 +211,10 @@ class StockAverageDailySale(models.Model):
|
||||
+ ( stddev_samp(product_uom_qty) OVER pid * cfg.standard_deviation_exclude_factor)
|
||||
) as upper_bound,
|
||||
coalesce ((stddev_samp(product_uom_qty) OVER pid), 0) as standard_deviation,
|
||||
cfg.nrb_days_without_sat_sun,
|
||||
cfg.nbr_days,
|
||||
cfg.date_from,
|
||||
cfg.date_to,
|
||||
cfg.exclude_weekends,
|
||||
cfg.id as config_id,
|
||||
sm.date
|
||||
FROM stock_move sm
|
||||
@@ -228,9 +225,10 @@ class StockAverageDailySale(models.Model):
|
||||
JOIN cfg on cfg.abc_classification_level = coalesce(pt.abc_storage, 'c')
|
||||
WHERE
|
||||
sl_src.usage in ('view', 'internal')
|
||||
AND sl_dest.usage = 'customer'
|
||||
AND sl_dest.usage in ('customer', 'production')
|
||||
AND sm.date BETWEEN cfg.date_from AND cfg.date_to
|
||||
AND sm.state = 'done'
|
||||
AND sm.warehouse_id = cfg.warehouse_id
|
||||
WINDOW pid AS (PARTITION BY sm.product_id, sm.warehouse_id)
|
||||
),
|
||||
|
||||
@@ -245,16 +243,16 @@ class StockAverageDailySale(models.Model):
|
||||
)::numeric AS average_qty_by_sale,
|
||||
(count(product_uom_qty) FILTER
|
||||
(WHERE product_uom_qty BETWEEN lower_bound AND upper_bound OR standard_deviation = 0)
|
||||
/ nrb_days_without_sat_sun::numeric) AS average_daily_sales_count,
|
||||
/ nbr_days::numeric) AS average_daily_sales_count,
|
||||
count(product_uom_qty) FILTER
|
||||
(WHERE product_uom_qty BETWEEN lower_bound AND upper_bound OR standard_deviation = 0)::double precision as nbr_sales,
|
||||
standard_deviation::numeric ,
|
||||
date_from,
|
||||
date_to,
|
||||
config_id,
|
||||
nrb_days_without_sat_sun
|
||||
nbr_days
|
||||
FROM deliveries_last
|
||||
GROUP BY product_id, warehouse_id, standard_deviation, nrb_days_without_sat_sun, date_from, date_to, config_id
|
||||
GROUP BY product_id, warehouse_id, standard_deviation, nbr_days, date_from, date_to, config_id
|
||||
),
|
||||
-- Compute the stock by product in locations under stock
|
||||
stock_qty AS (
|
||||
@@ -268,7 +266,6 @@ class StockAverageDailySale(models.Model):
|
||||
GROUP BY sq.product_id, sl.warehouse_id
|
||||
),
|
||||
-- Compute the standard deviation of the average daily sales count
|
||||
-- excluding saturday and sunday
|
||||
daily_standard_deviation AS(
|
||||
SELECT
|
||||
id,
|
||||
@@ -285,7 +282,7 @@ class StockAverageDailySale(models.Model):
|
||||
(WHERE product_uom_qty BETWEEN lower_bound AND upper_bound OR standard_deviation = 0)
|
||||
) as daily_sales
|
||||
FROM deliveries_last
|
||||
WHERE EXTRACT(DOW FROM date) <> '0' AND EXTRACT(DOW FROM date) <> '6'
|
||||
WHERE exclude_weekends = False OR (EXTRACT(DOW FROM date) <> '0' AND EXTRACT(DOW FROM date) <> '6')
|
||||
GROUP BY product_id, warehouse_id, 1
|
||||
) as averages_daily group by id, product_id, warehouse_id
|
||||
|
||||
@@ -305,16 +302,15 @@ class StockAverageDailySale(models.Model):
|
||||
date_to,
|
||||
config_id,
|
||||
abc_classification_level,
|
||||
cfg.abc_classification_profile_id,
|
||||
sale_ok,
|
||||
is_mto,
|
||||
sqty.qty_in_stock as qty_in_stock,
|
||||
ds.daily_standard_deviation,
|
||||
ds.daily_standard_deviation * cfg.safety_factor * sqrt(nrb_days_without_sat_sun) as safety,
|
||||
(cfg.number_days_qty_in_stock * average_qty_by_sale * average_daily_sales_count) + (ds.daily_standard_deviation * cfg.safety_factor * sqrt(nrb_days_without_sat_sun)) as safety_bin_min_qty_new,
|
||||
ds.daily_standard_deviation * cfg.safety_factor * sqrt(nbr_days) as safety,
|
||||
(cfg.number_days_qty_in_stock * average_qty_by_sale * average_daily_sales_count) + (ds.daily_standard_deviation * cfg.safety_factor * sqrt(nbr_days)) as safety_bin_min_qty_new,
|
||||
cfg.number_days_qty_in_stock * GREATEST(average_daily_sales_count, 1) * (average_qty_by_sale + (standard_deviation * cfg.safety_factor)) as safety_bin_min_qty_old,
|
||||
GREATEST(
|
||||
(cfg.number_days_qty_in_stock * average_qty_by_sale * average_daily_sales_count) + (ds.daily_standard_deviation * cfg.safety_factor * sqrt(nrb_days_without_sat_sun)),
|
||||
(cfg.number_days_qty_in_stock * average_qty_by_sale * average_daily_sales_count) + (ds.daily_standard_deviation * cfg.safety_factor * sqrt(nbr_days)),
|
||||
(cfg.number_days_qty_in_stock * average_qty_by_sale)
|
||||
) as recommended_qty
|
||||
FROM averages t
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright 2021 ACSONE SA/NV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import _, fields, models
|
||||
|
||||
from odoo.addons.stock_storage_type_putaway_abc.models.stock_location import (
|
||||
ABC_SELECTION,
|
||||
@@ -9,17 +9,18 @@ from odoo.addons.stock_storage_type_putaway_abc.models.stock_location import (
|
||||
|
||||
|
||||
class StockAverageDailySaleConfig(models.Model):
|
||||
|
||||
_name = "stock.average.daily.sale.config"
|
||||
_description = "Average daily sales computation parameters"
|
||||
check_company_auto = True
|
||||
|
||||
abc_classification_profile_id = fields.Many2one(
|
||||
comodel_name="abc.classification.profile",
|
||||
required=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
abc_classification_level = fields.Selection(
|
||||
selection=ABC_SELECTION, required=True, readonly=True
|
||||
selection=ABC_SELECTION, required=True, default="b"
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
string="Company",
|
||||
comodel_name="res.company",
|
||||
required=True,
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
standard_deviation_exclude_factor = fields.Float(required=True, digits=(2, 2))
|
||||
warehouse_id = fields.Many2one(
|
||||
@@ -30,7 +31,11 @@ class StockAverageDailySaleConfig(models.Model):
|
||||
default=lambda self: self.env["stock.warehouse"].search(
|
||||
[("company_id", "=", self.env.company.id)], limit=1
|
||||
),
|
||||
readonly=True,
|
||||
)
|
||||
exclude_weekends = fields.Boolean(
|
||||
help="Set to True only if you do not expect any orders/deliveries during "
|
||||
"the weekends. If set to True, stock moves done on weekends won't be "
|
||||
"taken into account to calculate the average daily usage",
|
||||
)
|
||||
period_name = fields.Selection(
|
||||
string="Period analyzed unit",
|
||||
@@ -47,3 +52,11 @@ class StockAverageDailySaleConfig(models.Model):
|
||||
string="Number of days of quantities in stock", required=True, default=2
|
||||
)
|
||||
safety_factor = fields.Float(digits=(2, 2), required=True)
|
||||
|
||||
_sql_constraints = [
|
||||
(
|
||||
"abc_classification_level_unique",
|
||||
"UNIQUE(abc_classification_level, warehouse_id)",
|
||||
_("Abc Classification Level must be unique per warehouse"),
|
||||
)
|
||||
]
|
||||
|
||||
@@ -4,7 +4,6 @@ from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockWarehouse(models.Model):
|
||||
|
||||
_inherit = "stock.warehouse"
|
||||
|
||||
average_daily_sale_root_location_id = fields.Many2one(
|
||||
@@ -13,8 +12,8 @@ class StockWarehouse(models.Model):
|
||||
compute="_compute_average_daily_sale_root_location_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
required=True,
|
||||
precompute=True,
|
||||
check_company=True,
|
||||
help="This is the root location for daily sale average stock computations",
|
||||
)
|
||||
|
||||
@@ -26,4 +25,17 @@ class StockWarehouse(models.Model):
|
||||
for warehouse in self.filtered(
|
||||
lambda w: not w.average_daily_sale_root_location_id
|
||||
):
|
||||
if not warehouse.lot_stock_id:
|
||||
continue
|
||||
warehouse.average_daily_sale_root_location_id = warehouse.lot_stock_id
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
# set the lot_stock_id of a newly created WH as an Average Daily Sale Root Location
|
||||
warehouses = super().create(vals_list)
|
||||
for warehouse, vals in zip(warehouses, vals_list):
|
||||
if vals.get("lot_stock_id") and not vals.get(
|
||||
"average_daily_sale_root_location_id"
|
||||
):
|
||||
warehouse.average_daily_sale_root_location_id = vals["lot_stock_id"]
|
||||
return warehouses
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<record model="ir.model.access" id="stock_average_daily_sale_access_user">
|
||||
<field name="name">stock.average.daily.sale access user</field>
|
||||
<field name="model_id" ref="model_stock_average_daily_sale" />
|
||||
<field name="group_id" ref="base.group_user" />
|
||||
<field name="group_id" ref="stock.group_stock_user" />
|
||||
<field name="perm_read" eval="1" />
|
||||
<field name="perm_create" eval="0" />
|
||||
<field name="perm_write" eval="0" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<record model="ir.model.access" id="stock_average_daily_sale_config_access_user">
|
||||
<field name="name">stock_average_daily_sale_config access user</field>
|
||||
<field name="model_id" ref="model_stock_average_daily_sale_config" />
|
||||
<field name="group_id" ref="base.group_user" />
|
||||
<field name="group_id" ref="stock.group_stock_user" />
|
||||
<field name="perm_read" eval="1" />
|
||||
<field name="perm_create" eval="0" />
|
||||
<field name="perm_write" eval="0" />
|
||||
@@ -16,8 +16,8 @@
|
||||
<field name="model_id" ref="model_stock_average_daily_sale_config" />
|
||||
<field name="group_id" ref="stock.group_stock_manager" />
|
||||
<field name="perm_read" eval="1" />
|
||||
<field name="perm_create" eval="0" />
|
||||
<field name="perm_create" eval="1" />
|
||||
<field name="perm_write" eval="1" />
|
||||
<field name="perm_unlink" eval="0" />
|
||||
<field name="perm_unlink" eval="1" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -87,12 +87,13 @@ class CommonAverageSaleTest:
|
||||
"product_id": product.id,
|
||||
"name": product.name,
|
||||
"location_id": origin_location.id,
|
||||
"warehouse_id": origin_location.warehouse_id.id,
|
||||
"location_dest_id": cls.customers.id,
|
||||
"product_uom_qty": qty,
|
||||
"priority": "1",
|
||||
}
|
||||
)
|
||||
# TODO: Check why this is necessary - it's in materialzed view query
|
||||
# TODO: Check why this is necessary - it's in materialized view query
|
||||
move.priority = "1"
|
||||
return move
|
||||
|
||||
|
||||
@@ -189,7 +189,8 @@ class TestAverageSale(CommonAverageSaleTest, TransactionCase):
|
||||
def test_view_refreshed(self):
|
||||
self._refresh()
|
||||
with self.assertNoLogs(
|
||||
"odoo.addons.stock_average_daily_sale.models.stock_average_daily_sale"
|
||||
"odoo.addons.stock_average_daily_sale.models.stock_average_daily_sale",
|
||||
level="DEBUG",
|
||||
):
|
||||
self.env["stock.average.daily.sale"].search_read(
|
||||
[("product_id", "=", self.product_1.id)]
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Copyright 2023 ACSONE SA/NV
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="abc_classification_profile_form_view" model="ir.ui.view">
|
||||
<field
|
||||
name="name"
|
||||
>abc.classification.profile.form (in stock_average_daily_sale)</field>
|
||||
<field name="model">abc.classification.profile</field>
|
||||
<field
|
||||
name="inherit_id"
|
||||
ref="product_abc_classification.abc_classification_profile_form_view"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<page name="levels" position="after">
|
||||
<page name="average_daily_sale" string="Average Daily Sale">
|
||||
<field name="stock_average_daily_sale_config_ids" nolabel="1" />
|
||||
</page>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -2,37 +2,69 @@
|
||||
<!-- Copyright 2021 ACSONE SA/NV
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="stock_average_daily_sale_config_tree_view">
|
||||
<field
|
||||
name="name"
|
||||
>stock.average.daily.sale.config.tree (in stock_average_daily_sale)</field>
|
||||
<field name="name">stock.average.daily.sale.config.tree</field>
|
||||
<field name="model">stock.average.daily.sale.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="top" create="false" delete="false">
|
||||
<tree>
|
||||
<field name="warehouse_id" />
|
||||
<field name="company_id" />
|
||||
<field name="abc_classification_level" />
|
||||
<field name="exclude_weekends" />
|
||||
<field name="period_value" />
|
||||
<field name="period_name" />
|
||||
<field name="number_days_qty_in_stock" />
|
||||
<field name="standard_deviation_exclude_factor" />
|
||||
<field name="safety_factor" />
|
||||
<field name="warehouse_id" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="stock_average_daily_sale_config_form_view">
|
||||
<field name="name">stock.average.daily.sale.config.form</field>
|
||||
<field name="model">stock.average.daily.sale.config</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Average daily sales computation parameters">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="warehouse_id" />
|
||||
<field name="company_id" />
|
||||
<field name="abc_classification_level" />
|
||||
<field name="exclude_weekends" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="period_value" />
|
||||
<field name="period_name" />
|
||||
<field name="number_days_qty_in_stock" />
|
||||
<field name="standard_deviation_exclude_factor" />
|
||||
<field name="safety_factor" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record
|
||||
model="ir.actions.act_window"
|
||||
id="stock_average_daily_sale_config_act_window"
|
||||
>
|
||||
<field name="name">Average daily sales computation parameters</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.average.daily.sale.config</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="stock_average_daily_sale_config_tree_view" />
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.menu" id="stock_average_daily_sale_config_menu">
|
||||
<field name="name">Average daily sales computation parameters</field>
|
||||
<field name="parent_id" ref="stock.menu_product_in_config_stock" />
|
||||
<field name="action" ref="stock_average_daily_sale_config_act_window" />
|
||||
<field name="sequence" eval="99" />
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -10,7 +10,11 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[1]" position="after">
|
||||
<group string="Average Sales" name="average_sale_reporting">
|
||||
<field name="average_daily_sale_root_location_id" />
|
||||
<field name="lot_stock_id" invisible="1" />
|
||||
<field
|
||||
name="average_daily_sale_root_location_id"
|
||||
attrs="{'required': [('lot_stock_id', '!=', False)]}"
|
||||
/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -26,6 +26,7 @@ class StockAverageDailySaleDemo(models.TransientModel):
|
||||
"product_id": product.id,
|
||||
"name": product.name,
|
||||
"location_id": suppliers.id,
|
||||
"warehouse_id": suppliers.warehouse_id.id,
|
||||
"location_dest_id": customers.id,
|
||||
"product_uom_qty": qty,
|
||||
}
|
||||
@@ -41,6 +42,7 @@ class StockAverageDailySaleDemo(models.TransientModel):
|
||||
"product_id": product.id,
|
||||
"name": product.name,
|
||||
"location_id": origin_location.id,
|
||||
"warehouse_id": origin_location.warehouse_id.id,
|
||||
"location_dest_id": customers.id,
|
||||
"product_uom_qty": qty,
|
||||
"priority": "1",
|
||||
|
||||
Reference in New Issue
Block a user