[14.0][FIX] Travis.

This commit is contained in:
Chanakya Soni
2021-06-25 18:24:17 +05:30
committed by Patrick Wilson
parent c38cf46596
commit 149da0f03f
7 changed files with 90 additions and 75 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 - Stock', "name": "Agreement - Stock",
'summary': 'Link picking to an agreement', "summary": "Link picking 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', "stock",
'stock',
], ],
'data': [ "data": [
'views/agreement_view.xml', "views/agreement_view.xml",
'views/stock_view.xml', "views/stock_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,25 +7,27 @@ from odoo import api, fields, models
class Agreement(models.Model): class Agreement(models.Model):
_inherit = "agreement" _inherit = "agreement"
picking_count = fields.Integer('# Pickings', picking_count = fields.Integer("# Pickings", compute="_compute_picking_count")
compute='_compute_picking_count') move_count = fields.Integer("# Moves", compute="_compute_move_count")
move_count = fields.Integer('# Moves', compute='_compute_move_count') lot_count = fields.Integer("# Lots/Serials", compute="_compute_lot_count")
lot_count = fields.Integer('# Lots/Serials', compute='_compute_lot_count')
@api.multi @api.multi
def _compute_picking_count(self): def _compute_picking_count(self):
for ag_rec in self: for ag_rec in self:
ag_rec.picking_count = self.env['stock.picking'].search_count( ag_rec.picking_count = self.env["stock.picking"].search_count(
[('agreement_id', 'in', ag_rec.ids)]) [("agreement_id", "in", ag_rec.ids)]
)
@api.multi @api.multi
def _compute_move_count(self): def _compute_move_count(self):
for ag_rec in self: for ag_rec in self:
ag_rec.move_count = self.env['stock.move'].search_count( ag_rec.move_count = self.env["stock.move"].search_count(
[('agreement_id', 'in', ag_rec.ids)]) [("agreement_id", "in", ag_rec.ids)]
)
@api.multi @api.multi
def _compute_lot_count(self): def _compute_lot_count(self):
for ag_rec in self: for ag_rec in self:
ag_rec.lot_count = self.env['stock.production.lot'].search_count( ag_rec.lot_count = self.env["stock.production.lot"].search_count(
[('agreement_id', 'in', ag_rec.ids)]) [("agreement_id", "in", ag_rec.ids)]
)

View File

@@ -7,21 +7,19 @@ from odoo import fields, models
class StockPicking(models.Model): class StockPicking(models.Model):
_inherit = "stock.picking" _inherit = "stock.picking"
agreement_id = fields.Many2one('agreement', 'Agreement') agreement_id = fields.Many2one("agreement", "Agreement")
class StockMove(models.Model): class StockMove(models.Model):
_inherit = "stock.move" _inherit = "stock.move"
agreement_id = fields.Many2one('agreement', agreement_id = fields.Many2one(
related='picking_id.agreement_id', "agreement", related="picking_id.agreement_id", string="Agreement", store=True
string='Agreement', )
store=True)
class StockProductionLot(models.Model): class StockProductionLot(models.Model):
_inherit = "stock.production.lot" _inherit = "stock.production.lot"
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_stock_picking_agreement_specific" <record id="action_stock_picking_agreement_specific" model="ir.actions.act_window">
model="ir.actions.act_window">
<field name="name">Pickings</field> <field name="name">Pickings</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">stock.picking</field> <field name="res_model">stock.picking</field>
@@ -16,8 +15,7 @@
</p> </p>
</field> </field>
</record> </record>
<record id="action_stock_move_agreement_specific" <record id="action_stock_move_agreement_specific" model="ir.actions.act_window">
model="ir.actions.act_window">
<field name="name">Moves</field> <field name="name">Moves</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">stock.move</field> <field name="res_model">stock.move</field>
@@ -31,8 +29,10 @@
</p> </p>
</field> </field>
</record> </record>
<record id="action_stock_production_lot_agreement_specific" <record
model="ir.actions.act_window"> id="action_stock_production_lot_agreement_specific"
model="ir.actions.act_window"
>
<field name="name">Lots/Serials</field> <field name="name">Lots/Serials</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">stock.production.lot</field> <field name="res_model">stock.production.lot</field>
@@ -50,39 +50,44 @@
<record id="partner_agreement_form_view_stock" model="ir.ui.view"> <record id="partner_agreement_form_view_stock" model="ir.ui.view">
<field name="name">agreement.form.stock</field> <field name="name">agreement.form.stock</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_stock_picking_agreement_specific)d" <button
name="%(action_stock_picking_agreement_specific)d"
type="action" type="action"
class="oe_stat_button" icon="fa-truck"> class="oe_stat_button"
icon="fa-truck"
>
<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="picking_count" widget="statinfo" <field name="picking_count" widget="statinfo" nolabel="1" />
nolabel="1"/>
</span> </span>
<span class="o_stat_text">Pickings</span> <span class="o_stat_text">Pickings</span>
</div> </div>
</button> </button>
<button name="%(action_stock_move_agreement_specific)d" <button
name="%(action_stock_move_agreement_specific)d"
type="action" type="action"
class="oe_stat_button" icon="fa-arrows-v"> class="oe_stat_button"
icon="fa-arrows-v"
>
<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="move_count" widget="statinfo" <field name="move_count" widget="statinfo" nolabel="1" />
nolabel="1"/>
</span> </span>
<span class="o_stat_text">Moves</span> <span class="o_stat_text">Moves</span>
</div> </div>
</button> </button>
<button name="%(action_stock_production_lot_agreement_specific)d" <button
name="%(action_stock_production_lot_agreement_specific)d"
type="action" type="action"
class="oe_stat_button" icon="fa-arrows"> class="oe_stat_button"
icon="fa-arrows"
>
<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="lot_count" widget="statinfo" <field name="lot_count" widget="statinfo" nolabel="1" />
nolabel="1"/>
</span> </span>
<span class="o_stat_text">Lots/Serials</span> <span class="o_stat_text">Lots/Serials</span>
</div> </div>

View File

@@ -7,8 +7,7 @@
<field name="inherit_id" ref="stock.view_picking_form" /> <field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="origin" position="before"> <field name="origin" position="before">
<field name="agreement_id" <field name="agreement_id" domain="[('partner_id', '=', partner_id)]" />
domain="[('partner_id', '=', partner_id)]"/>
</field> </field>
</field> </field>
</record> </record>
@@ -32,8 +31,10 @@
<xpath expr="//group[@name='main_group']" position="inside"> <xpath expr="//group[@name='main_group']" position="inside">
<group> <group>
<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)]"
/>
</group> </group>
</xpath> </xpath>
</field> </field>
@@ -46,9 +47,12 @@
<field name="inherit_id" ref="stock.search_product_lot_filter" /> <field name="inherit_id" ref="stock.search_product_lot_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
string="Service Profile"
name="serviceprofile_id"
domain="[]" domain="[]"
context="{'group_by':'serviceprofile_id'}"/> context="{'group_by':'serviceprofile_id'}"
/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

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

View File

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