[issue fixes] + added fixtures for item attribute and operation

This commit is contained in:
Rushabh Mehta 2015-02-20 20:09:42 +05:30
parent e9b3092167
commit e8a37949cf
11 changed files with 250 additions and 64 deletions

View File

@ -23,7 +23,7 @@ def execute(filters=None):
purchase_receipt = d.purchase_receipt purchase_receipt = d.purchase_receipt
elif d.po_detail: elif d.po_detail:
purchase_receipt = ", ".join(frappe.db.sql_list("""select distinct parent purchase_receipt = ", ".join(frappe.db.sql_list("""select distinct parent
from `tabPurchase Receipt Item` where docstatus=1 and prevdoc_detail_docname=%s""", d.po_detail)) from `tabPurchase Receipt Item` where docstatus=1 and po_detail=%s""", d.po_detail))
expense_account = d.expense_account or aii_account_map.get(d.company) expense_account = d.expense_account or aii_account_map.get(d.company)
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,

View File

@ -22,7 +22,7 @@ def execute(filters=None):
delivery_note = d.delivery_note delivery_note = d.delivery_note
elif d.so_detail: elif d.so_detail:
delivery_note = ", ".join(frappe.db.sql_list("""select distinct parent delivery_note = ", ".join(frappe.db.sql_list("""select distinct parent
from `tabDelivery Note Item` where docstatus=1 and prevdoc_detail_docname=%s""", d.so_detail)) from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
d.customer_group, d.debit_to, d.territory, d.project_name, d.company, d.sales_order, d.customer_group, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,

View File

@ -160,7 +160,7 @@ def get_invoice_po_pr_map(invoice_list):
pr_list = [d.purchase_receipt] pr_list = [d.purchase_receipt]
elif d.po_detail: elif d.po_detail:
pr_list = frappe.db.sql_list("""select distinct parent from `tabPurchase Receipt Item` pr_list = frappe.db.sql_list("""select distinct parent from `tabPurchase Receipt Item`
where docstatus=1 and prevdoc_detail_docname=%s""", d.pr_detail) where docstatus=1 and po_detail=%s""", d.pr_detail)
if pr_list: if pr_list:
invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault("purchase_receipt", pr_list) invoice_po_pr_map.setdefault(d.parent, frappe._dict()).setdefault("purchase_receipt", pr_list)

View File

@ -160,7 +160,7 @@ def get_invoice_so_dn_map(invoice_list):
delivery_note_list = [d.delivery_note] delivery_note_list = [d.delivery_note]
elif d.sales_order: elif d.sales_order:
delivery_note_list = frappe.db.sql_list("""select distinct parent from `tabDelivery Note Item` delivery_note_list = frappe.db.sql_list("""select distinct parent from `tabDelivery Note Item`
where docstatus=1 and prevdoc_detail_docname=%s""", d.so_detail) where docstatus=1 and so_detail=%s""", d.so_detail)
if delivery_note_list: if delivery_note_list:
invoice_so_dn_map.setdefault(d.parent, frappe._dict()).setdefault("delivery_note", delivery_note_list) invoice_so_dn_map.setdefault(d.parent, frappe._dict()).setdefault("delivery_note", delivery_note_list)

View File

@ -9,13 +9,13 @@ frappe.provide("erpnext.buying");
erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({
refresh: function(doc, cdt, cdn) { refresh: function(doc, cdt, cdn) {
this._super(); this._super();
this.frm.dashboard.reset(); // this.frm.dashboard.reset();
if(doc.docstatus == 1 && doc.status != 'Stopped'){ if(doc.docstatus == 1 && doc.status != 'Stopped'){
cur_frm.dashboard.add_progress(cint(doc.per_received) + __("% Received"), // cur_frm.dashboard.add_progress(cint(doc.per_received) + __("% Received"),
doc.per_received); // doc.per_received);
cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"), // cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"),
doc.per_billed); // doc.per_billed);
if(flt(doc.per_received, 2) < 100) if(flt(doc.per_received, 2) < 100)
cur_frm.add_custom_button(__('Make Purchase Receipt'), cur_frm.add_custom_button(__('Make Purchase Receipt'),

View File

@ -59,12 +59,12 @@ erpnext.production_order = {
var doc = frm.doc; var doc = frm.doc;
if (doc.docstatus === 1) { if (doc.docstatus === 1) {
if (doc.material_transferred_for_qty < doc.qty) { if (flt(doc.material_transferred_for_qty) < flt(doc.qty)) {
frm.add_custom_button(__('Transfer Materials for Manufacture'), frm.add_custom_button(__('Transfer Materials for Manufacture'),
cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]); cur_frm.cscript['Transfer Raw Materials'], frappe.boot.doctype_icons["Stock Entry"]);
} }
if (doc.produced_qty < doc.material_transferred_for_qty) { if (flt(doc.produced_qty) < flt(doc.material_transferred_for_qty)) {
frm.add_custom_button(__('Update Finished Goods'), frm.add_custom_button(__('Update Finished Goods'),
cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]); cur_frm.cscript['Update Finished Goods'], frappe.boot.doctype_icons["Stock Entry"]);
} }

View File

@ -0,0 +1,54 @@
from frappe import _
items = [
_('Accounting'),
_('Advertising'),
_('Aerospace'),
_('Agriculture'),
_('Airline'),
_('Apparel & Accessories'),
_('Automotive'),
_('Banking'),
_('Biotechnology'),
_('Broadcasting'),
_('Brokerage'),
_('Chemical'),
_('Computer'),
_('Consulting'),
_('Consumer Products'),
_('Cosmetics'),
_('Defense'),
_('Department Stores'),
_('Education'),
_('Electronics'),
_('Energy'),
_('Entertainment & Leisure'),
_('Executive Search'),
_('Financial Services'),
_('Food, Beverage & Tobacco'),
_('Grocery'),
_('Health Care'),
_('Internet Publishing'),
_('Investment Banking'),
_('Legal'),
_('Manufacturing'),
_('Motion Picture & Video'),
_('Music'),
_('Newspaper Publishers'),
_('Online Auctions'),
_('Pension Funds'),
_('Pharmaceuticals'),
_('Private Equity'),
_('Publishing'),
_('Real Estate'),
_('Retail & Wholesale'),
_('Securities & Commodity Exchanges'),
_('Service'),
_('Soap & Detergent'),
_('Software'),
_('Sports'),
_('Technology'),
_('Telecommunications'),
_('Television'),
_('Transportation'),
_('Venture Capital')]

View File

@ -0,0 +1,165 @@
# source: http://en.wikipedia.org/wiki/List_of_manufacturing_processes"
from __future__ import unicode_literals
from frappe import _
items = [
_("Centrifugal casting"),
_("Continuous casting"),
_("Die casting"),
_("Evaporative-pattern casting"),
_("Full-mold casting"),
_("Lost-foam casting"),
_("Investment casting"),
_("Countergravity casting"),
_("Permanent mold casting"),
_("Resin casting"),
_("Sand casting"),
_("Shell molding"),
_("Spray forming"),
_("Vacuum molding"),
_("Molding"),
_("Compaction plus sintering"),
_("Hot isostatic pressing"),
_("Metal injection molding"),
_("Injection molding"),
_("Compression molding"),
_("Blow molding"),
_("Dip molding"),
_("Rotational molding"),
_("Thermoforming"),
_("Laminating"),
_("Shrink fitting"),
_("Shrink wrapping"),
_("End tube forming"),
_("Tube beading"),
_("Forging"),
_("Rolling"),
_("Cold rolling"),
_("Hot rolling"),
_("Cryorolling"),
_("Cross-rolling"),
_("Pressing"),
_("Embossing"),
_("Stretch forming"),
_("Blanking"),
_("Drawing"),
_("Bulging"),
_("Necking"),
_("Nosing"),
_("Deep drawing"),
_("Bending"),
_("Hemming"),
_("Shearing"),
_("Piercing"),
_("Trimming"),
_("Shaving"),
_("Notching"),
_("Perforating"),
_("Nibbling"),
_("Lancing"),
_("Cutting"),
_("Stamping"),
_("Coining"),
_("Straight shearing"),
_("Slitting"),
_("Redrawing"),
_("Ironing"),
_("Flattening"),
_("Swaging"),
_("Spinning"),
_("Peening"),
_("Explosive forming"),
_("Electroforming"),
_("Staking"),
_("Seaming"),
_("Flanging"),
_("Straightening"),
_("Decambering"),
_("Cold sizing"),
_("Hubbing"),
_("Hot metal gas forming"),
_("Curling"),
_("Hydroforming"),
_("Machining"),
_("Milling"),
_("Hammering"),
_("Smelting"),
_("Refining"),
_("Annealing"),
_("Pickling"),
_("Coating"),
_("Turning"),
_("Facing"),
_("Boring"),
_("Knurling"),
_("Hard turning"),
_("Drilling"),
_("Reaming"),
_("Countersinking"),
_("Tapping"),
_("Sawing"),
_("Filing"),
_("Broaching"),
_("Shaping"),
_("Planing"),
_("Double housing"),
_("Abrasive jet machining"),
_("Water jet cutting"),
_("Photochemical machining"),
_("Honing"),
_("Electro-chemical grinding"),
_("Finishing & industrial finishing"),
_("Abrasive blasting"),
_("Buffing"),
_("Burnishing"),
_("Electroplating"),
_("Electropolishing"),
_("Magnetic field-assisted finishing"),
_("Etching"),
_("Linishing"),
_("Mass finishing"),
_("Tumbling"),
_("Spindle finishing"),
_("Vibratory finishing"),
_("Plating"),
_("Polishing"),
_("Superfinishing"),
_("Wire brushing"),
_("Routing"),
_("Hobbing"),
_("Ultrasonic machining"),
_("Electron beam machining"),
_("Electrochemical machining"),
_("Laser cutting"),
_("Laser drilling"),
_("Grinding"),
_("Gashing"),
_("Biomachining"),
_("Joining"),
_("Welding"),
_("Brazing"),
_("Sintering"),
_("Adhesive bonding"),
_("Nailing"),
_("Screwing"),
_("Riveting"),
_("Clinching"),
_("Pinning"),
_("Stitching"),
_("Stapling"),
_("Press fitting"),
_("3D printing"),
_("Direct metal laser sintering"),
_("Fused deposition modeling"),
_("Laminated object manufacturing"),
_("Laser engineered net shaping"),
_("Selective laser sintering"),
_("Mining"),
_("Quarrying"),
_("Blasting"),
_("Woodworking"),
_("Lapping"),
_("Morticing"),
_("Crushing"),
_("Packaging and labeling")]

View File

@ -137,64 +137,31 @@ def install(country=None):
{'doctype': 'Activity Type', 'activity_type': _('Communication')}, {'doctype': 'Activity Type', 'activity_type': _('Communication')},
{'doctype': 'Activity Type', 'activity_type': 'Manufacturing'}, {'doctype': 'Activity Type', 'activity_type': 'Manufacturing'},
# Industry Type {'doctype': "Item Attribute", "attribute_name": _("Size"), "item_attribute_values": [
{'doctype': 'Industry Type', 'industry': _('Accounting')}, {"attribute_value": _("Extra Small"), "abbr": "XS"},
{'doctype': 'Industry Type', 'industry': _('Advertising')}, {"attribute_value": _("Small"), "abbr": "S"},
{'doctype': 'Industry Type', 'industry': _('Aerospace')}, {"attribute_value": _("Medium"), "abbr": "M"},
{'doctype': 'Industry Type', 'industry': _('Agriculture')}, {"attribute_value": _("Large"), "abbr": "L"},
{'doctype': 'Industry Type', 'industry': _('Airline')}, {"attribute_value": _("Extra Large"), "abbr": "XL"}
{'doctype': 'Industry Type', 'industry': _('Apparel & Accessories')}, ]},
{'doctype': 'Industry Type', 'industry': _('Automotive')},
{'doctype': 'Industry Type', 'industry': _('Banking')}, {'doctype': "Item Attribute", "attribute_name": _("Colour"), "item_attribute_values": [
{'doctype': 'Industry Type', 'industry': _('Biotechnology')}, {"attribute_value": _("Red"), "abbr": "RED"},
{'doctype': 'Industry Type', 'industry': _('Broadcasting')}, {"attribute_value": _("Green"), "abbr": "GRE"},
{'doctype': 'Industry Type', 'industry': _('Brokerage')}, {"attribute_value": _("Blue"), "abbr": "BLU"},
{'doctype': 'Industry Type', 'industry': _('Chemical')}, {"attribute_value": _("Black"), "abbr": "BLA"},
{'doctype': 'Industry Type', 'industry': _('Computer')}, {"attribute_value": _("White"), "abbr": "WHI"}
{'doctype': 'Industry Type', 'industry': _('Consulting')}, ]},
{'doctype': 'Industry Type', 'industry': _('Consumer Products')},
{'doctype': 'Industry Type', 'industry': _('Cosmetics')},
{'doctype': 'Industry Type', 'industry': _('Defense')},
{'doctype': 'Industry Type', 'industry': _('Department Stores')},
{'doctype': 'Industry Type', 'industry': _('Education')},
{'doctype': 'Industry Type', 'industry': _('Electronics')},
{'doctype': 'Industry Type', 'industry': _('Energy')},
{'doctype': 'Industry Type', 'industry': _('Entertainment & Leisure')},
{'doctype': 'Industry Type', 'industry': _('Executive Search')},
{'doctype': 'Industry Type', 'industry': _('Financial Services')},
{'doctype': 'Industry Type', 'industry': _('Food, Beverage & Tobacco')},
{'doctype': 'Industry Type', 'industry': _('Grocery')},
{'doctype': 'Industry Type', 'industry': _('Health Care')},
{'doctype': 'Industry Type', 'industry': _('Internet Publishing')},
{'doctype': 'Industry Type', 'industry': _('Investment Banking')},
{'doctype': 'Industry Type', 'industry': _('Legal')},
{'doctype': 'Industry Type', 'industry': _('Manufacturing')},
{'doctype': 'Industry Type', 'industry': _('Motion Picture & Video')},
{'doctype': 'Industry Type', 'industry': _('Music')},
{'doctype': 'Industry Type', 'industry': _('Newspaper Publishers')},
{'doctype': 'Industry Type', 'industry': _('Online Auctions')},
{'doctype': 'Industry Type', 'industry': _('Pension Funds')},
{'doctype': 'Industry Type', 'industry': _('Pharmaceuticals')},
{'doctype': 'Industry Type', 'industry': _('Private Equity')},
{'doctype': 'Industry Type', 'industry': _('Publishing')},
{'doctype': 'Industry Type', 'industry': _('Real Estate')},
{'doctype': 'Industry Type', 'industry': _('Retail & Wholesale')},
{'doctype': 'Industry Type', 'industry': _('Securities & Commodity Exchanges')},
{'doctype': 'Industry Type', 'industry': _('Service')},
{'doctype': 'Industry Type', 'industry': _('Soap & Detergent')},
{'doctype': 'Industry Type', 'industry': _('Software')},
{'doctype': 'Industry Type', 'industry': _('Sports')},
{'doctype': 'Industry Type', 'industry': _('Technology')},
{'doctype': 'Industry Type', 'industry': _('Telecommunications')},
{'doctype': 'Industry Type', 'industry': _('Television')},
{'doctype': 'Industry Type', 'industry': _('Transportation')},
{'doctype': 'Industry Type', 'industry': _('Venture Capital')},
{'doctype': "Email Account", "email_id": "sales@example.com", "append_to": "Lead"}, {'doctype': "Email Account", "email_id": "sales@example.com", "append_to": "Lead"},
{'doctype': "Email Account", "email_id": "support@example.com", "append_to": "Issue"}, {'doctype': "Email Account", "email_id": "support@example.com", "append_to": "Issue"},
{'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"} {'doctype': "Email Account", "email_id": "jobs@example.com", "append_to": "Job Applicant"}
] ]
from erpnext.setup.page.setup_wizard.fixtures import industry_type, operations
records += [{"doctype":"Industry Type", "industry": d} for d in industry_type.items]
records += [{"doctype":"Operation", "operation": d} for d in operations.items]
from frappe.modules import scrub from frappe.modules import scrub
for r in records: for r in records:
doc = frappe.new_doc(r.get("doctype")) doc = frappe.new_doc(r.get("doctype"))

View File

@ -427,7 +427,7 @@ class StockEntry(StockController):
pro_doc = frappe.get_doc("Production Order", self.production_order) pro_doc = frappe.get_doc("Production Order", self.production_order)
_validate_production_order(pro_doc) _validate_production_order(pro_doc)
pro_doc.run_method("update_status") pro_doc.run_method("update_status")
if self.purpose == "Manufacture": if self.purpose in ("Manufacture", "Material Transfer for Manufacture"):
pro_doc.run_method("update_production_order_qty") pro_doc.run_method("update_production_order_qty")
self.update_planned_qty(pro_doc) self.update_planned_qty(pro_doc)