(self, order_id=None, access_token=None, **kw)
return Response(status=204)
User update scheduled date on purchase order line.
User update scheduled date on purchase order line.
User update scheduled date on purchase order line .
def portal_my_purchase_order_update_dates(self, order_id=None, access_token=None, **kw):
        """User update scheduled date on purchase order line.
        """
        try:
            order_sudo = self._document_check_access('purchase.order', order_id, access_token=access_token)
        except (AccessError, MissingError):
            return request.redirect('/my')

        updated_dates = []
        for id_str, date_str in kw.items():
            try:
                line_id = int(id_str)
            except ValueError:
                return request.redirect(order_sudo.get_portal_url())
            line = order_sudo.order_line.filtered(lambda l: l.id == line_id)
            if not line:
                return request.redirect(order_sudo.get_portal_url())

            try:
                updated_date = line._convert_to_middle_of_day(datetime.strptime(date_str, '%Y-%m-%d'))
            except ValueError:
                continue

            updated_dates.append((line, updated_date))

        if updated_dates:
            order_sudo._update_date_planned_for_lines(updated_dates)
        return Response(status=204)
def portal_my_purchase_order_update_dates ( self , order_id = None , access_token = None , * * kw ) : try : order_sudo = self . _document_check_access ( 'purchase.order' , order_id , access_token = access_token ) except ( AccessError , MissingError ) : return request . redirect ( '/my' ) updated_dates = [ ] for id_str , date_str in kw . items ( ) : try : line_id = int ( id_str ) except ValueError : return request . redirect ( order_sudo . get_portal_url ( ) ) line = order_sudo . order_line . filtered ( lambda l : l . id == line_id ) if not line : return request . redirect ( order_sudo . get_portal_url ( ) ) try : updated_date = line . _convert_to_middle_of_day ( datetime . strptime ( date_str , '%Y-%m-%d' ) ) except ValueError : continue updated_dates . append ( ( line , updated_date ) ) if updated_dates : order_sudo . _update_date_planned_for_lines ( updated_dates ) return Response ( status = 204 )