Movements Billing
To invoice the movements of a ticket, a custom field of element type “Inventorymovementgrid” must be added to the operations form.
For more information regarding the creation of custom fields click here.
In the “Extra” Tab we are going to set the “Default Grid.”
After saving the field, in the “Advanced” tab, you will need to enter the following code:
$currentOperationId = Deep::registry('current_operation')->getId() ? Deep::registry('current_operation')->getId() : -1;
//Collection filter vars
$bind = [
'src_model_id' => $currentOperationId,
'src_model_alias' => 'deep_service/operation'
];
// URL params
$additionalUrlParams = [
'bind' => Deep::helper('deep_admin')->getBase64UrlString($bind),
];
// Merge with extra URL params
$element['url_params'] = array_merge($element['url_params'], $additionalUrlParams);
With this code we are going to show in the grid only the movements related to the ticket.
After creating the field it will be necessary to add it to the form.
To add it, it will be necessary to press the pencil icon in the upper left corner.
In the floating window that will open we select the fieldset where we want to add the field (1) and from the list on the right we move the field by pressing the highlighted button (2).
After saving the template, the field will look like this:
To add a movement related to the ticket, simply click the “Add Movement” button and fill out the form that opens.
Once the movements have been added, the field will appear as follows:
To invoice the movements related to a ticket, you will need to fill out the invoice form by entering as follows:
The Model Alias will correspond to “DeepService – Operation” and the Model Id will correspond to the ID of the operation to be billed.
NOTE: For the movement to be shown in the grid, the movement item must be linked to a product in the catalog.