mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[14.0][MIG] agreement_stock.
[MIG] Pre-Commit [MIG] Flake
This commit is contained in:
committed by
Patrick Wilson
parent
149da0f03f
commit
69e7df0308
@@ -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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import models
|
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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -8,19 +8,10 @@
|
|||||||
"category": "Contract",
|
"category": "Contract",
|
||||||
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
|
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/contract",
|
"website": "https://github.com/OCA/contract",
|
||||||
"depends": [
|
"depends": ["agreement_serviceprofile", "stock"],
|
||||||
"agreement_serviceprofile",
|
"data": ["views/agreement_view.xml", "views/stock_view.xml"],
|
||||||
"stock",
|
|
||||||
],
|
|
||||||
"data": [
|
|
||||||
"views/agreement_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", "max3903"],
|
||||||
"smangukiya",
|
|
||||||
"max3903",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 11.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2019-01-11 17:41+0000\n"
|
"PO-Revision-Date: 2019-01-11 17:41+0000\n"
|
||||||
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
|
"Last-Translator: Maria Sparenberg <maria.sparenberg@gmx.net>\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"Last-Translator: Automatically generated\n"
|
||||||
"Language-Team: none\n"
|
"Language-Team: none\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2021-01-04 11:44+0000\n"
|
"PO-Revision-Date: 2021-01-04 11:44+0000\n"
|
||||||
"Last-Translator: Rémi <remi@le-filament.com>\n"
|
"Last-Translator: Rémi <remi@le-filament.com>\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"Last-Translator: Automatically generated\n"
|
||||||
"Language-Team: none\n"
|
"Language-Team: none\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2020-02-18 01:13+0000\n"
|
"PO-Revision-Date: 2020-02-18 01:13+0000\n"
|
||||||
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
|
"Last-Translator: Pedro Castro Silva <pedrocs@exo.pt>\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2020-06-16 22:19+0000\n"
|
"PO-Revision-Date: 2020-06-16 22:19+0000\n"
|
||||||
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"
|
"Last-Translator: Fernando Colus <fcolus1@gmail.com>\n"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 12.0\n"
|
"Project-Id-Version: Odoo Server 14.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"PO-Revision-Date: 2019-09-04 18:23+0000\n"
|
"PO-Revision-Date: 2019-09-04 18:23+0000\n"
|
||||||
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
|
"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
|
||||||
|
|||||||
@@ -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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import (
|
from . import stock
|
||||||
stock,
|
from . import agreement
|
||||||
agreement,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -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).
|
# 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):
|
class Agreement(models.Model):
|
||||||
@@ -11,21 +11,18 @@ class Agreement(models.Model):
|
|||||||
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
|
|
||||||
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
|
|
||||||
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
|
|
||||||
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(
|
||||||
|
|||||||
@@ -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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import fields, models
|
from odoo import fields, models
|
||||||
|
|||||||
4
agreement_stock/tests/__init__.py
Normal file
4
agreement_stock/tests/__init__.py
Normal 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
|
||||||
50
agreement_stock/tests/test_stock_agreement.py
Normal file
50
agreement_stock/tests/test_stock_agreement.py
Normal 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
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
<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>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
||||||
<field name="context">{'create': False, 'edit': False}</field>
|
<field name="context">{'create': False, 'edit': False}</field>
|
||||||
@@ -19,7 +18,6 @@
|
|||||||
<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>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
||||||
<field name="context">{'create': False, 'edit': False}</field>
|
<field name="context">{'create': False, 'edit': False}</field>
|
||||||
@@ -36,7 +34,6 @@
|
|||||||
<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>
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">tree,form</field>
|
<field name="view_mode">tree,form</field>
|
||||||
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
<field name="domain">[('agreement_id', '=', active_id)]</field>
|
||||||
<field name="context">{'create': False, 'edit': False}</field>
|
<field name="context">{'create': False, 'edit': False}</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user