[14.0][MIG] agreement_stock.

[MIG] Pre-Commit

[MIG] Flake
This commit is contained in:
Chanakya Soni
2021-06-25 18:28:20 +05:30
committed by Patrick Wilson
parent 149da0f03f
commit 69e7df0308
16 changed files with 73 additions and 36 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).
{
@@ -8,19 +8,10 @@
"category": "Contract",
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/contract",
"depends": [
"agreement_serviceprofile",
"stock",
],
"data": [
"views/agreement_view.xml",
"views/stock_view.xml",
],
"depends": ["agreement_serviceprofile", "stock"],
"data": ["views/agreement_view.xml", "views/stock_view.xml"],
"installable": True,
"license": "AGPL-3",
"development_status": "Beta",
"maintainers": [
"smangukiya",
"max3903",
],
"maintainers": ["smangukiya", "max3903"],
}

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-01-11 17:41+0000\n"
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-01-04 11:44+0000\n"
"Last-Translator: Rémi <remi@le-filament.com>\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-02-18 01:13+0000\n"
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-06-16 22:19+0000\n"
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2019-09-04 18:23+0000\n"
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"

View File

@@ -1,7 +1,5 @@
# 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 (
stock,
agreement,
)
from . import stock
from . import agreement

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):
@@ -11,21 +11,18 @@ class Agreement(models.Model):
move_count = fields.Integer("# Moves", compute="_compute_move_count")
lot_count = fields.Integer("# Lots/Serials", compute="_compute_lot_count")
@api.multi
def _compute_picking_count(self):
for ag_rec in self:
ag_rec.picking_count = self.env["stock.picking"].search_count(
[("agreement_id", "in", ag_rec.ids)]
)
@api.multi
def _compute_move_count(self):
for ag_rec in self:
ag_rec.move_count = self.env["stock.move"].search_count(
[("agreement_id", "in", ag_rec.ids)]
)
@api.multi
def _compute_lot_count(self):
for ag_rec in self:
ag_rec.lot_count = self.env["stock.production.lot"].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,4 @@
# Copyright (C) 2021 Open Source Integrators
# Copyright (C) 2021 Serpent Consulting Services
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_stock_agreement

View File

@@ -0,0 +1,50 @@
# Copyright (C) 2021 Open Source Integrators
# Copyright (C) 2021 Serpent Consulting Services
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestStockAgreement(common.TransactionCase):
def test_stockagreement(self):
agreement_1 = self._create_agreement()
partner_1 = self.env["res.partner"].create({"name": "TestPartner1"})
product_1 = self.env["product.product"].search(
[("type", "=", "product")], limit=1
)
picking_1 = self.env["stock.picking"].create(
{
"partner_id": partner_1.id,
"picking_type_id": self.env.ref("stock.picking_type_out").id,
"location_id": self.env.ref("stock.stock_location_stock").id,
"location_dest_id": self.env.ref("stock.stock_location_customers").id,
"agreement_id": agreement_1.id,
}
)
self.env["stock.move"].create(
{
"product_id": product_1.id,
"name": product_1.partner_ref,
"product_uom_qty": 5,
"quantity_done": 5,
"picking_id": picking_1.id,
"product_uom": product_1.uom_id.id,
"location_id": picking_1.location_id.id,
"location_dest_id": picking_1.location_dest_id.id,
}
)
agreement_1._compute_picking_count()
agreement_1._compute_move_count()
agreement_1._compute_lot_count()
self.assertEqual(agreement_1.picking_count, 1)
self.assertEqual(agreement_1.move_count, 1)
self.assertEqual(agreement_1.lot_count, 0)
def _create_agreement(self):
agreement = self.env["agreement"].create(
{
"code": "DA",
"name": "Demo Agreement",
}
)
return agreement

View File

@@ -5,7 +5,6 @@
<field name="name">Pickings</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.picking</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>
@@ -19,7 +18,6 @@
<field name="name">Moves</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>
@@ -36,7 +34,6 @@
<field name="name">Lots/Serials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.production.lot</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>