Skip to content

Commit

Permalink
[MIG] purchase_invoice_plan: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 committed Sep 15, 2023
1 parent 8a54a5f commit cc4bc77
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion purchase_invoice_plan/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Purchase Invoice Plan",
"summary": "Add to purchases order, ability to manage future invoice plan",
"version": "15.0.1.0.2",
"version": "16.0.1.0.0",
"author": "Ecosoft,Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/purchase-workflow",
Expand Down
2 changes: 0 additions & 2 deletions purchase_invoice_plan/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,6 @@ def _compute_new_invoice_quantity(self, invoice_move):
move = invoice_move.with_context(**{"check_move_validity": False})
for line in move.invoice_line_ids:
self._update_new_quantity(line, percent)
move.line_ids.filtered("exclude_from_invoice_tab").unlink()
move._move_autocomplete_invoice_lines_values() # recompute dr/cr

def _update_new_quantity(self, line, percent):
"""Hook function"""
Expand Down
35 changes: 18 additions & 17 deletions purchase_invoice_plan/tests/test_purchase_invoice_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,52 +9,53 @@


class TestPurchaseInvoicePlan(TransactionCase):
def setUp(self):
super(TestPurchaseInvoicePlan, self).setUp()
@classmethod
def setUpClass(cls):
super().setUpClass()
# Create a PO
self.PurchaseOrder = self.env["purchase.order"]
self.PurchaseInvoicePlan = self.env["purchase.create.invoice.plan"]
self.StockBackorderConfirm = self.env["stock.backorder.confirmation"]
self.StockPicking = self.env["stock.picking"]
cls.PurchaseOrder = cls.env["purchase.order"]
cls.PurchaseInvoicePlan = cls.env["purchase.create.invoice.plan"]
cls.StockBackorderConfirm = cls.env["stock.backorder.confirmation"]
cls.StockPicking = cls.env["stock.picking"]

self.test_partner = self.env.ref("base.res_partner_12")
self.test_service = self.env.ref("product.product_product_2")
self.test_product = self.env.ref("product.product_product_7")
cls.test_partner = cls.env.ref("base.res_partner_12")
cls.test_service = cls.env.ref("product.product_product_2")
cls.test_product = cls.env.ref("product.product_product_7")

self.test_po_service = self.env["purchase.order"].create(
cls.test_po_service = cls.env["purchase.order"].create(
{
"partner_id": self.test_partner.id,
"partner_id": cls.test_partner.id,
"use_invoice_plan": True,
"order_line": [
(
0,
0,
{
"name": "PO-Service",
"product_id": self.test_service.id,
"product_id": cls.test_service.id,
"date_planned": fields.Datetime.now(),
"product_qty": 1,
"product_uom": self.test_service.uom_id.id,
"product_uom": cls.test_service.uom_id.id,
"price_unit": 500,
},
)
],
}
)
self.test_po_product = self.env["purchase.order"].create(
cls.test_po_product = cls.env["purchase.order"].create(
{
"partner_id": self.test_partner.id,
"partner_id": cls.test_partner.id,
"use_invoice_plan": True,
"order_line": [
(
0,
0,
{
"name": "PO-Product",
"product_id": self.test_product.id,
"product_id": cls.test_product.id,
"date_planned": fields.Datetime.now(),
"product_qty": 10,
"product_uom": self.test_product.uom_id.id,
"product_uom": cls.test_product.uom_id.id,
"price_unit": 1000,
},
)
Expand Down

0 comments on commit cc4bc77

Please sign in to comment.