refactor: Improves stock picking data parsing and API calls

Refactors `StockPickingRecordModel` to use generic `fromJson` utility functions for robust JSON deserialization, gracefully handling null or unexpected values for various fields.

Updates the stock picking API call to filter by `picking_type_code` ("incoming") instead of a hardcoded `picking_type_id`, enhancing clarity and maintainability.

Removes unnecessary `id`, `jsonrpc`, and `method` parameters from the API request and the `userId` field from the model.
This commit is contained in:
mandreshope 2025-07-30 13:37:18 +03:00
parent 1d331acc54
commit 6af1bfc4ab
5 changed files with 111 additions and 81 deletions

View File

@ -87,9 +87,9 @@ class ApiCalls {
final response = await dioService.post(
path: '/web/dataset/call_kw/stock.picking/web_search_read',
data: {
"id": 23,
"jsonrpc": "2.0",
"method": "call",
//"id": 23,
//"jsonrpc": "2.0",
//"method": "call",
"params": {
"model": "stock.picking",
"method": "web_search_read",
@ -148,7 +148,7 @@ class ApiCalls {
},
"count_limit": 10001,
"domain": [
["picking_type_id", "=", 2],
["picking_type_code", "=", "incoming"],
],
},
},

View File

@ -1,5 +1,6 @@
import 'package:e_scan/backend/schema/product/product_model.dart';
import 'package:e_scan/backend/schema/stock_picking/stock_picking_model.dart';
import 'package:e_scan/utils/utils.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'stock_picking_record_model.freezed.dart';
@ -10,31 +11,40 @@ abstract class StockPickingRecordModel with _$StockPickingRecordModel {
const factory StockPickingRecordModel({
int? id,
@JsonKey(name: 'company_id') StockPickingCompanyModel? companyId,
@JsonKey(name: 'priority') String? priority,
@JsonKey(name: 'name') String? name,
@JsonKey(name: 'partner_id') StockPickingPartnerModel? partnerId,
@JsonKey(name: 'priority', fromJson: stringFromJson) String? priority,
@JsonKey(name: 'name', fromJson: stringFromJson) String? name,
@JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson)
StockPickingPartnerModel? partnerId,
@JsonKey(name: 'location_dest_id')
StockPickingLocationModel? locationDestId,
@JsonKey(name: 'location_id') StockPickingLocationModel? locationId,
@JsonKey(name: 'user_id') dynamic userId,
@JsonKey(name: 'scheduled_date') String? scheduledDate,
@JsonKey(name: 'location_id', fromJson: _locationFromJson)
StockPickingLocationModel? locationId,
// @JsonKey(name: 'user_id') dynamic userId,
@JsonKey(name: 'scheduled_date') dynamic scheduledDate,
@JsonKey(name: 'picking_type_code') String? pickingTypeCode,
@JsonKey(name: 'products_availability_state')
dynamic productsAvailabilityState,
@JsonKey(name: 'products_availability') dynamic productsAvailability,
@JsonKey(name: 'date_deadline') String? dateDeadline,
@JsonKey(name: 'date_deadline') dynamic dateDeadline,
@JsonKey(name: 'date_done') dynamic dateDone,
@JsonKey(name: 'origin') String? origin,
@JsonKey(name: 'origin', fromJson: stringFromJson) String? origin,
@JsonKey(name: 'backorder_id') dynamic backorderId,
@JsonKey(name: 'picking_type_id') StockPickingTypeModel? pickingTypeId,
@JsonKey(name: 'state') String? state,
@JsonKey(name: 'picking_type_id', fromJson: _typeFromJson)
StockPickingTypeModel? pickingTypeId,
@JsonKey(name: 'state', fromJson: stringFromJson) String? state,
@JsonKey(name: 'activity_exception_decoration')
dynamic activityExceptionDecoration,
@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,
@JsonKey(name: 'json_popover') dynamic jsonPopover,
@JsonKey(name: 'move_line_ids_without_package')
@JsonKey(
name: 'move_line_ids_without_package',
fromJson: _moveLineIdsWithoutPackageFromJson,
)
List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage,
@JsonKey(name: 'move_ids_without_package')
@JsonKey(
name: 'move_ids_without_package',
fromJson: _moveIdsWithoutPackageFromJson,
)
List<MoveWithoutPackageModel>? moveIdsWithoutPackage,
}) = _StockPickingRecordModel;
@ -42,6 +52,22 @@ abstract class StockPickingRecordModel with _$StockPickingRecordModel {
_$StockPickingRecordModelFromJson(json);
}
StockPickingLocationModel? _locationFromJson(dynamic json) =>
objectFromJson(json, StockPickingLocationModel.fromJson);
StockPickingPartnerModel? _stockPickingPartnerFromJson(dynamic json) =>
objectFromJson(json, StockPickingPartnerModel.fromJson);
StockPickingTypeModel? _typeFromJson(dynamic json) =>
objectFromJson(json, StockPickingTypeModel.fromJson);
List<MoveLineWithoutPackageModel>? _moveLineIdsWithoutPackageFromJson(
dynamic json,
) => listFromJson(json, MoveLineWithoutPackageModel.fromJson);
List<MoveWithoutPackageModel>? _moveIdsWithoutPackageFromJson(dynamic json) =>
listFromJson(json, MoveWithoutPackageModel.fromJson);
@freezed
abstract class MoveLineWithoutPackageModel with _$MoveLineWithoutPackageModel {
const factory MoveLineWithoutPackageModel({

View File

@ -16,7 +16,8 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$StockPickingRecordModel {
int? get id;@JsonKey(name: 'company_id') StockPickingCompanyModel? get companyId;@JsonKey(name: 'priority') String? get priority;@JsonKey(name: 'name') String? get name;@JsonKey(name: 'partner_id') StockPickingPartnerModel? get partnerId;@JsonKey(name: 'location_dest_id') StockPickingLocationModel? get locationDestId;@JsonKey(name: 'location_id') StockPickingLocationModel? get locationId;@JsonKey(name: 'user_id') dynamic get userId;@JsonKey(name: 'scheduled_date') String? get scheduledDate;@JsonKey(name: 'picking_type_code') String? get pickingTypeCode;@JsonKey(name: 'products_availability_state') dynamic get productsAvailabilityState;@JsonKey(name: 'products_availability') dynamic get productsAvailability;@JsonKey(name: 'date_deadline') String? get dateDeadline;@JsonKey(name: 'date_done') dynamic get dateDone;@JsonKey(name: 'origin') String? get origin;@JsonKey(name: 'backorder_id') dynamic get backorderId;@JsonKey(name: 'picking_type_id') StockPickingTypeModel? get pickingTypeId;@JsonKey(name: 'state') String? get state;@JsonKey(name: 'activity_exception_decoration') dynamic get activityExceptionDecoration;@JsonKey(name: 'activity_exception_icon') dynamic get activityExceptionIcon;@JsonKey(name: 'json_popover') dynamic get jsonPopover;@JsonKey(name: 'move_line_ids_without_package') List<MoveLineWithoutPackageModel>? get moveLineIdsWithoutPackage;@JsonKey(name: 'move_ids_without_package') List<MoveWithoutPackageModel>? get moveIdsWithoutPackage;
int? get id;@JsonKey(name: 'company_id') StockPickingCompanyModel? get companyId;@JsonKey(name: 'priority', fromJson: stringFromJson) String? get priority;@JsonKey(name: 'name', fromJson: stringFromJson) String? get name;@JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson) StockPickingPartnerModel? get partnerId;@JsonKey(name: 'location_dest_id') StockPickingLocationModel? get locationDestId;@JsonKey(name: 'location_id', fromJson: _locationFromJson) StockPickingLocationModel? get locationId;// @JsonKey(name: 'user_id') dynamic userId,
@JsonKey(name: 'scheduled_date') dynamic get scheduledDate;@JsonKey(name: 'picking_type_code') String? get pickingTypeCode;@JsonKey(name: 'products_availability_state') dynamic get productsAvailabilityState;@JsonKey(name: 'products_availability') dynamic get productsAvailability;@JsonKey(name: 'date_deadline') dynamic get dateDeadline;@JsonKey(name: 'date_done') dynamic get dateDone;@JsonKey(name: 'origin', fromJson: stringFromJson) String? get origin;@JsonKey(name: 'backorder_id') dynamic get backorderId;@JsonKey(name: 'picking_type_id', fromJson: _typeFromJson) StockPickingTypeModel? get pickingTypeId;@JsonKey(name: 'state', fromJson: stringFromJson) String? get state;@JsonKey(name: 'activity_exception_decoration') dynamic get activityExceptionDecoration;@JsonKey(name: 'activity_exception_icon') dynamic get activityExceptionIcon;@JsonKey(name: 'json_popover') dynamic get jsonPopover;@JsonKey(name: 'move_line_ids_without_package', fromJson: _moveLineIdsWithoutPackageFromJson) List<MoveLineWithoutPackageModel>? get moveLineIdsWithoutPackage;@JsonKey(name: 'move_ids_without_package', fromJson: _moveIdsWithoutPackageFromJson) List<MoveWithoutPackageModel>? get moveIdsWithoutPackage;
/// Create a copy of StockPickingRecordModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@ -29,16 +30,16 @@ $StockPickingRecordModelCopyWith<StockPickingRecordModel> get copyWith => _$Stoc
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is StockPickingRecordModel&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&(identical(other.locationDestId, locationDestId) || other.locationDestId == locationDestId)&&(identical(other.locationId, locationId) || other.locationId == locationId)&&const DeepCollectionEquality().equals(other.userId, userId)&&(identical(other.scheduledDate, scheduledDate) || other.scheduledDate == scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&(identical(other.dateDeadline, dateDeadline) || other.dateDeadline == dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)&&const DeepCollectionEquality().equals(other.moveLineIdsWithoutPackage, moveLineIdsWithoutPackage)&&const DeepCollectionEquality().equals(other.moveIdsWithoutPackage, moveIdsWithoutPackage));
return identical(this, other) || (other.runtimeType == runtimeType&&other is StockPickingRecordModel&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&(identical(other.locationDestId, locationDestId) || other.locationDestId == locationDestId)&&(identical(other.locationId, locationId) || other.locationId == locationId)&&const DeepCollectionEquality().equals(other.scheduledDate, scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&const DeepCollectionEquality().equals(other.dateDeadline, dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)&&const DeepCollectionEquality().equals(other.moveLineIdsWithoutPackage, moveLineIdsWithoutPackage)&&const DeepCollectionEquality().equals(other.moveIdsWithoutPackage, moveIdsWithoutPackage));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,locationDestId,locationId,const DeepCollectionEquality().hash(userId),scheduledDate,pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),dateDeadline,const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover),const DeepCollectionEquality().hash(moveLineIdsWithoutPackage),const DeepCollectionEquality().hash(moveIdsWithoutPackage)]);
int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,locationDestId,locationId,const DeepCollectionEquality().hash(scheduledDate),pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),const DeepCollectionEquality().hash(dateDeadline),const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover),const DeepCollectionEquality().hash(moveLineIdsWithoutPackage),const DeepCollectionEquality().hash(moveIdsWithoutPackage)]);
@override
String toString() {
return 'StockPickingRecordModel(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, locationDestId: $locationDestId, locationId: $locationId, userId: $userId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover, moveLineIdsWithoutPackage: $moveLineIdsWithoutPackage, moveIdsWithoutPackage: $moveIdsWithoutPackage)';
return 'StockPickingRecordModel(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, locationDestId: $locationDestId, locationId: $locationId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover, moveLineIdsWithoutPackage: $moveLineIdsWithoutPackage, moveIdsWithoutPackage: $moveIdsWithoutPackage)';
}
@ -49,7 +50,7 @@ abstract mixin class $StockPickingRecordModelCopyWith<$Res> {
factory $StockPickingRecordModelCopyWith(StockPickingRecordModel value, $Res Function(StockPickingRecordModel) _then) = _$StockPickingRecordModelCopyWithImpl;
@useResult
$Res call({
int? id,@JsonKey(name: 'company_id') StockPickingCompanyModel? companyId,@JsonKey(name: 'priority') String? priority,@JsonKey(name: 'name') String? name,@JsonKey(name: 'partner_id') StockPickingPartnerModel? partnerId,@JsonKey(name: 'location_dest_id') StockPickingLocationModel? locationDestId,@JsonKey(name: 'location_id') StockPickingLocationModel? locationId,@JsonKey(name: 'user_id') dynamic userId,@JsonKey(name: 'scheduled_date') String? scheduledDate,@JsonKey(name: 'picking_type_code') String? pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') String? dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone,@JsonKey(name: 'origin') String? origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id') StockPickingTypeModel? pickingTypeId,@JsonKey(name: 'state') String? state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover,@JsonKey(name: 'move_line_ids_without_package') List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage,@JsonKey(name: 'move_ids_without_package') List<MoveWithoutPackageModel>? moveIdsWithoutPackage
int? id,@JsonKey(name: 'company_id') StockPickingCompanyModel? companyId,@JsonKey(name: 'priority', fromJson: stringFromJson) String? priority,@JsonKey(name: 'name', fromJson: stringFromJson) String? name,@JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson) StockPickingPartnerModel? partnerId,@JsonKey(name: 'location_dest_id') StockPickingLocationModel? locationDestId,@JsonKey(name: 'location_id', fromJson: _locationFromJson) StockPickingLocationModel? locationId,@JsonKey(name: 'scheduled_date') dynamic scheduledDate,@JsonKey(name: 'picking_type_code') String? pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') dynamic dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone,@JsonKey(name: 'origin', fromJson: stringFromJson) String? origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id', fromJson: _typeFromJson) StockPickingTypeModel? pickingTypeId,@JsonKey(name: 'state', fromJson: stringFromJson) String? state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover,@JsonKey(name: 'move_line_ids_without_package', fromJson: _moveLineIdsWithoutPackageFromJson) List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage,@JsonKey(name: 'move_ids_without_package', fromJson: _moveIdsWithoutPackageFromJson) List<MoveWithoutPackageModel>? moveIdsWithoutPackage
});
@ -66,7 +67,7 @@ class _$StockPickingRecordModelCopyWithImpl<$Res>
/// Create a copy of StockPickingRecordModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? companyId = freezed,Object? priority = freezed,Object? name = freezed,Object? partnerId = freezed,Object? locationDestId = freezed,Object? locationId = freezed,Object? userId = freezed,Object? scheduledDate = freezed,Object? pickingTypeCode = freezed,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = freezed,Object? dateDone = freezed,Object? origin = freezed,Object? backorderId = freezed,Object? pickingTypeId = freezed,Object? state = freezed,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,Object? moveLineIdsWithoutPackage = freezed,Object? moveIdsWithoutPackage = freezed,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? id = freezed,Object? companyId = freezed,Object? priority = freezed,Object? name = freezed,Object? partnerId = freezed,Object? locationDestId = freezed,Object? locationId = freezed,Object? scheduledDate = freezed,Object? pickingTypeCode = freezed,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = freezed,Object? dateDone = freezed,Object? origin = freezed,Object? backorderId = freezed,Object? pickingTypeId = freezed,Object? state = freezed,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,Object? moveLineIdsWithoutPackage = freezed,Object? moveIdsWithoutPackage = freezed,}) {
return _then(_self.copyWith(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
@ -75,13 +76,12 @@ as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to
as String?,partnerId: freezed == partnerId ? _self.partnerId : partnerId // ignore: cast_nullable_to_non_nullable
as StockPickingPartnerModel?,locationDestId: freezed == locationDestId ? _self.locationDestId : locationDestId // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,locationId: freezed == locationId ? _self.locationId : locationId // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as dynamic,scheduledDate: freezed == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable
as String?,pickingTypeCode: freezed == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,scheduledDate: freezed == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable
as dynamic,pickingTypeCode: freezed == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable
as String?,productsAvailabilityState: freezed == productsAvailabilityState ? _self.productsAvailabilityState : productsAvailabilityState // ignore: cast_nullable_to_non_nullable
as dynamic,productsAvailability: freezed == productsAvailability ? _self.productsAvailability : productsAvailability // ignore: cast_nullable_to_non_nullable
as dynamic,dateDeadline: freezed == dateDeadline ? _self.dateDeadline : dateDeadline // ignore: cast_nullable_to_non_nullable
as String?,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable
as dynamic,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable
as dynamic,origin: freezed == origin ? _self.origin : origin // ignore: cast_nullable_to_non_nullable
as String?,backorderId: freezed == backorderId ? _self.backorderId : backorderId // ignore: cast_nullable_to_non_nullable
as dynamic,pickingTypeId: freezed == pickingTypeId ? _self.pickingTypeId : pickingTypeId // ignore: cast_nullable_to_non_nullable
@ -162,32 +162,32 @@ $StockPickingTypeModelCopyWith<$Res>? get pickingTypeId {
@JsonSerializable()
class _StockPickingRecordModel implements StockPickingRecordModel {
const _StockPickingRecordModel({this.id, @JsonKey(name: 'company_id') this.companyId, @JsonKey(name: 'priority') this.priority, @JsonKey(name: 'name') this.name, @JsonKey(name: 'partner_id') this.partnerId, @JsonKey(name: 'location_dest_id') this.locationDestId, @JsonKey(name: 'location_id') this.locationId, @JsonKey(name: 'user_id') this.userId, @JsonKey(name: 'scheduled_date') this.scheduledDate, @JsonKey(name: 'picking_type_code') this.pickingTypeCode, @JsonKey(name: 'products_availability_state') this.productsAvailabilityState, @JsonKey(name: 'products_availability') this.productsAvailability, @JsonKey(name: 'date_deadline') this.dateDeadline, @JsonKey(name: 'date_done') this.dateDone, @JsonKey(name: 'origin') this.origin, @JsonKey(name: 'backorder_id') this.backorderId, @JsonKey(name: 'picking_type_id') this.pickingTypeId, @JsonKey(name: 'state') this.state, @JsonKey(name: 'activity_exception_decoration') this.activityExceptionDecoration, @JsonKey(name: 'activity_exception_icon') this.activityExceptionIcon, @JsonKey(name: 'json_popover') this.jsonPopover, @JsonKey(name: 'move_line_ids_without_package') final List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage, @JsonKey(name: 'move_ids_without_package') final List<MoveWithoutPackageModel>? moveIdsWithoutPackage}): _moveLineIdsWithoutPackage = moveLineIdsWithoutPackage,_moveIdsWithoutPackage = moveIdsWithoutPackage;
const _StockPickingRecordModel({this.id, @JsonKey(name: 'company_id') this.companyId, @JsonKey(name: 'priority', fromJson: stringFromJson) this.priority, @JsonKey(name: 'name', fromJson: stringFromJson) this.name, @JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson) this.partnerId, @JsonKey(name: 'location_dest_id') this.locationDestId, @JsonKey(name: 'location_id', fromJson: _locationFromJson) this.locationId, @JsonKey(name: 'scheduled_date') this.scheduledDate, @JsonKey(name: 'picking_type_code') this.pickingTypeCode, @JsonKey(name: 'products_availability_state') this.productsAvailabilityState, @JsonKey(name: 'products_availability') this.productsAvailability, @JsonKey(name: 'date_deadline') this.dateDeadline, @JsonKey(name: 'date_done') this.dateDone, @JsonKey(name: 'origin', fromJson: stringFromJson) this.origin, @JsonKey(name: 'backorder_id') this.backorderId, @JsonKey(name: 'picking_type_id', fromJson: _typeFromJson) this.pickingTypeId, @JsonKey(name: 'state', fromJson: stringFromJson) this.state, @JsonKey(name: 'activity_exception_decoration') this.activityExceptionDecoration, @JsonKey(name: 'activity_exception_icon') this.activityExceptionIcon, @JsonKey(name: 'json_popover') this.jsonPopover, @JsonKey(name: 'move_line_ids_without_package', fromJson: _moveLineIdsWithoutPackageFromJson) final List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage, @JsonKey(name: 'move_ids_without_package', fromJson: _moveIdsWithoutPackageFromJson) final List<MoveWithoutPackageModel>? moveIdsWithoutPackage}): _moveLineIdsWithoutPackage = moveLineIdsWithoutPackage,_moveIdsWithoutPackage = moveIdsWithoutPackage;
factory _StockPickingRecordModel.fromJson(Map<String, dynamic> json) => _$StockPickingRecordModelFromJson(json);
@override final int? id;
@override@JsonKey(name: 'company_id') final StockPickingCompanyModel? companyId;
@override@JsonKey(name: 'priority') final String? priority;
@override@JsonKey(name: 'name') final String? name;
@override@JsonKey(name: 'partner_id') final StockPickingPartnerModel? partnerId;
@override@JsonKey(name: 'priority', fromJson: stringFromJson) final String? priority;
@override@JsonKey(name: 'name', fromJson: stringFromJson) final String? name;
@override@JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson) final StockPickingPartnerModel? partnerId;
@override@JsonKey(name: 'location_dest_id') final StockPickingLocationModel? locationDestId;
@override@JsonKey(name: 'location_id') final StockPickingLocationModel? locationId;
@override@JsonKey(name: 'user_id') final dynamic userId;
@override@JsonKey(name: 'scheduled_date') final String? scheduledDate;
@override@JsonKey(name: 'location_id', fromJson: _locationFromJson) final StockPickingLocationModel? locationId;
// @JsonKey(name: 'user_id') dynamic userId,
@override@JsonKey(name: 'scheduled_date') final dynamic scheduledDate;
@override@JsonKey(name: 'picking_type_code') final String? pickingTypeCode;
@override@JsonKey(name: 'products_availability_state') final dynamic productsAvailabilityState;
@override@JsonKey(name: 'products_availability') final dynamic productsAvailability;
@override@JsonKey(name: 'date_deadline') final String? dateDeadline;
@override@JsonKey(name: 'date_deadline') final dynamic dateDeadline;
@override@JsonKey(name: 'date_done') final dynamic dateDone;
@override@JsonKey(name: 'origin') final String? origin;
@override@JsonKey(name: 'origin', fromJson: stringFromJson) final String? origin;
@override@JsonKey(name: 'backorder_id') final dynamic backorderId;
@override@JsonKey(name: 'picking_type_id') final StockPickingTypeModel? pickingTypeId;
@override@JsonKey(name: 'state') final String? state;
@override@JsonKey(name: 'picking_type_id', fromJson: _typeFromJson) final StockPickingTypeModel? pickingTypeId;
@override@JsonKey(name: 'state', fromJson: stringFromJson) final String? state;
@override@JsonKey(name: 'activity_exception_decoration') final dynamic activityExceptionDecoration;
@override@JsonKey(name: 'activity_exception_icon') final dynamic activityExceptionIcon;
@override@JsonKey(name: 'json_popover') final dynamic jsonPopover;
final List<MoveLineWithoutPackageModel>? _moveLineIdsWithoutPackage;
@override@JsonKey(name: 'move_line_ids_without_package') List<MoveLineWithoutPackageModel>? get moveLineIdsWithoutPackage {
@override@JsonKey(name: 'move_line_ids_without_package', fromJson: _moveLineIdsWithoutPackageFromJson) List<MoveLineWithoutPackageModel>? get moveLineIdsWithoutPackage {
final value = _moveLineIdsWithoutPackage;
if (value == null) return null;
if (_moveLineIdsWithoutPackage is EqualUnmodifiableListView) return _moveLineIdsWithoutPackage;
@ -196,7 +196,7 @@ class _StockPickingRecordModel implements StockPickingRecordModel {
}
final List<MoveWithoutPackageModel>? _moveIdsWithoutPackage;
@override@JsonKey(name: 'move_ids_without_package') List<MoveWithoutPackageModel>? get moveIdsWithoutPackage {
@override@JsonKey(name: 'move_ids_without_package', fromJson: _moveIdsWithoutPackageFromJson) List<MoveWithoutPackageModel>? get moveIdsWithoutPackage {
final value = _moveIdsWithoutPackage;
if (value == null) return null;
if (_moveIdsWithoutPackage is EqualUnmodifiableListView) return _moveIdsWithoutPackage;
@ -218,16 +218,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StockPickingRecordModel&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&(identical(other.locationDestId, locationDestId) || other.locationDestId == locationDestId)&&(identical(other.locationId, locationId) || other.locationId == locationId)&&const DeepCollectionEquality().equals(other.userId, userId)&&(identical(other.scheduledDate, scheduledDate) || other.scheduledDate == scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&(identical(other.dateDeadline, dateDeadline) || other.dateDeadline == dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)&&const DeepCollectionEquality().equals(other._moveLineIdsWithoutPackage, _moveLineIdsWithoutPackage)&&const DeepCollectionEquality().equals(other._moveIdsWithoutPackage, _moveIdsWithoutPackage));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StockPickingRecordModel&&(identical(other.id, id) || other.id == id)&&(identical(other.companyId, companyId) || other.companyId == companyId)&&(identical(other.priority, priority) || other.priority == priority)&&(identical(other.name, name) || other.name == name)&&(identical(other.partnerId, partnerId) || other.partnerId == partnerId)&&(identical(other.locationDestId, locationDestId) || other.locationDestId == locationDestId)&&(identical(other.locationId, locationId) || other.locationId == locationId)&&const DeepCollectionEquality().equals(other.scheduledDate, scheduledDate)&&(identical(other.pickingTypeCode, pickingTypeCode) || other.pickingTypeCode == pickingTypeCode)&&const DeepCollectionEquality().equals(other.productsAvailabilityState, productsAvailabilityState)&&const DeepCollectionEquality().equals(other.productsAvailability, productsAvailability)&&const DeepCollectionEquality().equals(other.dateDeadline, dateDeadline)&&const DeepCollectionEquality().equals(other.dateDone, dateDone)&&(identical(other.origin, origin) || other.origin == origin)&&const DeepCollectionEquality().equals(other.backorderId, backorderId)&&(identical(other.pickingTypeId, pickingTypeId) || other.pickingTypeId == pickingTypeId)&&(identical(other.state, state) || other.state == state)&&const DeepCollectionEquality().equals(other.activityExceptionDecoration, activityExceptionDecoration)&&const DeepCollectionEquality().equals(other.activityExceptionIcon, activityExceptionIcon)&&const DeepCollectionEquality().equals(other.jsonPopover, jsonPopover)&&const DeepCollectionEquality().equals(other._moveLineIdsWithoutPackage, _moveLineIdsWithoutPackage)&&const DeepCollectionEquality().equals(other._moveIdsWithoutPackage, _moveIdsWithoutPackage));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,locationDestId,locationId,const DeepCollectionEquality().hash(userId),scheduledDate,pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),dateDeadline,const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover),const DeepCollectionEquality().hash(_moveLineIdsWithoutPackage),const DeepCollectionEquality().hash(_moveIdsWithoutPackage)]);
int get hashCode => Object.hashAll([runtimeType,id,companyId,priority,name,partnerId,locationDestId,locationId,const DeepCollectionEquality().hash(scheduledDate),pickingTypeCode,const DeepCollectionEquality().hash(productsAvailabilityState),const DeepCollectionEquality().hash(productsAvailability),const DeepCollectionEquality().hash(dateDeadline),const DeepCollectionEquality().hash(dateDone),origin,const DeepCollectionEquality().hash(backorderId),pickingTypeId,state,const DeepCollectionEquality().hash(activityExceptionDecoration),const DeepCollectionEquality().hash(activityExceptionIcon),const DeepCollectionEquality().hash(jsonPopover),const DeepCollectionEquality().hash(_moveLineIdsWithoutPackage),const DeepCollectionEquality().hash(_moveIdsWithoutPackage)]);
@override
String toString() {
return 'StockPickingRecordModel(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, locationDestId: $locationDestId, locationId: $locationId, userId: $userId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover, moveLineIdsWithoutPackage: $moveLineIdsWithoutPackage, moveIdsWithoutPackage: $moveIdsWithoutPackage)';
return 'StockPickingRecordModel(id: $id, companyId: $companyId, priority: $priority, name: $name, partnerId: $partnerId, locationDestId: $locationDestId, locationId: $locationId, scheduledDate: $scheduledDate, pickingTypeCode: $pickingTypeCode, productsAvailabilityState: $productsAvailabilityState, productsAvailability: $productsAvailability, dateDeadline: $dateDeadline, dateDone: $dateDone, origin: $origin, backorderId: $backorderId, pickingTypeId: $pickingTypeId, state: $state, activityExceptionDecoration: $activityExceptionDecoration, activityExceptionIcon: $activityExceptionIcon, jsonPopover: $jsonPopover, moveLineIdsWithoutPackage: $moveLineIdsWithoutPackage, moveIdsWithoutPackage: $moveIdsWithoutPackage)';
}
@ -238,7 +238,7 @@ abstract mixin class _$StockPickingRecordModelCopyWith<$Res> implements $StockPi
factory _$StockPickingRecordModelCopyWith(_StockPickingRecordModel value, $Res Function(_StockPickingRecordModel) _then) = __$StockPickingRecordModelCopyWithImpl;
@override @useResult
$Res call({
int? id,@JsonKey(name: 'company_id') StockPickingCompanyModel? companyId,@JsonKey(name: 'priority') String? priority,@JsonKey(name: 'name') String? name,@JsonKey(name: 'partner_id') StockPickingPartnerModel? partnerId,@JsonKey(name: 'location_dest_id') StockPickingLocationModel? locationDestId,@JsonKey(name: 'location_id') StockPickingLocationModel? locationId,@JsonKey(name: 'user_id') dynamic userId,@JsonKey(name: 'scheduled_date') String? scheduledDate,@JsonKey(name: 'picking_type_code') String? pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') String? dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone,@JsonKey(name: 'origin') String? origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id') StockPickingTypeModel? pickingTypeId,@JsonKey(name: 'state') String? state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover,@JsonKey(name: 'move_line_ids_without_package') List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage,@JsonKey(name: 'move_ids_without_package') List<MoveWithoutPackageModel>? moveIdsWithoutPackage
int? id,@JsonKey(name: 'company_id') StockPickingCompanyModel? companyId,@JsonKey(name: 'priority', fromJson: stringFromJson) String? priority,@JsonKey(name: 'name', fromJson: stringFromJson) String? name,@JsonKey(name: 'partner_id', fromJson: _stockPickingPartnerFromJson) StockPickingPartnerModel? partnerId,@JsonKey(name: 'location_dest_id') StockPickingLocationModel? locationDestId,@JsonKey(name: 'location_id', fromJson: _locationFromJson) StockPickingLocationModel? locationId,@JsonKey(name: 'scheduled_date') dynamic scheduledDate,@JsonKey(name: 'picking_type_code') String? pickingTypeCode,@JsonKey(name: 'products_availability_state') dynamic productsAvailabilityState,@JsonKey(name: 'products_availability') dynamic productsAvailability,@JsonKey(name: 'date_deadline') dynamic dateDeadline,@JsonKey(name: 'date_done') dynamic dateDone,@JsonKey(name: 'origin', fromJson: stringFromJson) String? origin,@JsonKey(name: 'backorder_id') dynamic backorderId,@JsonKey(name: 'picking_type_id', fromJson: _typeFromJson) StockPickingTypeModel? pickingTypeId,@JsonKey(name: 'state', fromJson: stringFromJson) String? state,@JsonKey(name: 'activity_exception_decoration') dynamic activityExceptionDecoration,@JsonKey(name: 'activity_exception_icon') dynamic activityExceptionIcon,@JsonKey(name: 'json_popover') dynamic jsonPopover,@JsonKey(name: 'move_line_ids_without_package', fromJson: _moveLineIdsWithoutPackageFromJson) List<MoveLineWithoutPackageModel>? moveLineIdsWithoutPackage,@JsonKey(name: 'move_ids_without_package', fromJson: _moveIdsWithoutPackageFromJson) List<MoveWithoutPackageModel>? moveIdsWithoutPackage
});
@ -255,7 +255,7 @@ class __$StockPickingRecordModelCopyWithImpl<$Res>
/// Create a copy of StockPickingRecordModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? companyId = freezed,Object? priority = freezed,Object? name = freezed,Object? partnerId = freezed,Object? locationDestId = freezed,Object? locationId = freezed,Object? userId = freezed,Object? scheduledDate = freezed,Object? pickingTypeCode = freezed,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = freezed,Object? dateDone = freezed,Object? origin = freezed,Object? backorderId = freezed,Object? pickingTypeId = freezed,Object? state = freezed,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,Object? moveLineIdsWithoutPackage = freezed,Object? moveIdsWithoutPackage = freezed,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? id = freezed,Object? companyId = freezed,Object? priority = freezed,Object? name = freezed,Object? partnerId = freezed,Object? locationDestId = freezed,Object? locationId = freezed,Object? scheduledDate = freezed,Object? pickingTypeCode = freezed,Object? productsAvailabilityState = freezed,Object? productsAvailability = freezed,Object? dateDeadline = freezed,Object? dateDone = freezed,Object? origin = freezed,Object? backorderId = freezed,Object? pickingTypeId = freezed,Object? state = freezed,Object? activityExceptionDecoration = freezed,Object? activityExceptionIcon = freezed,Object? jsonPopover = freezed,Object? moveLineIdsWithoutPackage = freezed,Object? moveIdsWithoutPackage = freezed,}) {
return _then(_StockPickingRecordModel(
id: freezed == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as int?,companyId: freezed == companyId ? _self.companyId : companyId // ignore: cast_nullable_to_non_nullable
@ -264,13 +264,12 @@ as String?,name: freezed == name ? _self.name : name // ignore: cast_nullable_to
as String?,partnerId: freezed == partnerId ? _self.partnerId : partnerId // ignore: cast_nullable_to_non_nullable
as StockPickingPartnerModel?,locationDestId: freezed == locationDestId ? _self.locationDestId : locationDestId // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,locationId: freezed == locationId ? _self.locationId : locationId // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
as dynamic,scheduledDate: freezed == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable
as String?,pickingTypeCode: freezed == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable
as StockPickingLocationModel?,scheduledDate: freezed == scheduledDate ? _self.scheduledDate : scheduledDate // ignore: cast_nullable_to_non_nullable
as dynamic,pickingTypeCode: freezed == pickingTypeCode ? _self.pickingTypeCode : pickingTypeCode // ignore: cast_nullable_to_non_nullable
as String?,productsAvailabilityState: freezed == productsAvailabilityState ? _self.productsAvailabilityState : productsAvailabilityState // ignore: cast_nullable_to_non_nullable
as dynamic,productsAvailability: freezed == productsAvailability ? _self.productsAvailability : productsAvailability // ignore: cast_nullable_to_non_nullable
as dynamic,dateDeadline: freezed == dateDeadline ? _self.dateDeadline : dateDeadline // ignore: cast_nullable_to_non_nullable
as String?,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable
as dynamic,dateDone: freezed == dateDone ? _self.dateDone : dateDone // ignore: cast_nullable_to_non_nullable
as dynamic,origin: freezed == origin ? _self.origin : origin // ignore: cast_nullable_to_non_nullable
as String?,backorderId: freezed == backorderId ? _self.backorderId : backorderId // ignore: cast_nullable_to_non_nullable
as dynamic,pickingTypeId: freezed == pickingTypeId ? _self.pickingTypeId : pickingTypeId // ignore: cast_nullable_to_non_nullable

View File

@ -15,51 +15,34 @@ _StockPickingRecordModel _$StockPickingRecordModelFromJson(
: StockPickingCompanyModel.fromJson(
json['company_id'] as Map<String, dynamic>,
),
priority: json['priority'] as String?,
name: json['name'] as String?,
partnerId: json['partner_id'] == null
? null
: StockPickingPartnerModel.fromJson(
json['partner_id'] as Map<String, dynamic>,
),
priority: stringFromJson(json['priority']),
name: stringFromJson(json['name']),
partnerId: _stockPickingPartnerFromJson(json['partner_id']),
locationDestId: json['location_dest_id'] == null
? null
: StockPickingLocationModel.fromJson(
json['location_dest_id'] as Map<String, dynamic>,
),
locationId: json['location_id'] == null
? null
: StockPickingLocationModel.fromJson(
json['location_id'] as Map<String, dynamic>,
),
userId: json['user_id'],
scheduledDate: json['scheduled_date'] as String?,
locationId: _locationFromJson(json['location_id']),
scheduledDate: json['scheduled_date'],
pickingTypeCode: json['picking_type_code'] as String?,
productsAvailabilityState: json['products_availability_state'],
productsAvailability: json['products_availability'],
dateDeadline: json['date_deadline'] as String?,
dateDeadline: json['date_deadline'],
dateDone: json['date_done'],
origin: json['origin'] as String?,
origin: stringFromJson(json['origin']),
backorderId: json['backorder_id'],
pickingTypeId: json['picking_type_id'] == null
? null
: StockPickingTypeModel.fromJson(
json['picking_type_id'] as Map<String, dynamic>,
),
state: json['state'] as String?,
pickingTypeId: _typeFromJson(json['picking_type_id']),
state: stringFromJson(json['state']),
activityExceptionDecoration: json['activity_exception_decoration'],
activityExceptionIcon: json['activity_exception_icon'],
jsonPopover: json['json_popover'],
moveLineIdsWithoutPackage:
(json['move_line_ids_without_package'] as List<dynamic>?)
?.map(
(e) =>
MoveLineWithoutPackageModel.fromJson(e as Map<String, dynamic>),
)
.toList(),
moveIdsWithoutPackage: (json['move_ids_without_package'] as List<dynamic>?)
?.map((e) => MoveWithoutPackageModel.fromJson(e as Map<String, dynamic>))
.toList(),
moveLineIdsWithoutPackage: _moveLineIdsWithoutPackageFromJson(
json['move_line_ids_without_package'],
),
moveIdsWithoutPackage: _moveIdsWithoutPackageFromJson(
json['move_ids_without_package'],
),
);
Map<String, dynamic> _$StockPickingRecordModelToJson(
@ -72,7 +55,6 @@ Map<String, dynamic> _$StockPickingRecordModelToJson(
'partner_id': instance.partnerId,
'location_dest_id': instance.locationDestId,
'location_id': instance.locationId,
'user_id': instance.userId,
'scheduled_date': instance.scheduledDate,
'picking_type_code': instance.pickingTypeCode,
'products_availability_state': instance.productsAvailabilityState,

View File

@ -11,6 +11,29 @@ extension StatefulWidgetExtensions on State<StatefulWidget> {
}
}
String? stringFromJson(dynamic json) {
if (json is String && json.isNotEmpty) return json;
return null;
}
T? objectFromJson<T>(dynamic json, T Function(Map<String, dynamic>) fromJson) {
if (json is Map<String, dynamic>) return fromJson(json);
return null;
}
List<T>? listFromJson<T>(
dynamic json,
T Function(Map<String, dynamic>) fromJson,
) {
if (json is List) {
return json
.whereType<Map<String, dynamic>>()
.map((e) => fromJson(e))
.toList();
}
return null;
}
Future<bool> checkInternetConnexion() async {
final List<ConnectivityResult> connectivityResult = await (Connectivity()
.checkConnectivity());