mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][MIG]agreement_mrp: migrated to v14
This commit is contained in:
committed by
Murtaza Mithaiwala
parent
fda02894fa
commit
cdb08f844f
@@ -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
|
||||
|
||||
@@ -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).
|
||||
|
||||
{
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
3
agreement_mrp/tests/__init__.py
Normal file
3
agreement_mrp/tests/__init__.py
Normal 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
|
||||
44
agreement_mrp/tests/test_agreement_mrp.py
Normal file
44
agreement_mrp/tests/test_agreement_mrp.py
Normal 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!")
|
||||
@@ -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">
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="mrp_production_form_view_agreement" model="ir.ui.view">
|
||||
|
||||
Reference in New Issue
Block a user