Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Multiple yarn (strip) for single knitting process.
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
bharathbiju committed Feb 6, 2020
1 parent 8e63858 commit 18a687f
Show file tree
Hide file tree
Showing 30 changed files with 844 additions and 265 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2020, Aerele Technologies Private Limited and contributors
// For license information, please see license.txt

frappe.ui.form.on('Apparelo Yarn Category', {
// refresh: function(frm) {

// }
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"actions": [],
"autoname": "field:yarn_category",
"creation": "2020-02-04 16:09:56.637026",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"yarn_category",
"disabled"
],
"fields": [
{
"fieldname": "yarn_category",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Yarn Category",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
}
],
"links": [],
"modified": "2020-02-04 16:11:20.313153",
"modified_by": "Administrator",
"module": "Apparelo",
"name": "Apparelo Yarn Category",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import frappe


class AppareloYarnCategory(Document):
def validate(self):
self.create_attribute_value()
def create_attribute_value(self):
item_attribute=frappe.get_doc("Item Attribute","Yarn Category")
yarn_categorys=[]
for value in item_attribute.item_attribute_values:
yarn_categorys.append(value.attribute_value)
if not self.yarn_category in yarn_categorys:
item_attribute.append('item_attribute_values',{
"attribute_value" : self.yarn_category,
"abbr" : self.yarn_category
})
item_attribute.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and Contributors
# See license.txt
from __future__ import unicode_literals

# import frappe
import unittest

class TestAppareloYarnCategory(unittest.TestCase):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2020, Aerele Technologies Private Limited and contributors
// For license information, please see license.txt

frappe.ui.form.on('Apparelo Yarn Count', {
// refresh: function(frm) {

// }
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"actions": [],
"autoname": "field:yarn_count",
"creation": "2020-02-04 16:14:57.628712",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"yarn_count",
"disabled"
],
"fields": [
{
"fieldname": "yarn_count",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Yarn Count",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
}
],
"links": [],
"modified": "2020-02-04 16:17:28.707966",
"modified_by": "Administrator",
"module": "Apparelo",
"name": "Apparelo Yarn Count",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import frappe

class AppareloYarnCount(Document):
def validate(self):
self.create_attribute_value()
def create_attribute_value(self):
item_attribute=frappe.get_doc("Item Attribute","Yarn Count")
counts=[]
for value in item_attribute.item_attribute_values:
counts.append(value.attribute_value)
if not self.yarn_count in counts:
item_attribute.append('item_attribute_values',{
"attribute_value" : self.yarn_count,
"abbr" : self.yarn_count
})
item_attribute.save()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and Contributors
# See license.txt
from __future__ import unicode_literals

# import frappe
import unittest

class TestAppareloYarnCount(unittest.TestCase):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"actions": [],
"creation": "2020-02-05 12:55:05.151712",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"yarn",
"quantity"
],
"fields": [
{
"fieldname": "quantity",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Quantity"
},
{
"fieldname": "yarn",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Yarn",
"options": "Item"
}
],
"istable": 1,
"links": [],
"modified": "2020-02-06 12:11:25.259035",
"modified_by": "Administrator",
"module": "Apparelo",
"name": "Apparelo Yarn Ratio",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document

class AppareloYarnRatio(Document):
pass
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2020, Aerele Technologies Private Limited and contributors
// For license information, please see license.txt

frappe.ui.form.on('Apparelo Yarn Shade', {
// refresh: function(frm) {

// }

get_combined_yarn:function(frm){
frappe.call({
method: "apparelo.apparelo.doctype.apparelo_yarn_shade.apparelo_yarn_shade.get_yarn_shade",
freeze: true,
args: {doc: frm.doc},
callback: function(r) {
if(r.message) {
frm.set_value('yarn_shade',r.message.final_yarn_shade);
}
}
})
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"actions": [],
"autoname": "field:yarn_shade",
"creation": "2020-02-04 12:13:48.535805",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"is_combined",
"combined_yarn",
"get_combined_yarn",
"yarn_shade",
"disabled"
],
"fields": [
{
"default": "0",
"fieldname": "is_combined",
"fieldtype": "Check",
"label": "Is Combined"
},
{
"depends_on": "is_combined",
"fieldname": "get_combined_yarn",
"fieldtype": "Button",
"label": "Get Combined Yarn"
},
{
"fieldname": "yarn_shade",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Yarn Shade",
"reqd": 1,
"unique": 1
},
{
"default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
"label": "Disabled"
},
{
"depends_on": "is_combined",
"fieldname": "combined_yarn",
"fieldtype": "Table MultiSelect",
"label": "Combined Yarn",
"options": "Combined Yarn Shade"
}
],
"links": [],
"modified": "2020-02-04 15:10:34.977767",
"modified_by": "Administrator",
"module": "Apparelo",
"name": "Apparelo Yarn Shade",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and contributors
# For license information, please see license.txt

from __future__ import unicode_literals
import frappe,json
from six import string_types, iteritems
from frappe.model.document import Document

class AppareloYarnShade(Document):
def validate(self):
self.create_attribute_value()
def create_attribute_value(self):
item_attribute=frappe.get_doc("Item Attribute","Yarn Shade")
yarn_shade=[]
for value in item_attribute.item_attribute_values:
yarn_shade.append(value.attribute_value)
if not self.yarn_shade in yarn_shade:
item_attribute.append('item_attribute_values',{
"attribute_value" : self.yarn_shade,
"abbr" : self.yarn_shade
})
item_attribute.save()


@frappe.whitelist()
def get_yarn_shade(doc):
if isinstance(doc, string_types):
doc = frappe._dict(json.loads(doc))
final_yarn_shade=""
for yarn_shade_ in doc.combined_yarn:
final_yarn_shade+=yarn_shade_['yarn']+","
return {"final_yarn_shade":final_yarn_shade[:-1]}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Aerele Technologies Private Limited and Contributors
# See license.txt
from __future__ import unicode_literals

# import frappe
import unittest

class TestAppareloYarnShade(unittest.TestCase):
pass
Empty file.
Loading

0 comments on commit 18a687f

Please sign in to comment.