forked from OCA/sale-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40e3219
commit 12f7a1e
Showing
9 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2024 Therp BV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Sale Forecast", | ||
"summary": "Sale forecast report", | ||
"version": "16.0.1.0.0", | ||
"category": "Generic Modules/Sale", | ||
"author": "Therp BV, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/sale-workflow", | ||
"depends": ["sale", "stock_demand_estimate", "stock_demand_estimate_matrix"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"views/date_range.xml", | ||
"views/sale_forecast.xml", | ||
], | ||
"license": "AGPL-3", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import sale_forecast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class SaleForecast(models.Model): | ||
_name = "sale.forecast" | ||
_inherits = {"stock.demand.estimate": "stock_demand_id"} | ||
_description = "Sale forecast" | ||
|
||
stock_demand_id = fields.Many2one( | ||
comodel_name="stock.demand.estimate", required=True, ondelete="cascade" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_sale_forecast,sale.forcast,model_sale_forecast,stock.group_stock_user,1,0,0,0 | ||
access_sale_forecast_system,sale.forecast.system,model_sale_forecast,stock.group_stock_manager,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<menuitem | ||
id="date_range_menu" | ||
name="Date Ranges" | ||
parent="sale.menu_sale_config" | ||
action="date_range.date_range_action" | ||
sequence="99" | ||
/> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<record id="sale_forecast_view_tree" model="ir.ui.view"> | ||
<field name="name">sale.forecast.tree</field> | ||
<field name="model">sale.forecast</field> | ||
<field name="arch" type="xml"> | ||
<tree edit="1" editable="bottom"> | ||
<field name="date_range_id" /> | ||
<field name="date_from" string="Date From" /> | ||
<field name="date_to" string="Date To" /> | ||
<field name="product_id" /> | ||
<field name="location_id" /> | ||
<field name="product_uom_qty" /> | ||
<field name="product_uom" /> | ||
<field name="product_qty" /> | ||
<field name="daily_qty" /> | ||
</tree> | ||
</field> | ||
</record> | ||
<record id="sale_forecast_view_form" model="ir.ui.view"> | ||
<field name="name">sale.forecast.form</field> | ||
<field name="model">sale.forecast</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<sheet> | ||
<group> | ||
<group name="dates_read" class="oe_read_only"> | ||
<field name="date_from" string="Date From" /> | ||
<field name="date_to" string="Date To" /> | ||
<field name="duration" string="Duration" /> | ||
</group> | ||
<group name="dates_edit" class="oe_edit_only"> | ||
<field name="manual_date_from" string="Date From" /> | ||
<field name="manual_date_to" string="Date To" /> | ||
<field name="manual_duration" string="Duration" /> | ||
</group> | ||
<group> | ||
<field name="product_id" /> | ||
<field name="location_id" /> | ||
<field name="product_uom_qty" /> | ||
<field name="product_uom" /> | ||
<field name="daily_qty" /> | ||
</group> | ||
</group> | ||
</sheet> | ||
</form> | ||
</field> | ||
</record> | ||
<record id="sale_forecast_view_pivot" model="ir.ui.view"> | ||
<field name="name">sale.forecast.pivot</field> | ||
<field name="model">sale.forecast</field> | ||
<field name="arch" type="xml"> | ||
<pivot string="Sale Forecast"> | ||
<field name="product_qty" type="measure" /> | ||
<field name="product_id" type="row" /> | ||
<field name="date_range_id" type="col" /> | ||
<field name="date_from" type="col" /> | ||
</pivot> | ||
</field> | ||
</record> | ||
|
||
<record id="sale_forecast_view_graph" model="ir.ui.view"> | ||
<field name="name">sale.forecast.graph</field> | ||
<field name="model">sale.forecast</field> | ||
<field name="arch" type="xml"> | ||
<graph type="bar" stacked="True"> | ||
<field name="product_qty" type="measure" /> | ||
<field name="date_from" /> | ||
<field name="product_id" /> | ||
</graph> | ||
</field> | ||
</record> | ||
|
||
<record id="sale_forecast_view_search" model="ir.ui.view"> | ||
<field name="name">sale.forecast.search</field> | ||
<field name="model">sale.forecast</field> | ||
<field name="arch" type="xml"> | ||
<search string="Search Sale Forecast"> | ||
<field name="product_id" /> | ||
<field name="location_id" /> | ||
<field name="date_range_id" /> | ||
<separator /> | ||
<filter | ||
name="expired" | ||
string="Expired" | ||
domain="[('date_to', '<', context_today().strftime('%Y-%m-%d'))]" | ||
/> | ||
<filter | ||
name="not_expired" | ||
string="Not Expired" | ||
domain="['|', ('date_to', '=', False), ('date_to', '>', context_today().strftime('%Y-%m-%d'))]" | ||
/> | ||
<separator /> | ||
<group expand="0" string="Group By"> | ||
<filter | ||
string="Product" | ||
name="groupby_product" | ||
domain="[]" | ||
context="{'group_by':'product_id'}" | ||
/> | ||
<filter | ||
string="Location" | ||
name="groupby_location" | ||
domain="[]" | ||
context="{'group_by':'location_id'}" | ||
/> | ||
<filter | ||
string="Date (From)" | ||
name="groupby_date_from" | ||
domain="[]" | ||
context="{'group_by':'date_from'}" | ||
/> | ||
</group> | ||
</search> | ||
</field> | ||
</record> | ||
<record id="sale_forecast_action" model="ir.actions.act_window"> | ||
<field name="name">Sale Forecast</field> | ||
<field name="type">ir.actions.act_window</field> | ||
<field name="res_model">sale.forecast</field> | ||
<field name="view_mode">tree,form,pivot,graph</field> | ||
<field name="search_view_id" ref="sale_forecast_view_search" /> | ||
<field name="context">{"search_default_not_expired": 1}</field> | ||
</record> | ||
<menuitem | ||
id="sale_forecast_menu" | ||
name="Forecast" | ||
parent="sale.sale_menu_root" | ||
action="sale_forecast_action" | ||
sequence="10" | ||
/> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../sale_forecast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |