[14.0][MIG]agreement_mrp: Travis

This commit is contained in:
Vimal Patel
2021-07-14 15:11:55 +05:30
committed by Murtaza Mithaiwala
parent 749f80c5b2
commit fda02894fa
7 changed files with 55 additions and 44 deletions

View File

@@ -2,26 +2,25 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Agreement - MRP', "name": "Agreement - MRP",
'summary': 'Link manufacturing orders to an agreement', "summary": "Link manufacturing orders to an agreement",
'version': '12.0.1.0.1', "version": "14.0.1.0.0",
'category': 'Contract', "category": "Contract",
'author': 'Open Source Integrators, ' "author": "Open Source Integrators, " "Odoo Community Association (OCA)",
'Odoo Community Association (OCA)', "website": "https://github.com/OCA/contract",
'website': 'https://github.com/OCA/contract', "depends": [
'depends': [ "agreement_serviceprofile",
'agreement_serviceprofile', "mrp",
'mrp',
], ],
'data': [ "data": [
'views/agreement_view.xml', "views/agreement_view.xml",
'views/mrp_view.xml', "views/mrp_view.xml",
], ],
'installable': True, "installable": True,
'license': 'AGPL-3', "license": "AGPL-3",
'development_status': 'Beta', "development_status": "Beta",
'maintainers': [ "maintainers": [
'smangukiya', "smangukiya",
'max3903', "max3903",
], ],
} }

View File

@@ -7,10 +7,11 @@ from odoo import api, fields, models
class Agreement(models.Model): class Agreement(models.Model):
_inherit = "agreement" _inherit = "agreement"
mo_count = fields.Integer('# MOs', compute='_compute_mo_count') mo_count = fields.Integer("# MOs", compute="_compute_mo_count")
@api.multi @api.multi
def _compute_mo_count(self): def _compute_mo_count(self):
for ag_rec in self: for ag_rec in self:
ag_rec.mo_count = self.env['mrp.production'].search_count( ag_rec.mo_count = self.env["mrp.production"].search_count(
[('agreement_id', 'in', ag_rec.ids)]) [("agreement_id", "in", ag_rec.ids)]
)

View File

@@ -7,6 +7,5 @@ from odoo import fields, models
class MRPProduction(models.Model): class MRPProduction(models.Model):
_inherit = "mrp.production" _inherit = "mrp.production"
agreement_id = fields.Many2one('agreement', 'Agreement') agreement_id = fields.Many2one("agreement", "Agreement")
serviceprofile_id = fields.Many2one('agreement.serviceprofile', serviceprofile_id = fields.Many2one("agreement.serviceprofile", "Service Profile")
'Service Profile')

View File

@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<record id="action_mrp_production_agreement_specific" <record id="action_mrp_production_agreement_specific" model="ir.actions.act_window">
model="ir.actions.act_window">
<field name="name">Manufacture Orders</field> <field name="name">Manufacture Orders</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field> <field name="res_model">mrp.production</field>
@@ -19,17 +18,18 @@
<record id="partner_agreement_form_view" model="ir.ui.view"> <record id="partner_agreement_form_view" model="ir.ui.view">
<field name="name">agreement.form.mrp</field> <field name="name">agreement.form.mrp</field>
<field name="model">agreement</field> <field name="model">agreement</field>
<field name="inherit_id" <field name="inherit_id" ref="agreement_legal.partner_agreement_form_view" />
ref="agreement_legal.partner_agreement_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside"> <xpath expr="//div[@name='button_box']" position="inside">
<button name="%(action_mrp_production_agreement_specific)d" <button
type="action" name="%(action_mrp_production_agreement_specific)d"
class="oe_stat_button" icon="fa-wrench"> type="action"
class="oe_stat_button"
icon="fa-wrench"
>
<div class="o_field_widget o_stat_info"> <div class="o_field_widget o_stat_info">
<span class="o_stat_value"> <span class="o_stat_value">
<field name="mo_count" widget="statinfo" <field name="mo_count" widget="statinfo" nolabel="1" />
nolabel="1"/>
</span> </span>
<span class="o_stat_text">MOs</span> <span class="o_stat_text">MOs</span>
</div> </div>

View File

@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<record id="mrp_production_form_view_agreement" model="ir.ui.view"> <record id="mrp_production_form_view_agreement" model="ir.ui.view">
<field name="name">mrp.production.form.agreement</field> <field name="name">mrp.production.form.agreement</field>
<field name="model">mrp.production</field> <field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/> <field name="inherit_id" ref="mrp.mrp_production_form_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='bom_id']" position="after"> <xpath expr="//field[@name='bom_id']" position="after">
<field name="agreement_id"/> <field name="agreement_id" />
<field name="serviceprofile_id" <field
domain="[('agreement_id', '=', agreement_id)]"/> name="serviceprofile_id"
domain="[('agreement_id', '=', agreement_id)]"
/>
</xpath> </xpath>
</field> </field>
</record> </record>
@@ -18,12 +20,15 @@
<record id="view_mrp_production_filter_agreement" model="ir.ui.view"> <record id="view_mrp_production_filter_agreement" model="ir.ui.view">
<field name="name">mrp.production.select.agreement</field> <field name="name">mrp.production.select.agreement</field>
<field name="model">mrp.production</field> <field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/> <field name="inherit_id" ref="mrp.view_mrp_production_filter" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//group" position="inside"> <xpath expr="//group" position="inside">
<filter string="Service Profile" name="serviceprofile_id" <filter
domain="[]" string="Service Profile"
context="{'group_by':'serviceprofile_id'}"/> name="serviceprofile_id"
domain="[]"
context="{'group_by':'serviceprofile_id'}"
/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -0,0 +1 @@
../../../../agreement_mrp

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)