mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
add unit_price_price_and_unit to line_item serializer
* unit_price_price_and_unit refers UnitPrice which refers to other attributes that belong to variant and product. Instead of collecting all the attributes that were using indirectly by the method and adding them to the serializers I perefered to serialize the result of the method call.
This commit is contained in:
@@ -4,7 +4,7 @@ class Invoice
|
||||
class DataPresenter
|
||||
class LineItem < Invoice::DataPresenter::Base
|
||||
attributes :added_tax, :currency, :included_tax, :price_with_adjustments, :quantity,
|
||||
:variant_id
|
||||
:variant_id, :unit_price_price_and_unit
|
||||
attributes_with_presenter :variant
|
||||
array_attribute :tax_rates, class_name: 'TaxRate'
|
||||
invoice_generation_attributes :added_tax, :included_tax, :price_with_adjustments,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
class Invoice
|
||||
class LineItemSerializer < ActiveModel::Serializer
|
||||
attributes :id, :added_tax, :currency, :included_tax, :price_with_adjustments, :quantity,
|
||||
:variant_id
|
||||
:variant_id, :unit_price_price_and_unit
|
||||
has_one :variant, serializer: Invoice::VariantSerializer
|
||||
has_many :tax_rates, serializer: Invoice::TaxRateSerializer
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user