comee_core 0.2.59 → 0.2.61

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2c3e7d7089bb604a50c7d102d77df12fbfda4cabe67b4329864bdb8039e5938
4
- data.tar.gz: 26808c3d8636d02619a306090cf3d360e3c3e8f784774279c717e24a5f869ccd
3
+ metadata.gz: 6815a7ee31b8b4093b9773f7be5911ba012bf51ab79f1ea46aacfcdd72f20828
4
+ data.tar.gz: 338559521710c2d42c5a8ec652a7f6f4542604258e2b70eb5defed818b36627d
5
5
  SHA512:
6
- metadata.gz: 4f9fd27d598570509720066cf3258e3a6368fdd7e7454273ea8fbe8d0aa9eaab3e847f83fa0aad072950c0dea0fcd74546f1c09d05cbe7bf80e20d539e17b2db
7
- data.tar.gz: 57014da5e8ca68845cb68a0dea2108f28c2ffad0651064f02ec10dec12eb801acaa455e3fccaa8e55e3e2ebfff247e85a3becdb78174f67eaacaea1a1beacba0
6
+ metadata.gz: aa97f2ed8242ef366884d8e45297f6032a152e0971067230bf5cc80fab56a57732b91c7ade1bfc0569deb82a997359043ab39b7799929d9e810582b165a18fc8
7
+ data.tar.gz: 92089c305cbfc4de7e4078d52fd0d6be3bd0dac33aa168697787d20e28be347c128cdb0daac7fb27def1cb463129caf68a24a30cac399cc88353c7f74d8dd776
@@ -26,10 +26,15 @@ module Comee
26
26
  product_id = model_params[:product_id] || @obj.product_id
27
27
  master_price = MasterPrice.find_by(product_id: product_id, primary: true)
28
28
  @obj.price = master_price&.selling_price
29
+ @obj.valid_from = model_params[:valid_from] if model_params[:valid_from]
30
+ @obj.valid_to = model_params[:valid_to] if model_params[:valid_to]
31
+ @obj.margin = model_params[:margin] if model_params[:margin]
32
+ @obj.margin_type = model_params[:margin_type] if model_params[:margin_type]
29
33
  if @obj.price
30
34
  @obj.price = @obj.margin_increase? ? @obj.price * (1 + @obj.margin / 100) : @obj.price * (1 - @obj.margin / 100)
35
+ @obj.price = @obj.price.round(2)
31
36
  end
32
- if @obj.update(model_params)
37
+ if @obj.save
33
38
  render_content(@obj)
34
39
  else
35
40
  render json: {success: false, error: @obj.errors.full_messages[0]}, status: :unprocessable_entity
@@ -23,6 +23,28 @@ module Comee
23
23
  purchase_requisition.total_price = purchase_requisition.calculate_total_price
24
24
  purchase_requisition.save!
25
25
  end
26
+
27
+ def self.ransackable_attributes(_auth_object = nil)
28
+ %w[
29
+ delivery_date
30
+ id
31
+ price
32
+ processing_status
33
+ product_id
34
+ purchase_order_item_id
35
+ purchase_requisition_id
36
+ quantity
37
+ supplier_id
38
+ total_price
39
+ unit_id
40
+ created_at
41
+ updated_at
42
+ ]
43
+ end
44
+
45
+ def self.ransackable_associations(_auth_object = nil)
46
+ []
47
+ end
26
48
  end
27
49
  end
28
50
  end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.59".freeze
3
+ VERSION = "0.2.61".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.59
4
+ version: 0.2.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.