sorry I am new to CUBA and trying out these two scenarios but not sure how to proceed ?
scenario 1:
I have a composition relationship on order and orderline tables.
now when creating an order I want orderline to have a default orderline item
populated all times. how do I go about that ?
scenario 2
I also have composition relationship on order and orderline tables
based on customer selected on order, I want order to have certain default values and also orderline
to have default line items.
I can successfully set defaults on the order table when selecting different customer by
subscribing to FieldValueChange event, but not sure how to go to orderline and set
default orderline item?
sorry I am new to CUBA and don’t have sensible example code to share so any guidance and example code based on above will be appreciated very much
In particular this PR will activate your described behavior:
Here’s the explanation of it:
Customer aware Default Products
Based on the Customer or CustomerType, certain Line Items should be created automatically.
For this, there is a dedicated entity, called DefaultProduct which has a CRUD UI:
It is possible to create a default product for a particular customer, for a customer type, or a global default product (leaving customer and customer type blank).
Creating a new Order with default products
The Order Screen will pick up the default products and create line items out of it.
Additionally, based on the Customer Type, the Order Priority will be determined.
Example 1: special Customer
Example 2: no special Customer
Source code
The Order with Defaults controller, generates line items out of the default products that match the current context (taking customer & customer type into consideration).