-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] product_template_year_consumption: move fields to correct module
- Loading branch information
Showing
12 changed files
with
85 additions
and
46 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
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
10 changes: 10 additions & 0 deletions
10
product_supplierinfo_usability/models/stock_warehouse_orderpoint.py
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 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class StockWarehouseOrderpoint(models.Model): | ||
_inherit = "stock.warehouse.orderpoint" | ||
|
||
supplier_pending_to_receive = fields.Float( | ||
string="Pending receipt from supplier", | ||
related="supplier_id.supplier_pending_to_receive", | ||
) |
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
27 changes: 27 additions & 0 deletions
27
product_supplierinfo_usability/views/stock_warehouse_orderpoint_views.xml
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,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="view_warehouse_orderpoint_tree_editable" model="ir.ui.view"> | ||
<field name="model">stock.warehouse.orderpoint</field> | ||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable" /> | ||
<field name="arch" type="xml"> | ||
<field name="route_id" position="after"> | ||
<field name="supplier_id" optional="show" /> | ||
<field name="supplier_pending_to_receive" optional="hide" /> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
<record id="view_warehouse_orderpoint_tree_editable_config" model="ir.ui.view"> | ||
<field name="model">stock.warehouse.orderpoint</field> | ||
<field | ||
name="inherit_id" | ||
ref="stock.view_warehouse_orderpoint_tree_editable_config" | ||
/> | ||
<field name="arch" type="xml"> | ||
<field name="route_id" position="after"> | ||
<field name="supplier_id" optional="show" /> | ||
<field name="supplier_pending_to_receive" optional="hide" /> | ||
</field> | ||
</field> | ||
</record> | ||
</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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import product_product | ||
from . import product_template | ||
from . import product_supplierinfo | ||
from . import stock_warehouse_orderpoint |
30 changes: 30 additions & 0 deletions
30
product_template_year_consumption/models/product_supplierinfo.py
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,30 @@ | ||
# Copyright 2022 Alfredo de la Fuente - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import fields, models | ||
|
||
|
||
class ProductSupplierInfo(models.Model): | ||
_inherit = "product.supplierinfo" | ||
|
||
consumed_last_twelve_months = fields.Float( | ||
string="Consumed last twelve months", | ||
digits="Product Unit of Measure", | ||
compute="_compute_months_qtys_quantities", | ||
) | ||
months_with_stock = fields.Integer( | ||
string="Months with stock", | ||
compute="_compute_months_qtys_quantities", | ||
) | ||
|
||
def _compute_months_qtys_quantities(self): | ||
for supplierinfo in self: | ||
supplierinfo.consumed_last_twelve_months = ( | ||
supplierinfo.product_id.consumed_last_twelve_months | ||
if supplierinfo.product_id | ||
else supplierinfo.product_tmpl_id.consumed_last_twelve_months | ||
) | ||
supplierinfo.months_with_stock = ( | ||
supplierinfo.product_id.months_with_stock | ||
if supplierinfo.product_id | ||
else supplierinfo.product_tmpl_id.months_with_stock | ||
) |
13 changes: 13 additions & 0 deletions
13
product_template_year_consumption/views/product_supplierinfo_views.xml
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="product_supplierinfo_tree_view" model="ir.ui.view"> | ||
<field name="model">product.supplierinfo</field> | ||
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="delay" position="after"> | ||
<field name="consumed_last_twelve_months" optional="show" /> | ||
<field name="months_with_stock" optional="show" /> | ||
</field> | ||
</field> | ||
</record> | ||
</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
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
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