OCA / purchase-workflow

Odoo Purchases, Workflow and Organization
GNU Affero General Public License v3.0
203 stars 786 forks source link

Error If PO Has Section Headers #1039

Closed woom-USA closed 3 years ago

woom-USA commented 3 years ago

module: purchase_delivery_split_date version: 13.0

*** Use Case: PO has one SKU shipped in multiple containers. Each container has a different Scheduled Arrival Date

Steps to reproduce Create a RFQ with 2 lines of the Same SKU With different Scheduled Dates. When you confirm the RFQ, the error given below is generated RFQ Screenshot

Current behavior Error: Error: Odoo Server Error

Traceback (most recent call last): File "/home/odoo/src/odoo/odoo/http.py", line 624, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/home/odoo/src/odoo/odoo/http.py", line 310, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 14, in reraise raise value File "/home/odoo/src/odoo/odoo/http.py", line 669, in dispatch result = self._call_function(self.params) File "/home/odoo/src/odoo/odoo/http.py", line 350, in _call_function return checked_call(self.db, *args, *kwargs) File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper return f(dbname, args, kwargs) File "/home/odoo/src/odoo/odoo/http.py", line 339, in checked_call result = self.endpoint(*a, kw) File "/home/odoo/src/odoo/odoo/http.py", line 915, in call return self.method(*args, *kw) File "/home/odoo/src/odoo/odoo/http.py", line 515, in response_wrap response = f(args, kw) File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1331, in call_button action = self._call_kw(model, method, args, kwargs) File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1319, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/home/odoo/src/odoo/odoo/api.py", line 387, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/home/odoo/src/odoo/odoo/api.py", line 374, in _call_kw_multi result = method(recs, *args, **kwargs) File "/home/odoo/src/odoo/addons/purchase/models/purchase.py", line 361, in button_confirm order.button_approve() File "/home/odoo/src/user/wbus/wbus_purchase/models/purchase.py", line 10, in button_approve res = super(PurchaseOrder, self).button_approve(force=force) File "/home/odoo/src/odoo/addons/purchase_stock/models/purchase.py", line 89, in button_approve self._create_picking() File "/home/odoo/src/odoo/addons/purchase_stock/models/purchase.py", line 220, in _create_picking moves = order.order_line._create_stock_moves(picking) File "/home/odoo/src/user/purchase_delivery_split_date/models/purchase.py", line 40, in _create_stock_moves order_lines = sorted(self, key=lambda l: l.date_planned) TypeError: '<' not supported between instances of 'datetime.datetime' and 'bool'

Expected behavior 2 Planned Receipts one for each scheduled date

woom-USA commented 3 years ago

Apologies, The error occurs when Section Headers are added and not if the Same SKU gets listed multiple times in the PO