Skip to content

Commit

Permalink
[16.0][MIG] purchase_delivery_split_date: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoRomera committed Feb 8, 2023
1 parent 7e249c7 commit 3bc85c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion purchase_delivery_split_date/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Purchase Delivery Split Date",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"summary": "Allows Purchase Order you confirm to generate one Incoming "
"Shipment for each expected date indicated in the Purchase Order Lines",
"author": "Numerigraphe, ForgeFlow, Camptocamp, Odoo Community Association (OCA)",
Expand Down
4 changes: 2 additions & 2 deletions purchase_delivery_split_date/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _first_picking_copy_vals(self, key, lines):
"""The data to be copied to new pickings is updated with data from the
grouping key. This method is designed for extensibility, so that
other modules can store more data based on new keys."""
vals = {"move_lines": []}
vals = {"move_ids": []}
for key_element in key:
if "date_planned" in key_element.keys():
vals["scheduled_date"] = key_element["date_planned"]
Expand Down Expand Up @@ -137,7 +137,7 @@ def _check_split_pickings(self):
move.date_deadline = date_key
move._action_assign()
for picking in pickings:
if len(picking.move_lines) == 0:
if len(picking.move_ids) == 0:
picking.write({"state": "cancel"})


Expand Down
12 changes: 10 additions & 2 deletions purchase_delivery_split_date/tests/test_purchase_delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# Copyright 2017 ForgeFlow, S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase
from odoo.tests.common import Form, TransactionCase


class TestDeliverySingle(TransactionCase):
def setUp(self):
super(TestDeliverySingle, self).setUp()
super().setUp()
self.product_model = self.env["product.product"]

# Create products:
Expand Down Expand Up @@ -242,3 +242,11 @@ def test_purchase_line_date_change_tz_aware(self):
# No time difference so will be another day (2 pickings)
line2.write({"date_planned": "2021-05-04 23:00:00"})
self.assertEqual(len(self.po.picking_ids), 2)

def test_create_from_form(self):
partner_purchase = self.env["res.partner"].create(
{"name": "Partner 1 of purchase on create from form"}
)
with Form(self.env["purchase.order"]) as purchase_form:
purchase_form.partner_id = partner_purchase
self.assertEqual(purchase_form.partner_id, partner_purchase)

0 comments on commit 3bc85c3

Please sign in to comment.