[14.0][MIG]agreement_mrp: migrated to v14

This commit is contained in:
Vimal Patel
2021-07-14 18:26:02 +05:30
committed by Murtaza Mithaiwala
parent fda02894fa
commit cdb08f844f
9 changed files with 53 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import (

View File

@@ -1,7 +1,7 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo import fields, models
class Agreement(models.Model):
@@ -9,7 +9,6 @@ class Agreement(models.Model):
mo_count = fields.Integer("# MOs", compute="_compute_mo_count")
@api.multi
def _compute_mo_count(self):
for ag_rec in self:
ag_rec.mo_count = self.env["mrp.production"].search_count(

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2018 - TODAY, Open Source Integrators
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models

View File

@@ -0,0 +1,3 @@
# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html).
from . import test_agreement_mrp

View File

@@ -0,0 +1,44 @@
# Copyright (C) 2021 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import odoo.tests.common as common
from odoo import fields
class TestAgreementMrp(common.TransactionCase):
def setUp(self):
super(TestAgreementMrp, self).setUp()
self.agreement_obj = self.env["agreement"]
self.mrp_production_obj = self.env["mrp.production"]
self.agreement_type_id = self.env["agreement.type"].create(
{"name": "Test Agreement Type", "active": True}
)
self.product = self.env.ref(
"mrp.product_product_computer_desk_bolt_product_template"
)
def test_fieldservice_purchase(self):
agreement_vals = {
"name": "Test Agreement",
"agreement_type_id": self.agreement_type_id.id,
"description": "Test Agreement",
"start_date": fields.Date.today(),
"end_date": fields.Date.today(),
}
agreement = self.agreement_obj.create(agreement_vals)
mrp_production_vals = {
"product_id": self.product.product_variant_id.id,
"agreement_id": agreement.id,
"product_uom_id": self.product.uom_id.id,
}
mrp_production_new = self.mrp_production_obj.new(mrp_production_vals)
mrp_production_vals.update(
mrp_production_new.default_get(mrp_production_new._fields)
)
self.mrp_production_obj.create(mrp_production_vals)
agreement._compute_mo_count()
self.assertEqual(agreement.mo_count, 1, "Wrong no of MO's!")

View File

@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="action_mrp_production_agreement_specific" model="ir.actions.act_window">
<field name="name">Manufacture Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="help" type="html">

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="mrp_production_form_view_agreement" model="ir.ui.view">