import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
import { computed, get } from "@ember/object";

export default Model.extend({
  stockQuantity: attr("number"),
  product: belongsTo("product"),
  price: belongsTo("price"),
  bom: belongsTo("bom", { async: false }),
  skuImages: hasMany("sku-image"),
  skuFields: hasMany("sku-field"),

  attributes: computed("skuFields.[]", function() {
    return get(this, "skuFields").reduce((hash, attribute) => {
      hash[get(attribute, "slug")] = get(attribute, "values");
      return hash;
    }, {});
  })
});

import Model from "ember-data/model";
import attr from "ember-data/attr";
import { belongsTo, hasMany } from "ember-data/relationships";
import { computed, get } from "@ember/object";

export default Model.extend({
  stockQuantity: attr("number"),
  price: attr("number"),
  // price: belongsTo("price"),
  product: belongsTo("product"),
  bom: belongsTo("bom", { async: false }),
  skuImages: hasMany("sku-image"),
  skuFields: hasMany("sku-field"),

  attributes: computed("skuFields.[]", function() {
    return get(this, "skuFields").reduce((hash, attribute) => {
      hash[get(attribute, "slug")] = get(attribute, "values");
      return hash;
    }, {});
  })
});

Change price back to number temporarily
Change price back to number temporarily
