[MIG] mrp_progress_button: Migration to 14.0

This commit is contained in:
Bernat Puig Font
2021-10-18 16:10:32 +02:00
committed by AaronHForgeFlow
parent 0dd628175c
commit 08623a9e4d
4 changed files with 24 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"category": "Manufacturing",
"version": "12.0.1.0.0",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"depends": ["mrp"],
"data": ["views/production.xml"],

View File

@@ -4,13 +4,12 @@
from datetime import datetime
from odoo import api, models
from odoo import models
class MrpProduction(models.Model):
_inherit = "mrp.production"
@api.multi
def action_progress(self):
self.write(
{

View File

@@ -56,15 +56,29 @@ class TestProgressButton(TransactionCase):
def _update_product_qty(self, product, location, quantity):
"""Update Product quantity."""
product_qty = self.env["stock.change.product.qty"].create(
inventory = self.env["stock.inventory"].create(
{
"name": "Test Inventory",
"product_ids": [(6, 0, product.ids)],
"state": "confirm",
"line_ids": [
(
0,
0,
{
"product_qty": quantity,
"location_id": location.id,
"product_id": product.id,
"new_quantity": quantity,
"product_uom_id": product.uom_id.id,
},
)
],
}
)
product_qty.change_product_qty()
return product_qty
inventory.action_start()
inventory.line_ids[0].write({"product_qty": quantity})
inventory.action_validate()
return quantity
def test_manufacture_with_forecast_stock(self):
"""

View File

@@ -5,10 +5,10 @@
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field name="arch" type="xml">
<button name="action_assign" position="after">
<button name="action_assign" position="before">
<button
name="action_progress"
attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('routing_id', '!=', False)]}"
attrs="{'invisible': [('state', '!=', 'confirmed')]}"
type="object"
string="Mark As Started"
class="oe_highlight"