Permalink
Browse files

Fix catalog item form and tests

  • Loading branch information...
burisu committed Aug 17, 2018
1 parent 034c769 commit faf6b354a252e44dd7ee1467bc3a46e29d070cb2
@@ -41,6 +41,7 @@
# CatalogItem stores all the prices used in sales and purchases.
class CatalogItem < Ekylibre::Record::Base
attr_readonly :catalog_id
refers_to :currency
belongs_to :variant, class_name: 'ProductNatureVariant'
belongs_to :reference_tax, class_name: 'Tax'
@@ -1,14 +1,18 @@
- price_label_with_taxes = f.object.catalog.all_taxes_included
- all_taxes_included = f.object.catalog.all_taxes_included
= field_set do
= f.referenced_association :catalog
= f.association :catalog, as: :hidden
.control-group
%label.control-label= CatalogItem.human_attribute_name(:catalog)
.controls
%strong= f.object.catalog.name
= f.referenced_association :variant
= f.input(:amount, wrapper: :append) do
= f.input_field :amount, as: :string, input_html: { pattern: "[0-9]+([\.][0-9]+)?" }
- if price_label_with_taxes
- if all_taxes_included
%span.add-on= :unit_price_amount_with_taxes.tl
- else
%span.add-on= :unit_price_amount.tl
- if price_label_with_taxes
%span.add-on= :unit_price_amount.tl
- if all_taxes_included
= f.referenced_association :reference_tax
= f.input :commercial_name
= f.input :commercial_description
@@ -2,6 +2,6 @@
module Backend
class CatalogItemsControllerTest < ActionController::TestCase
test_restfully_all_actions other_attributes: [:variant_id], stop: :touch
test_restfully_all_actions new: { catalog_id: 1 }, create: { catalog_id: 1 }, other_attributes: [:variant_id], stop: :touch
end
end

0 comments on commit faf6b35

Please sign in to comment.