question

javichaques avatar image
javichaques asked javichaques commented

Create order with customer with an associated client

Hi,

I'm trying to create an order with a client associated with opening the registry application.
My code sometimes it works and sometimes it does not.

The steps I follow are:
  • Once I have the client, I create the order and assign the client to it:
Order order = orderConnector.createOrder(new Order());
order.setCustomers(Collections.singletonList(customer));
order = orderConnector.updateOrder(order);
  • Then I launch the registry application with these data:
Intent intent = new Intent(Intents.ACTION_START_REGISTER);
intent.putExtra(Intents.EXTRA_ORDER_ID, order.getId());
startActivity(intent);

I'm testing with the emulator, with Android 7,

What am I doing wrong?

There is the possibility of opening the registry without creating an order, but if you create one that is associated with a client?

Thanks
OrdersClover Android SDKCustomers
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image
Jeffrey Blattman answered javichaques commented
Yes I think I see the bug. Register saves the order ID as instance data. So if you start Register say after a fresh boot passing the order ID it should work. But if Register had previously saved instance state, it's going to restore that in favor on the value in the starting intent.

I'll file an internal issue for us to fix this. I cannot provide an ETA as to when it will be fixed.
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

javichaques avatar image javichaques commented ·

Hi @Jeffrey Blattman, ¿Is there any news?

0 Likes 0 ·
javichaques avatar image
javichaques answered Jeffrey Blattman edited
Hi @Jeffrey Blattman

Thanks for your quick response! I look forward the fix

About the other question:
There is the possibility of opening the registry without creating an order, but if you create one that is associated with a client?

Thanks
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeffrey Blattman avatar image Jeffrey Blattman ♦♦ commented ·

I responded in the other thread that you should create the order, add the customer to the order, then ask register to open that order ID. Register always creates an order actually. The system hides orders that have no items or otherwise have modifications so that's why you may not see it.

1 Like 1 ·

Welcome to the
Clover Developer Community