[IMP] mrp_multi_level: Show supply method on mrp inventory

This commit is contained in:
hveficent
2020-01-31 13:11:20 +01:00
parent 15bf2a3d9b
commit 9c30e585c8
4 changed files with 37 additions and 10 deletions

View File

@@ -67,6 +67,12 @@ class MrpInventory(models.Model):
inverse_name="mrp_inventory_id",
readonly=True,
)
supply_method = fields.Selection(
string="Supply Method",
related="product_mrp_area_id.supply_method",
readonly=True,
store=True,
)
@api.multi
def _compute_uom_id(self):

View File

@@ -14,6 +14,7 @@
<field name="company_id" groups="base.group_multi_company"/>
<field name="product_id"/>
<field name="product_mrp_area_id"/>
<field name="supply_method"/>
<field name="date"/>
</group>
<group>
@@ -51,6 +52,7 @@
name="%(mrp_multi_level.act_mrp_inventory_procure)d"
icon="fa-cogs" type="action"
attrs="{'invisible':[('to_procure','&lt;=',0.0)]}"/>
<field name="supply_method"/>
<field name="running_availability"/>
</tree>
</field>
@@ -103,6 +105,9 @@
<filter name="group_mrp_area"
string="MRP Area"
context="{'group_by':'mrp_area_id'}"/>
<filter name="group_supply_method"
string="Supply Method"
context="{'group_by':'supply_method'}"/>
<filter name="group_release_date_day"
string="Date to Procure (By Day)"
context="{'group_by':'order_release_date:day'}"/>

View File

@@ -19,16 +19,16 @@ class MrpInventoryProcure(models.TransientModel):
@api.model
def _prepare_item(self, planned_order):
return {
'planned_order_id': planned_order.id,
'qty': planned_order.mrp_qty - planned_order.qty_released,
'uom_id': planned_order.mrp_inventory_id.uom_id.id,
'date_planned': planned_order.due_date,
'mrp_inventory_id': planned_order.mrp_inventory_id.id,
'product_id': planned_order.product_id.id,
'warehouse_id': planned_order.mrp_area_id.warehouse_id.id,
'location_id':
planned_order.product_mrp_area_id.location_proc_id.id or
planned_order.mrp_area_id.location_id.id,
"planned_order_id": planned_order.id,
"qty": planned_order.mrp_qty - planned_order.qty_released,
"uom_id": planned_order.mrp_inventory_id.uom_id.id,
"date_planned": planned_order.due_date,
"mrp_inventory_id": planned_order.mrp_inventory_id.id,
"product_id": planned_order.product_id.id,
"warehouse_id": planned_order.mrp_area_id.warehouse_id.id,
"location_id": planned_order.product_mrp_area_id.location_proc_id.id
or planned_order.mrp_area_id.location_id.id,
"supply_method": planned_order.product_mrp_area_id.supply_method,
}
@api.model
@@ -126,6 +126,21 @@ class MrpInventoryProcureItem(models.TransientModel):
string='Location',
comodel_name='stock.location',
)
planned_order_id = fields.Many2one(comodel_name="mrp.planned.order")
product_id = fields.Many2one(string="Product", comodel_name="product.product")
warehouse_id = fields.Many2one(string="Warehouse", comodel_name="stock.warehouse")
location_id = fields.Many2one(string="Location", comodel_name="stock.location")
supply_method = fields.Selection(
string="Supply Method",
selection=[
("buy", "Buy"),
("none", "Undefined"),
("manufacture", "Produce"),
("pull", "Pull From"),
("push", "Push To"),
("pull_push", "Pull & Push"),
],
)
def _prepare_procurement_values(self, group=False):
return {

View File

@@ -23,6 +23,7 @@
<field name="qty"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="date_planned"/>
<field name="supply_method"/>
</tree>
</field>
</group>