Merge pull request #15547 from Zlash65/demo-refactor
Demo data refactor
diff --git a/erpnext/demo/data/employee.json b/erpnext/demo/data/employee.json
index d9f4d2a..2d2dbe8 100644
--- a/erpnext/demo/data/employee.json
+++ b/erpnext/demo/data/employee.json
@@ -1,72 +1,92 @@
[
- {
- "date_of_birth": "1982-01-03",
- "date_of_joining": "2001-10-10",
- "employee_name": "Dikman Shervashidze Shervashidze",
- "gender": "Female",
- "user_id": "DikmanShervashidze@example.com"
- },
- {
- "date_of_birth": "1959-02-03",
- "date_of_joining": "1976-09-16",
- "employee_name": "Zukutakitoteka",
- "gender": "Female",
- "user_id": "Zukutakitoteka@example.com"
- },
- {
- "date_of_birth": "1982-03-03",
- "date_of_joining": "2000-06-16",
- "employee_name": "Hatsue Kashiwagi",
- "gender": "Female",
- "user_id": "HatsueKashiwagi@example.com"
- },
- {
- "date_of_birth": "1945-04-04",
- "date_of_joining": "1969-07-01",
- "employee_name": "Nuran Verkleij",
- "gender": "Female",
- "user_id": "NuranVerkleij@example.com"
- },
- {
- "date_of_birth": "1978-05-03",
- "date_of_joining": "1999-12-24",
- "employee_name": "\u0414\u043c\u0438\u0442\u0440\u0438\u0439 \u041f\u0438\u0440\u043e\u0433\u043e\u0432",
- "gender": "Male",
- "user_id": "aromn@example.com"
- },
- {
- "date_of_birth": "1964-06-03",
- "date_of_joining": "1981-08-05",
- "employee_name": "Tilde Lindqvist",
- "gender": "Female",
- "user_id": "TildeLindqvist@example.com"
- },
- {
- "date_of_birth": "1982-07-03",
- "date_of_joining": "2006-06-10",
- "employee_name": "Micha\u0142 Sobczak",
- "gender": "Male",
- "user_id": "MichalSobczak@example.com"
- },
- {
- "date_of_birth": "1969-08-03",
- "date_of_joining": "1993-10-21",
- "employee_name": "Gabrielle Loftus",
- "gender": "Female",
- "user_id": "GabrielleLoftus@example.com"
- },
- {
- "date_of_birth": "1982-09-03",
- "date_of_joining": "2005-09-06",
- "employee_name": "Vakhita Ryzaev",
- "gender": "Male",
- "user_id": "VakhitaRyzaev@example.com"
- },
- {
- "date_of_birth": "1985-10-03",
- "date_of_joining": "2007-12-25",
- "employee_name": "Charmaine Gaudreau",
- "gender": "Female",
- "user_id": "CharmaineGaudreau@example.com"
- }
+ {
+ "date_of_birth": "1982-01-03",
+ "date_of_joining": "2001-10-10",
+ "employee_name": "Diana Prince",
+ "first_name": "Diana",
+ "last_name": "Prince",
+ "gender": "Female",
+ "user_id": "DianaPrince@example.com"
+ },
+ {
+ "date_of_birth": "1959-02-03",
+ "date_of_joining": "1976-09-16",
+ "employee_name": "Zatanna Zatara",
+ "gender": "Female",
+ "user_id": "ZatannaZatara@example.com",
+ "first_name": "Zatanna",
+ "last_name": "Zatara"
+ },
+ {
+ "date_of_birth": "1982-03-03",
+ "date_of_joining": "2000-06-16",
+ "employee_name": "Holly Granger",
+ "gender": "Female",
+ "user_id": "HollyGranger@example.com",
+ "first_name": "Holly",
+ "last_name": "Granger"
+ },
+ {
+ "date_of_birth": "1945-04-04",
+ "date_of_joining": "1969-07-01",
+ "employee_name": "Neptunia Aquaria",
+ "gender": "Female",
+ "user_id": "NeptuniaAquaria@example.com",
+ "first_name": "Neptunia",
+ "last_name": "Aquaria"
+ },
+ {
+ "date_of_birth": "1978-05-03",
+ "date_of_joining": "1999-12-24",
+ "employee_name": "Arthur Curry",
+ "gender": "Male",
+ "user_id": "ArthurCurry@example.com",
+ "first_name": "Arthur",
+ "last_name": "Curry"
+ },
+ {
+ "date_of_birth": "1964-06-03",
+ "date_of_joining": "1981-08-05",
+ "employee_name": "Thalia Al Ghul",
+ "gender": "Female",
+ "user_id": "ThaliaAlGhul@example.com",
+ "first_name": "Thalia",
+ "last_name": "Al Ghul"
+ },
+ {
+ "date_of_birth": "1982-07-03",
+ "date_of_joining": "2006-06-10",
+ "employee_name": "Maxwell Lord",
+ "gender": "Male",
+ "user_id": "MaxwellLord@example.com",
+ "first_name": "Maxwell",
+ "last_name": "Lord"
+ },
+ {
+ "date_of_birth": "1969-08-03",
+ "date_of_joining": "1993-10-21",
+ "employee_name": "Grace Choi",
+ "gender": "Female",
+ "user_id": "GraceChoi@example.com",
+ "first_name": "Grace",
+ "last_name": "Choi"
+ },
+ {
+ "date_of_birth": "1982-09-03",
+ "date_of_joining": "2005-09-06",
+ "employee_name": "Vandal Savage",
+ "gender": "Male",
+ "user_id": "VandalSavage@example.com",
+ "first_name": "Vandal",
+ "last_name": "Savage"
+ },
+ {
+ "date_of_birth": "1985-10-03",
+ "date_of_joining": "2007-12-25",
+ "employee_name": "Caitlin Snow",
+ "gender": "Female",
+ "user_id": "CaitlinSnow@example.com",
+ "first_name": "Caitlin",
+ "last_name": "Snow"
+ }
]
\ No newline at end of file
diff --git a/erpnext/demo/data/item.json b/erpnext/demo/data/item.json
index 908de15..1d4ed34 100644
--- a/erpnext/demo/data/item.json
+++ b/erpnext/demo/data/item.json
@@ -1,337 +1,493 @@
[
- {
- "default_supplier": "Asiatic Solutions",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "For Upper Bearing",
- "image": "/assets/erpnext_demo/images/disc.png",
- "item_code": "Disc Collars",
- "item_group": "Raw Material",
- "item_name": "Disc Collars"
- },
- {
- "default_supplier": "Nan Duskin",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "CAST IRON, MCMASTER PART NO. 3710T13",
- "image": "/assets/erpnext_demo/images/bearing.jpg",
- "item_code": "Bearing Block",
- "item_group": "Raw Material",
- "item_name": "Bearing Block"
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Wind Mill C Series for Commercial Use 18ft",
- "image": "/assets/erpnext_demo/images/wind-turbine-2.png",
- "item_code": "Wind MIll C Series",
- "item_group": "Products",
- "item_name": "Wind MIll C Series"
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Wind Mill A Series for Home Use 9ft",
- "image": "/assets/erpnext_demo/images/wind-turbine.png",
- "item_code": "Wind Mill A Series",
- "item_group": "Products",
- "item_name": "Wind Mill A Series"
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->",
- "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
- "item_code": "Wind Turbine",
- "item_group": "Products",
- "item_name": "Wind Turbine",
- "has_variants": 1,
- "has_serial_no": 1,
- "attributes":[
- { "attribute": "Size" }
- ]
- },
- {
- "default_supplier": "HomeBase",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1.5 in. Diameter x 36 in. Mild Steel Tubing",
- "image": null,
- "item_code": "Bearing Pipe",
- "item_group": "Raw Material",
- "item_name": "Bearing Pipe"
- },
- {
- "default_supplier": "New World Realty",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",
- "image": null,
- "item_code": "Wing Sheet",
- "item_group": "Raw Material",
- "item_name": "Wing Sheet"
- },
- {
- "default_supplier": "Eagle Hardware",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",
- "image": null,
- "item_code": "Upper Bearing Plate",
- "item_group": "Raw Material",
- "item_name": "Upper Bearing Plate"
- },
- {
- "default_supplier": "Asiatic Solutions",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "Bearing Assembly",
- "image": null,
- "item_code": "Bearing Assembly",
- "item_group": "Sub Assemblies",
- "item_name": "Bearing Assembly"
- },
- {
- "default_supplier": "HomeBase",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
- "image": null,
- "item_code": "Base Plate",
- "item_group": "Raw Material",
- "item_name": "Base Plate",
- "is_sub_contracted_item": 1
- },
- {
- "default_supplier": "Scott Ties",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "N/A",
- "image": null,
- "item_code": "Stand",
- "item_group": "Raw Material",
- "item_name": "Stand"
- },
- {
- "default_supplier": "Eagle Hardware",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",
- "image": null,
- "item_code": "Bearing Collar",
- "item_group": "Raw Material",
- "item_name": "Bearing Collar"
- },
- {
- "default_supplier": "Eagle Hardware",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate",
- "image": null,
- "item_code": "Base Bearing Plate",
- "item_group": "Raw Material",
- "item_name": "Base Bearing Plate"
- },
- {
- "default_supplier": "HomeBase",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",
- "image": null,
- "item_code": "External Disc",
- "item_group": "Raw Material",
- "item_name": "External Disc"
- },
- {
- "default_supplier": "Eagle Hardware",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing",
- "image": null,
- "item_code": "Shaft",
- "item_group": "Raw Material",
- "item_name": "Shaft"
- },
- {
- "default_supplier": "Ks Merchandise",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood",
- "image": null,
- "item_code": "Blade Rib",
- "item_group": "Raw Material",
- "item_name": "Blade Rib"
- },
- {
- "default_supplier": "HomeBase",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "For Bearing Collar",
- "image": null,
- "item_code": "Internal Disc",
- "item_group": "Raw Material",
- "item_name": "Internal Disc"
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Small</p>",
- "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
- "item_code": "Wind Turbine-S",
- "item_group": "Products",
- "item_name": "Wind Turbine-S",
- "variant_of": "Wind Turbine",
- "valuation_rate": 300,
- "attributes":[
- {
- "attribute": "Size",
- "attribute_value": "Small"
- }
- ]
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Medium</p>",
- "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
- "item_code": "Wind Turbine-M",
- "item_group": "Products",
- "item_name": "Wind Turbine-M",
- "variant_of": "Wind Turbine",
- "valuation_rate": 300,
- "attributes":[
- {
- "attribute": "Size",
- "attribute_value": "Medium"
- }
- ]
- },
- {
- "default_supplier": null,
- "item_defaults": [{
- "default_warehouse": "Finished Goods"
- }],
- "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Large</p>",
- "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
- "item_code": "Wind Turbine-L",
- "item_group": "Products",
- "item_name": "Wind Turbine-L",
- "variant_of": "Wind Turbine",
- "valuation_rate": 300,
- "attributes":[
- {
- "attribute": "Size",
- "attribute_value": "Large"
- }
- ]
- },
- {
- "is_stock_item": 0,
- "description": "Wind Mill A Series with Spare Bearing",
- "item_code": "Wind Mill A Series with Spare Bearing",
- "item_group": "Products",
- "item_name": "Wind Mill A Series with Spare Bearing"
- },
- {
- "default_supplier": "HomeBase",
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
- "image": null,
- "item_code": "Base Plate Un Painted",
- "item_group": "Raw Material",
- "item_name": "Base Plate Un Painted"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Furnitures",
- "is_stock_item": 0,
- "description": "Table",
- "item_code": "Table",
- "item_name": "Table",
- "item_group": "Products"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Furnitures",
- "is_stock_item": 0,
- "description": "Chair",
- "item_code": "Chair",
- "item_name": "Chair",
- "item_group": "Products"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Electronic Equipments",
- "is_stock_item": 0,
- "description": "Computer",
- "item_code": "Computer",
- "item_name": "Computer",
- "item_group": "Products"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Electronic Equipments",
- "is_stock_item": 0,
- "description": "Mobile",
- "item_code": "Mobile",
- "item_name": "Mobile",
- "item_group": "Products"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Softwares",
- "is_stock_item": 0,
- "description": "ERP",
- "item_code": "ERP",
- "item_name": "ERP",
- "item_group": "All Item Groups"
- },
- {
- "is_fixed_asset": 1,
- "asset_category": "Softwares",
- "is_stock_item": 0,
- "description": "Autocad",
- "item_code": "Autocad",
- "item_name": "Autocad",
- "item_group": "All Item Groups"
- },
- {
- "is_stock_item": 1,
- "has_batch_no": 1,
- "create_new_batch": 1,
- "valuation_rate": 200,
- "item_defaults": [{
- "default_warehouse": "Stores"
- }],
- "description": "Corrugated Box",
- "item_code": "Corrugated Box",
- "item_name": "Corrugated Box",
- "item_group": "All Item Groups"
- }
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Asiatic Solutions",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "For Upper Bearing",
+ "image": "/assets/erpnext_demo/images/disc.png",
+ "item_code": "Disc Collars",
+ "item_group": "Raw Material",
+ "item_name": "Disc Collars"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Nan Duskin",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "CAST IRON, MCMASTER PART NO. 3710T13",
+ "image": "/assets/erpnext_demo/images/bearing.jpg",
+ "item_code": "Bearing Block",
+ "item_group": "Raw Material",
+ "item_name": "Bearing Block"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Wind Mill C Series for Commercial Use 18ft",
+ "image": "/assets/erpnext_demo/images/wind-turbine-2.png",
+ "item_code": "Wind MIll C Series",
+ "item_group": "Products",
+ "item_name": "Wind MIll C Series"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Wind Mill A Series for Home Use 9ft",
+ "image": "/assets/erpnext_demo/images/wind-turbine.png",
+ "item_code": "Wind Mill A Series",
+ "item_group": "Products",
+ "item_name": "Wind Mill A Series"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->",
+ "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
+ "item_code": "Wind Turbine",
+ "item_group": "Products",
+ "item_name": "Wind Turbine",
+ "has_variants": 1,
+ "has_serial_no": 1,
+ "attributes": [
+ {
+ "attribute": "Size"
+ }
+ ]
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "HomeBase",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1.5 in. Diameter x 36 in. Mild Steel Tubing",
+ "image": null,
+ "item_code": "Bearing Pipe",
+ "item_group": "Raw Material",
+ "item_name": "Bearing Pipe"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "New World Realty",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1/32 in. x 24 in. x 47 in. HDPE Opaque Sheet",
+ "image": null,
+ "item_code": "Wing Sheet",
+ "item_group": "Raw Material",
+ "item_name": "Wing Sheet"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Eagle Hardware",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "3/16 in. x 6 in. x 6 in. Low Carbon Steel Plate",
+ "image": null,
+ "item_code": "Upper Bearing Plate",
+ "item_group": "Raw Material",
+ "item_name": "Upper Bearing Plate"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Asiatic Solutions",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "Bearing Assembly",
+ "image": null,
+ "item_code": "Bearing Assembly",
+ "item_group": "Sub Assemblies",
+ "item_name": "Bearing Assembly"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "HomeBase",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
+ "image": null,
+ "item_code": "Base Plate",
+ "item_group": "Raw Material",
+ "item_name": "Base Plate",
+ "is_sub_contracted_item": 1
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Scott Ties",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "N/A",
+ "image": null,
+ "item_code": "Stand",
+ "item_group": "Raw Material",
+ "item_name": "Stand"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Eagle Hardware",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1 in. x 3 in. x 1 ft. Multipurpose Al Alloy Bar",
+ "image": null,
+ "item_code": "Bearing Collar",
+ "item_group": "Raw Material",
+ "item_name": "Bearing Collar"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Eagle Hardware",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1/4 in. x 6 in. x 6 in. Mild Steel Plate",
+ "image": null,
+ "item_code": "Base Bearing Plate",
+ "item_group": "Raw Material",
+ "item_name": "Base Bearing Plate"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "HomeBase",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "15/32 in. x 4 ft. x 8 ft. 3-Ply Rtd Sheathing",
+ "image": null,
+ "item_code": "External Disc",
+ "item_group": "Raw Material",
+ "item_name": "External Disc"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Eagle Hardware",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1.25 in. Diameter x 6 ft. Mild Steel Tubing",
+ "image": null,
+ "item_code": "Shaft",
+ "item_group": "Raw Material",
+ "item_name": "Shaft"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "Ks Merchandise",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "1/2 in. x 2 ft. x 4 ft. Pine Plywood",
+ "image": null,
+ "item_code": "Blade Rib",
+ "item_group": "Raw Material",
+ "item_name": "Blade Rib"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "HomeBase",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "For Bearing Collar",
+ "image": null,
+ "item_code": "Internal Disc",
+ "item_group": "Raw Material",
+ "item_name": "Internal Disc"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Small</p>",
+ "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
+ "item_code": "Wind Turbine-S",
+ "item_group": "Products",
+ "item_name": "Wind Turbine-S",
+ "variant_of": "Wind Turbine",
+ "valuation_rate": 300,
+ "attributes": [
+ {
+ "attribute": "Size",
+ "attribute_value": "Small"
+ }
+ ]
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Medium</p>",
+ "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
+ "item_code": "Wind Turbine-M",
+ "item_group": "Products",
+ "item_name": "Wind Turbine-M",
+ "variant_of": "Wind Turbine",
+ "valuation_rate": 300,
+ "attributes": [
+ {
+ "attribute": "Size",
+ "attribute_value": "Medium"
+ }
+ ]
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": null,
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "description": "Small Wind Turbine for Home Use\n\n\n<!-- html -->\n<p>Size: Large</p>",
+ "image": "/assets/erpnext_demo/images/wind-turbine-1.jpg",
+ "item_code": "Wind Turbine-L",
+ "item_group": "Products",
+ "item_name": "Wind Turbine-L",
+ "variant_of": "Wind Turbine",
+ "valuation_rate": 300,
+ "attributes": [
+ {
+ "attribute": "Size",
+ "attribute_value": "Large"
+ }
+ ]
+ },
+ {
+ "is_stock_item": 0,
+ "description": "Wind Mill A Series with Spare Bearing",
+ "item_code": "Wind Mill A Series with Spare Bearing",
+ "item_group": "Products",
+ "item_name": "Wind Mill A Series with Spare Bearing"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_supplier": "HomeBase",
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "3/4 in. x 2 ft. x 4 ft. Pine Plywood",
+ "image": null,
+ "item_code": "Base Plate Un Painted",
+ "item_group": "Raw Material",
+ "item_name": "Base Plate Un Painted"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Furnitures",
+ "is_stock_item": 0,
+ "description": "Table",
+ "item_code": "Table",
+ "item_name": "Table",
+ "item_group": "Products"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Furnitures",
+ "is_stock_item": 0,
+ "description": "Chair",
+ "item_code": "Chair",
+ "item_name": "Chair",
+ "item_group": "Products"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Electronic Equipments",
+ "is_stock_item": 0,
+ "description": "Computer",
+ "item_code": "Computer",
+ "item_name": "Computer",
+ "item_group": "Products"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Electronic Equipments",
+ "is_stock_item": 0,
+ "description": "Mobile",
+ "item_code": "Mobile",
+ "item_name": "Mobile",
+ "item_group": "Products"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Softwares",
+ "is_stock_item": 0,
+ "description": "ERP",
+ "item_code": "ERP",
+ "item_name": "ERP",
+ "item_group": "All Item Groups"
+ },
+ {
+ "is_fixed_asset": 1,
+ "asset_category": "Softwares",
+ "is_stock_item": 0,
+ "description": "Autocad",
+ "item_code": "Autocad",
+ "item_name": "Autocad",
+ "item_group": "All Item Groups"
+ },
+ {
+ "is_stock_item": 1,
+ "has_batch_no": 1,
+ "create_new_batch": 1,
+ "valuation_rate": 200,
+ "item_defaults": [
+ {
+ "default_warehouse": "Stores"
+ }
+ ],
+ "description": "Corrugated Box",
+ "item_code": "Corrugated Box",
+ "item_name": "Corrugated Box",
+ "item_group": "All Item Groups"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "OnePlus 6",
+ "item_code": "OnePlus 6",
+ "item_name": "OnePlus 6",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "OnePlus 6T",
+ "item_code": "OnePlus 6T",
+ "item_name": "OnePlus 6T",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "Xiaomi Poco F1",
+ "item_code": "Xiaomi Poco F1",
+ "item_name": "Xiaomi Poco F1",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "Iphone XS",
+ "item_code": "Iphone XS",
+ "item_name": "Iphone XS",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "Samsung Galaxy S9",
+ "item_code": "Samsung Galaxy S9",
+ "item_name": "Samsung Galaxy S9",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "item_defaults": [
+ {
+ "default_warehouse": "Finished Goods"
+ }
+ ],
+ "is_stock_item": 1,
+ "description": "Sony Bluetooth Headphone",
+ "item_code": "Sony Bluetooth Headphone",
+ "item_name": "Sony Bluetooth Headphone",
+ "item_group": "Products",
+ "domain": "Retail"
+ },
+ {
+ "is_stock_item": 0,
+ "description": "Samsung Phone Repair",
+ "item_code": "Samsung Phone Repair",
+ "item_name": "Samsung Phone Repair",
+ "item_group": "Services",
+ "domain": "Retail"
+ },
+ {
+ "is_stock_item": 0,
+ "description": "OnePlus Phone Repair",
+ "item_code": "OnePlus Phone Repair",
+ "item_name": "OnePlus Phone Repair",
+ "item_group": "Services",
+ "domain": "Retail"
+ },
+ {
+ "is_stock_item": 0,
+ "description": "Xiaomi Phone Repair",
+ "item_code": "Xiaomi Phone Repair",
+ "item_name": "Xiaomi Phone Repair",
+ "item_group": "Services",
+ "domain": "Retail"
+ },
+ {
+ "is_stock_item": 0,
+ "description": "Apple Phone Repair",
+ "item_code": "Apple Phone Repair",
+ "item_name": "Apple Phone Repair",
+ "item_group": "Services",
+ "domain": "Retail"
+ }
]
\ No newline at end of file
diff --git a/erpnext/demo/data/user.json b/erpnext/demo/data/user.json
index 811e8af..9ee5e78 100644
--- a/erpnext/demo/data/user.json
+++ b/erpnext/demo/data/user.json
@@ -5,104 +5,104 @@
"last_name": "User"
},
{
- "email": "DikmanShervashidze@example.com",
- "first_name": "Dikman",
- "last_name": "Shervashidze"
+ "email": "DianaPrince@example.com",
+ "first_name": "Diana",
+ "last_name": "Prince"
},
{
- "email": "Zukutakitoteka@example.com",
- "first_name": "Zukutakitoteka",
- "last_name": null
+ "email": "ZatannaZatara@example.com",
+ "first_name": "Zatanna",
+ "last_name": "Zatara"
},
{
- "email": "HatsueKashiwagi@example.com",
- "first_name": "Hatsue",
- "last_name": "Kashiwagi"
+ "email": "HollyGranger@example.com",
+ "first_name": "Holly",
+ "last_name": "Granger"
},
{
- "email": "NuranVerkleij@example.com",
- "first_name": "Nuran",
- "last_name": "Verkleij"
+ "email": "NeptuniaAquaria@example.com",
+ "first_name": "Neptunia",
+ "last_name": "Aquaria"
},
{
- "email": "aromn@example.com",
- "first_name": "Arom",
- "last_name": "Nolan"
+ "email": "ArthurCurry@example.com",
+ "first_name": "Arthur",
+ "last_name": "Curry"
},
{
- "email": "TildeLindqvist@example.com",
- "first_name": "Tilde",
- "last_name": "Lindqvist"
+ "email": "ThaliaAlGhul@example.com",
+ "first_name": "Thalia",
+ "last_name": "Al Ghul"
},
{
- "email": "MichalSobczak@example.com",
- "first_name": "Micha\u0142",
- "last_name": "Sobczak"
+ "email": "MaxwellLord@example.com",
+ "first_name": "Maxwell",
+ "last_name": "Lord"
},
{
- "email": "GabrielleLoftus@example.com",
- "first_name": "Gabrielle",
- "last_name": "Loftus"
+ "email": "GraceChoi@example.com",
+ "first_name": "Grace",
+ "last_name": "Choi"
},
{
- "email": "VakhitaRyzaev@example.com",
- "first_name": "Vakhita",
- "last_name": "Ryzaev"
+ "email": "VandalSavage@example.com",
+ "first_name": "Vandal",
+ "last_name": "Savage"
},
{
- "email": "CharmaineGaudreau@example.com",
- "first_name": "Charmaine",
- "last_name": "Gaudreau"
+ "email": "CaitlinSnow@example.com",
+ "first_name": "Caitlin",
+ "last_name": "Snow"
},
{
- "email": "RafaelaMaartens@example.com",
- "first_name": "Rafa\u00ebla",
- "last_name": "Maartens"
+ "email": "RipHunter@example.com",
+ "first_name": "Rip",
+ "last_name": "Hunter"
},
{
- "email": "NuguseYohannes@example.com",
- "first_name": "Nuguse",
- "last_name": "Yohannes"
+ "email": "NicholasFury@example.com",
+ "first_name": "Nicholas",
+ "last_name": "Fury"
},
{
- "email": "panca@example.com",
- "first_name": "\u0420\u0430\u0438\u0441\u0430",
- "last_name": "\u0411\u0435\u043b\u044f\u043a\u043e\u0432\u0430"
+ "email": "PeterParker@example.com",
+ "first_name": "Peter",
+ "last_name": "Parker"
},
{
- "email": "CaYinLong@example.com",
- "first_name": "\u80e4\u9686",
- "last_name": "\u8521"
+ "email": "JohnConstantine@example.com",
+ "first_name": "John",
+ "last_name": "Constantine"
},
{
- "email": "FreddieScott@example.com",
- "first_name": "Freddie",
- "last_name": "Scott"
+ "email": "HalJordan@example.com",
+ "first_name": "Hal",
+ "last_name": "Jordan"
},
{
- "email": "BergoraVigfusdottir@example.com",
- "first_name": "Berg\u00fe\u00f3ra",
- "last_name": "Vigf\u00fasd\u00f3ttir"
+ "email": "VictorStone@example.com",
+ "first_name": "Victor",
+ "last_name": "Stone"
},
{
- "email": "WardNajmalDinKalb@example.com",
- "first_name": "Ward",
- "last_name": "Kalb"
+ "email": "BruceWayne@example.com",
+ "first_name": "Bruce",
+ "last_name": "Wayne"
},
{
- "email": "WanMai@example.com",
- "first_name": "Wan",
- "last_name": "Mai"
+ "email": "ClarkKent@example.com",
+ "first_name": "Clark",
+ "last_name": "Kent"
},
{
- "email": "LeonAbdulov@example.com",
- "first_name": "Leon",
- "last_name": "Abdulov"
+ "email": "BarryAllen@example.com",
+ "first_name": "Barry",
+ "last_name": "Allen"
},
{
- "email": "SabinaNovotna@example.com",
- "first_name": "Sabina",
- "last_name": "Novotn\u00e1"
+ "email": "KaraZorEl@example.com",
+ "first_name": "Kara",
+ "last_name": "Zor El"
},
{
"email": "demo@erpnext.com",
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index f765469..e89b689 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -3,8 +3,9 @@
import frappe, sys
import erpnext
import frappe.utils
-from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset, education
-from erpnext.demo.setup import education, manufacture, setup_data, healthcare
+from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset
+from erpnext.demo.user import education as edu
+from erpnext.demo.setup import education, manufacture, setup_data, healthcare, retail
"""
Make a demo
@@ -28,6 +29,8 @@
setup_data.setup(domain)
if domain== 'Manufacturing':
manufacture.setup_data()
+ elif domain == "Retail":
+ retail.setup_data()
elif domain== 'Education':
education.setup_data()
elif domain== 'Healthcare':
@@ -77,13 +80,13 @@
stock.work()
accounts.work()
projects.run_projects(current_date)
+ sales.work(domain)
# run_messages()
if domain=='Manufacturing':
- sales.work()
manufacturing.work()
elif domain=='Education':
- education.work()
+ edu.work()
except:
frappe.db.set_global('demo_last_date', current_date)
diff --git a/erpnext/demo/domains.py b/erpnext/demo/domains.py
index 5ad3e04..d5c2bfd 100644
--- a/erpnext/demo/domains.py
+++ b/erpnext/demo/domains.py
@@ -5,7 +5,7 @@
'company_name': 'Wind Power LLC'
},
'Retail': {
- 'company_name': 'Annapurna Dairy Shop',
+ 'company_name': 'Mobile Next',
},
'Distribution': {
'company_name': 'Soltice Hardware',
diff --git a/erpnext/demo/setup/retail.py b/erpnext/demo/setup/retail.py
new file mode 100644
index 0000000..82d1c15
--- /dev/null
+++ b/erpnext/demo/setup/retail.py
@@ -0,0 +1,65 @@
+from __future__ import unicode_literals
+
+import random, json
+import frappe
+from frappe.utils import nowdate, add_days
+from erpnext.demo.setup.setup_data import import_json
+from erpnext.demo.domains import data
+
+from six import iteritems
+
+def setup_data():
+ setup_item()
+ setup_item_price()
+ frappe.db.commit()
+ frappe.clear_cache()
+
+def setup_item():
+ items = json.loads(open(frappe.get_app_path('erpnext', 'demo', 'data', 'item.json')).read())
+ for i in items:
+ if not i.get("domain") == "Retail": continue
+ item = frappe.new_doc('Item')
+ item.update(i)
+ if hasattr(item, 'item_defaults') and item.item_defaults[0].default_warehouse:
+ item.item_defaults[0].company = data.get("Retail").get('company_name')
+ warehouse = frappe.get_all('Warehouse', filters={'warehouse_name': item.item_defaults[0].default_warehouse}, limit=1)
+ if warehouse:
+ item.item_defaults[0].default_warehouse = warehouse[0].name
+ item.insert()
+
+def setup_item_price():
+ frappe.db.sql("delete from `tabItem Price`")
+
+ standard_selling = {
+ "OnePlus 6": 579,
+ "OnePlus 6T": 600,
+ "Xiaomi Poco F1": 300,
+ "Iphone XS": 999,
+ "Samsung Galaxy S9": 720,
+ "Sony Bluetooth Headphone": 99,
+ "Xiaomi Phone Repair": 10,
+ "Samsung Phone Repair": 20,
+ "OnePlus Phone Repair": 15,
+ "Apple Phone Repair": 30,
+ }
+
+ standard_buying = {
+ "OnePlus 6": 300,
+ "OnePlus 6T": 350,
+ "Xiaomi Poco F1": 200,
+ "Iphone XS": 600,
+ "Samsung Galaxy S9": 500,
+ "Sony Bluetooth Headphone": 69
+ }
+
+ for price_list in ("standard_buying", "standard_selling"):
+ for item, rate in iteritems(locals().get(price_list)):
+ frappe.get_doc({
+ "doctype": "Item Price",
+ "price_list": price_list.replace("_", " ").title(),
+ "item_code": item,
+ "selling": 1 if price_list=="standard_selling" else 0,
+ "buying": 1 if price_list=="standard_buying" else 0,
+ "price_list_rate": rate,
+ "currency": "USD"
+ }).insert()
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 911d418..0fd7bb7 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -5,6 +5,7 @@
from frappe.utils.nestedset import get_root_of
from frappe.utils import flt, now_datetime, cstr, random_string
from frappe.utils.make_random import add_random_children, get_random
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from erpnext.demo.domains import data
from frappe import _
@@ -14,9 +15,10 @@
setup_fiscal_year()
setup_holiday_list()
setup_user()
- #setup_employee()
+ setup_employee()
setup_user_roles()
setup_role_permissions()
+ setup_custom_field_for_domain()
employees = frappe.get_all('Employee', fields=['name', 'date_of_joining'])
@@ -120,7 +122,7 @@
user = frappe.new_doc("User")
user.update(u)
user.flags.no_welcome_mail = True
- user.new_password = 'demo'
+ user.new_password = 'Demo1234567!!!'
user.insert()
def setup_employee():
@@ -136,6 +138,8 @@
salary_component.save()
import_json('Employee')
+ holiday_list = frappe.db.get_value("Holiday List", {"holiday_list_name": str(now_datetime().year)}, 'name')
+ frappe.db.sql('''update tabEmployee set holiday_list={0}'''.format(holiday_list))
def setup_salary_structure(employees, salary_slip_based_on_timesheet=0):
ss = frappe.new_doc('Salary Structure')
@@ -166,12 +170,16 @@
"idx": 1
})
ss.insert()
+ ss.submit()
for e in employees:
sa = frappe.new_doc("Salary Structure Assignment")
sa.employee = e.name
+ sa.salary_structure = ss.name
sa.from_date = "2015-01-01"
sa.base = random.random() * 10000
+ sa.insert()
+ sa.submit()
return ss
@@ -184,52 +192,63 @@
'Nursing User', 'Patient')
if not frappe.db.get_global('demo_hr_user'):
- user = frappe.get_doc('User', 'CharmaineGaudreau@example.com')
+ user = frappe.get_doc('User', 'CaitlinSnow@example.com')
user.add_roles('HR User', 'HR Manager', 'Accounts User')
frappe.db.set_global('demo_hr_user', user.name)
+ update_employee_department(user.name, 'Human Resources')
+ for d in frappe.get_all('User Permission', filters={"user": "CaitlinSnow@example.com"}):
+ frappe.delete_doc('User Permission', d.name)
if not frappe.db.get_global('demo_sales_user_1'):
- user = frappe.get_doc('User', 'VakhitaRyzaev@example.com')
+ user = frappe.get_doc('User', 'VandalSavage@example.com')
user.add_roles('Sales User')
+ update_employee_department(user.name, 'Sales')
frappe.db.set_global('demo_sales_user_1', user.name)
if not frappe.db.get_global('demo_sales_user_2'):
- user = frappe.get_doc('User', 'GabrielleLoftus@example.com')
+ user = frappe.get_doc('User', 'GraceChoi@example.com')
user.add_roles('Sales User', 'Sales Manager', 'Accounts User')
+ update_employee_department(user.name, 'Sales')
frappe.db.set_global('demo_sales_user_2', user.name)
if not frappe.db.get_global('demo_purchase_user'):
- user = frappe.get_doc('User', 'MichalSobczak@example.com')
+ user = frappe.get_doc('User', 'MaxwellLord@example.com')
user.add_roles('Purchase User', 'Purchase Manager', 'Accounts User', 'Stock User')
+ update_employee_department(user.name, 'Purchase')
frappe.db.set_global('demo_purchase_user', user.name)
if not frappe.db.get_global('demo_manufacturing_user'):
- user = frappe.get_doc('User', 'NuranVerkleij@example.com')
+ user = frappe.get_doc('User', 'NeptuniaAquaria@example.com')
user.add_roles('Manufacturing User', 'Stock User', 'Purchase User', 'Accounts User')
+ update_employee_department(user.name, 'Production')
frappe.db.set_global('demo_manufacturing_user', user.name)
if not frappe.db.get_global('demo_stock_user'):
- user = frappe.get_doc('User', 'HatsueKashiwagi@example.com')
+ user = frappe.get_doc('User', 'HollyGranger@example.com')
user.add_roles('Manufacturing User', 'Stock User', 'Purchase User', 'Accounts User')
+ update_employee_department(user.name, 'Production')
frappe.db.set_global('demo_stock_user', user.name)
if not frappe.db.get_global('demo_accounts_user'):
- user = frappe.get_doc('User', 'LeonAbdulov@example.com')
+ user = frappe.get_doc('User', 'BarryAllen@example.com')
user.add_roles('Accounts User', 'Accounts Manager', 'Sales User', 'Purchase User')
+ update_employee_department(user.name, 'Accounts')
frappe.db.set_global('demo_accounts_user', user.name)
if not frappe.db.get_global('demo_projects_user'):
- user = frappe.get_doc('User', 'panca@example.com')
+ user = frappe.get_doc('User', 'PeterParker@example.com')
user.add_roles('HR User', 'Projects User')
+ update_employee_department(user.name, 'Management')
frappe.db.set_global('demo_projects_user', user.name)
if not frappe.db.get_global('demo_education_user'):
- user = frappe.get_doc('User', 'aromn@example.com')
+ user = frappe.get_doc('User', 'ArthurCurry@example.com')
user.add_roles('Academics User')
+ update_employee_department(user.name, 'Management')
frappe.db.set_global('demo_education_user', user.name)
#Add Expense Approver
- user = frappe.get_doc('User', 'WanMai@example.com')
+ user = frappe.get_doc('User', 'ClarkKent@example.com')
user.add_roles('Expense Approver')
def setup_leave_allocation():
@@ -403,3 +422,19 @@
frappe.db.commit()
frappe.flags.in_import = False
+
+def update_employee_department(user_id, department):
+ employee = frappe.db.get_value('Employee', {"user_id": user_id}, 'name')
+ department = frappe.db.get_value('Department', {'department_name': department}, 'name')
+ frappe.db.set_value('Employee', employee, 'department', department)
+
+def setup_custom_field_for_domain():
+ field = {
+ "Item": [
+ dict(fieldname='domain', label='Domain',
+ fieldtype='Select', hidden=1, default="Manufacturing",
+ options="Manufacturing\nService\nDistribution\nRetail"
+ )
+ ]
+ }
+ create_custom_fields(field)
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index a12933b..1885504 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -56,7 +56,7 @@
if random.random() < 0.5:
make_payment_entries("Purchase Invoice", "Accounts Payable")
- if random.random() < 0.1:
+ if random.random() < 0.4:
#make payment request against sales invoice
sales_invoice_name = get_random("Sales Invoice", filters={"docstatus": 1})
if sales_invoice_name:
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index b801686..79f3c19 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -14,34 +14,31 @@
def work():
frappe.set_user(frappe.db.get_global('demo_hr_user'))
year, month = frappe.flags.current_date.strftime("%Y-%m").split("-")
+ setup_department_approvers()
mark_attendance()
make_leave_application()
# payroll entry
if not frappe.db.sql('select name from `tabSalary Slip` where month(adddate(start_date, interval 1 month))=month(curdate())'):
- # process payroll for previous month
- payroll_entry = frappe.new_doc("Payroll Entry")
- payroll_entry.company = frappe.flags.company
- payroll_entry.payroll_frequency = 'Monthly'
-
- # select a posting date from the previous month
- payroll_entry.posting_date = get_last_day(getdate(frappe.flags.current_date) - datetime.timedelta(days=10))
- payroll_entry.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
-
- payroll_entry.set_start_end_dates()
-
# based on frequency
+ payroll_entry = get_payroll_entry()
payroll_entry.salary_slip_based_on_timesheet = 0
+ payroll_entry.save()
payroll_entry.create_salary_slips()
payroll_entry.submit_salary_slips()
payroll_entry.make_accrual_jv_entry()
+ payroll_entry.submit()
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
# reference_number=random_string(10))
+ # based on timesheet
+ payroll_entry = get_payroll_entry()
payroll_entry.salary_slip_based_on_timesheet = 1
+ payroll_entry.save()
payroll_entry.create_salary_slips()
payroll_entry.submit_salary_slips()
payroll_entry.make_accrual_jv_entry()
+ payroll_entry.submit()
# payroll_entry.make_journal_entry(reference_date=frappe.flags.current_date,
# reference_number=random_string(10))
@@ -55,12 +52,14 @@
expense_claim.company = frappe.flags.company
expense_claim.payable_account = get_payable_account(expense_claim.company)
expense_claim.posting_date = frappe.flags.current_date
- expense_claim.insert()
+ expense_claim.expense_approver = frappe.db.get_global('demo_hr_user')
+ expense_claim.save()
rand = random.random()
if rand < 0.4:
update_sanctioned_amount(expense_claim)
+ expense_claim.approval_status = 'Approved'
expense_claim.submit()
if random.randint(0, 1):
@@ -72,6 +71,19 @@
je.flags.ignore_permissions = 1
je.submit()
+def get_payroll_entry():
+ # process payroll for previous month
+ payroll_entry = frappe.new_doc("Payroll Entry")
+ payroll_entry.company = frappe.flags.company
+ payroll_entry.payroll_frequency = 'Monthly'
+
+ # select a posting date from the previous month
+ payroll_entry.posting_date = get_last_day(getdate(frappe.flags.current_date) - datetime.timedelta(days=10))
+ payroll_entry.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name")
+
+ payroll_entry.set_start_end_dates()
+ return payroll_entry
+
def get_expenses():
expenses = []
expese_types = frappe.db.sql("""select ect.name, eca.default_account from `tabExpense Claim Type` ect,
@@ -114,7 +126,7 @@
def make_timesheet_records():
employees = get_timesheet_based_salary_slip_employee()
for e in employees:
- ts = make_timesheet(e.employee, simulate = True, billable = 1, activity_type=get_random("Activity Type"))
+ ts = make_timesheet(e.employee, simulate = True, billable = 1, activity_type=get_random("Activity Type"), company=frappe.flags.company)
frappe.db.commit()
rand = random.random()
@@ -195,3 +207,11 @@
attendance.save()
attendance.submit()
frappe.db.commit()
+
+def setup_department_approvers():
+ for d in frappe.get_all('Department', filters={'department_name': ['!=', 'All Departments']}):
+ doc = frappe.get_doc('Department', d.name)
+ doc.append("leave_approvers", {'approver': frappe.session.user})
+ doc.append("expense_approvers", {'approver': frappe.session.user})
+ doc.flags.ignore_mandatory = True
+ doc.save()
diff --git a/erpnext/demo/user/manufacturing.py b/erpnext/demo/user/manufacturing.py
index 0231eda9..a28d061 100644
--- a/erpnext/demo/user/manufacturing.py
+++ b/erpnext/demo/user/manufacturing.py
@@ -4,25 +4,32 @@
from __future__ import unicode_literals
import frappe, random, erpnext
+from datetime import timedelta
from frappe.utils.make_random import how_many
from frappe.desk import query_report
from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
def work():
+ if random.random() < 0.3: return
+
frappe.set_user(frappe.db.get_global('demo_manufacturing_user'))
+ if not frappe.get_all('Sales Order'): return
from erpnext.projects.doctype.timesheet.timesheet import OverlapError
- ppt = frappe.get_doc("Production Planning Tool", "Production Planning Tool")
+ ppt = frappe.new_doc("Production Plan")
ppt.company = erpnext.get_default_company()
- ppt.use_multi_level_bom = 1
+ # ppt.use_multi_level_bom = 1 #refactored
ppt.get_items_from = "Sales Order"
- ppt.purchase_request_for_warehouse = "Stores - WPL"
+ # ppt.purchase_request_for_warehouse = "Stores - WPL" # refactored
ppt.run_method("get_open_sales_orders")
+ if not ppt.get("sales_orders"): return
ppt.run_method("get_items")
- ppt.run_method("raise_work_orders")
ppt.run_method("raise_material_requests")
+ ppt.save()
+ ppt.submit()
+ ppt.run_method("raise_work_orders")
frappe.db.commit()
# submit work orders
@@ -39,12 +46,12 @@
frappe.db.commit()
# stores -> wip
- if random.random() < 0.3:
+ if random.random() < 0.4:
for pro in query_report.run("Open Work Orders")["result"][:how_many("Stock Entry for WIP")]:
make_stock_entry_from_pro(pro[0], "Material Transfer for Manufacture")
# wip -> fg
- if random.random() < 0.3:
+ if random.random() < 0.4:
for pro in query_report.run("Work Orders in Progress")["result"][:how_many("Stock Entry for FG")]:
make_stock_entry_from_pro(pro[0], "Manufacture")
@@ -55,17 +62,9 @@
stock_uom = frappe.db.get_value('Item', bom.item, 'stock_uom'),
planned_start_date = frappe.flags.current_date)
- # submit time logs
- for timesheet in frappe.get_all("Timesheet", ["name"], {"docstatus": 0,
- "work_order": ("!=", ""), "to_time": ("<", frappe.flags.current_date)}):
- timesheet = frappe.get_doc("Timesheet", timesheet.name)
- try:
- timesheet.submit()
- frappe.db.commit()
- except OverlapError:
- pass
- except WorkstationHolidayError:
- pass
+ # submit job card
+ if random.random() < 0.4:
+ submit_job_cards()
def make_stock_entry_from_pro(pro_id, purpose):
from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
@@ -86,3 +85,27 @@
except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForWorkOrderError,
OperationsNotCompleteError):
frappe.db.rollback()
+
+def submit_job_cards():
+ work_orders = frappe.get_all("Work Order", ["name", "creation"], {"docstatus": 1, "status": "Not Started"})
+ work_order = random.choice(work_orders)
+ # for work_order in work_orders:
+ start_date = work_order.creation
+ work_order = frappe.get_doc("Work Order", work_order.name)
+ job = frappe.get_all("Job Card", ["name", "operation", "work_order"],
+ {"docstatus": 0, "work_order": work_order.name})
+
+ if not job: return
+ job_map = {}
+ for d in job:
+ job_map[d.operation] = frappe.get_doc("Job Card", d.name)
+
+ for operation in work_order.operations:
+ job = job_map[operation.operation]
+ job.actual_start_date = start_date
+ minutes = operation.get("time_in_mins")
+ random_minutes = random.randint(int(minutes/2), minutes)
+ job.actual_end_date = job.actual_start_date + timedelta(minutes=random_minutes)
+ start_date = job.actual_end_date
+ job.save()
+ job.submit()
diff --git a/erpnext/demo/user/projects.py b/erpnext/demo/user/projects.py
index 9802447..ee87199 100644
--- a/erpnext/demo/user/projects.py
+++ b/erpnext/demo/user/projects.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
-import frappe
+import frappe, erpnext
from frappe.utils import flt
from frappe.utils.make_random import get_random
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
@@ -19,7 +19,7 @@
def make_timesheet_for_projects(current_date ):
for data in frappe.get_all("Task", ["name", "project"], {"status": "Open", "exp_end_date": ("<", current_date)}):
employee = get_random("Employee")
- ts = make_timesheet(employee, simulate = True, billable = 1,
+ ts = make_timesheet(employee, simulate = True, billable = 1, company = erpnext.get_default_company(),
activity_type=get_random("Activity Type"), project=data.project, task =data.name)
if flt(ts.total_billable_amount) > 0.0:
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index ad99de9..6993044 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
-import frappe, random
+import frappe, random, json, erpnext
from frappe.utils.make_random import how_many, get_random
from frappe.desk import query_report
from erpnext.setup.utils import get_exchange_rate
@@ -16,14 +16,14 @@
def work():
frappe.set_user(frappe.db.get_global('demo_purchase_user'))
- if random.random() < 0.3:
+ if random.random() < 0.6:
report = "Items To Be Requested"
for row in query_report.run(report)["result"][:random.randint(1, 5)]:
item_code, qty = row[0], abs(row[-1])
mr = make_material_request(item_code, qty)
- if random.random() < 0.3:
+ if random.random() < 0.6:
for mr in frappe.get_all('Material Request',
filters={'material_request_type': 'Purchase', 'status': 'Open'},
limit=random.randint(1,6)):
@@ -36,7 +36,7 @@
rfq.submit()
# Make suppier quotation from RFQ against each supplier.
- if random.random() < 0.3:
+ if random.random() < 0.6:
for rfq in frappe.get_all('Request for Quotation',
filters={'status': 'Open'}, limit=random.randint(1, 6)):
if not frappe.get_all('Supplier Quotation',
@@ -51,15 +51,15 @@
# get supplier details
supplier = get_random("Supplier")
- company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
- party_account_currency = get_party_account_currency("Supplier", supplier, "Wind Power LLC")
+ company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
+ party_account_currency = get_party_account_currency("Supplier", supplier, erpnext.get_default_company())
if company_currency == party_account_currency:
exchange_rate = 1
else:
exchange_rate = get_exchange_rate(party_account_currency, company_currency, args="for_buying")
# make supplier quotations
- if random.random() < 0.2:
+ if random.random() < 0.5:
from erpnext.stock.doctype.material_request.material_request import make_supplier_quotation
report = "Material Requests for which Supplier Quotations are not created"
@@ -80,16 +80,20 @@
report = "Requested Items To Be Ordered"
for row in query_report.run(report)["result"][:how_many("Purchase Order")]:
if row[0] != "'Total'":
- po = frappe.get_doc(make_purchase_order(row[0]))
- po.supplier = supplier
- po.currency = party_account_currency or company_currency
- po.conversion_rate = exchange_rate
- po.transaction_date = frappe.flags.current_date
- po.insert()
- po.submit()
- frappe.db.commit()
+ try:
+ po = frappe.get_doc(make_purchase_order(row[0]))
+ po.supplier = supplier
+ po.currency = party_account_currency or company_currency
+ po.conversion_rate = exchange_rate
+ po.transaction_date = frappe.flags.current_date
+ po.insert()
+ po.submit()
+ except Exception:
+ pass
+ else:
+ frappe.db.commit()
- if random.random() < 0.2:
+ if random.random() < 0.5:
make_subcontract()
def make_material_request(item_code, qty):
@@ -122,13 +126,14 @@
rfq.append("suppliers", { "supplier": supplier })
def make_subcontract():
- from erpnext.buying.doctype.purchase_order.purchase_order import make_stock_entry
+ from erpnext.buying.doctype.purchase_order.purchase_order import make_rm_stock_entry
item_code = get_random("Item", {"is_sub_contracted_item": 1})
if item_code:
# make sub-contract PO
po = frappe.new_doc("Purchase Order")
po.is_subcontracted = "Yes"
po.supplier = get_random("Supplier")
+ po.transaction_date = frappe.flags.current_date # added
po.schedule_date = frappe.utils.add_days(frappe.flags.current_date, 7)
item_code = get_random("Item", {"is_sub_contracted_item": 1})
@@ -150,7 +155,20 @@
make_material_request(po.items[0].item_code, po.items[0].qty)
# transfer material for sub-contract
- stock_entry = frappe.get_doc(make_stock_entry(po.name, po.items[0].item_code))
+ rm_items = get_rm_item(po.items[0], po.supplied_items[0])
+ stock_entry = frappe.get_doc(make_rm_stock_entry(po.name, json.dumps([rm_items])))
stock_entry.from_warehouse = "Stores - WPL"
stock_entry.to_warehouse = "Supplier - WPL"
stock_entry.insert()
+
+def get_rm_item(items, supplied_items):
+ return {
+ "item_code": items.get("item_code"),
+ "rm_item_code": supplied_items.get("rm_item_code"),
+ "item_name": supplied_items.get("rm_item_code"),
+ "qty": supplied_items.get("required_qty") + random.randint(3,10),
+ "amount": supplied_items.get("amount"),
+ "warehouse": supplied_items.get("reserve_warehouse"),
+ "rate": supplied_items.get("rate"),
+ "stock_uom": supplied_items.get("stock_uom")
+ }
diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py
index 65d7f55..69ba900 100644
--- a/erpnext/demo/user/sales.py
+++ b/erpnext/demo/user/sales.py
@@ -3,22 +3,23 @@
from __future__ import unicode_literals
-import frappe, random
+import frappe, random, erpnext
from frappe.utils import flt
from frappe.utils.make_random import add_random_children, get_random
from erpnext.setup.utils import get_exchange_rate
from erpnext.accounts.party import get_party_account_currency
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request, make_payment_entry
-def work():
+def work(domain="Manufacturing"):
frappe.set_user(frappe.db.get_global('demo_sales_user_2'))
- if random.random() < 0.5:
- for i in range(random.randint(1,7)):
- make_opportunity()
- if random.random() < 0.5:
- for i in range(random.randint(1,3)):
- make_quotation()
+ for i in range(random.randint(1,7)):
+ if random.random() < 0.5:
+ make_opportunity(domain)
+
+ for i in range(random.randint(1,3)):
+ if random.random() < 0.5:
+ make_quotation(domain)
# lost quotations / inquiries
if random.random() < 0.3:
@@ -32,24 +33,27 @@
if opportunity and opportunity.status in ('Open', 'Replied'):
opportunity.declare_enquiry_lost('Did not ask')
- if random.random() < 0.3:
- for i in range(random.randint(1,3)):
+ for i in range(random.randint(1,3)):
+ if random.random() < 0.6:
make_sales_order()
- if random.random() < 0.1:
+ if random.random() < 0.5:
#make payment request against Sales Order
sales_order_name = get_random("Sales Order", filters={"docstatus": 1})
- if sales_order_name:
- so = frappe.get_doc("Sales Order", sales_order_name)
- if flt(so.per_billed) != 100:
- payment_request = make_payment_request(dt="Sales Order", dn=so.name, recipient_id=so.contact_email,
- submit_doc=True, mute_email=True, use_dummy_message=True)
+ try:
+ if sales_order_name:
+ so = frappe.get_doc("Sales Order", sales_order_name)
+ if flt(so.per_billed) != 100:
+ payment_request = make_payment_request(dt="Sales Order", dn=so.name, recipient_id=so.contact_email,
+ submit_doc=True, mute_email=True, use_dummy_message=True)
- payment_entry = frappe.get_doc(make_payment_entry(payment_request.name))
- payment_entry.posting_date = frappe.flags.current_date
- payment_entry.submit()
+ payment_entry = frappe.get_doc(make_payment_entry(payment_request.name))
+ payment_entry.posting_date = frappe.flags.current_date
+ payment_entry.submit()
+ except Exception:
+ pass
-def make_opportunity():
+def make_opportunity(domain):
b = frappe.get_doc({
"doctype": "Opportunity",
"enquiry_from": "Customer",
@@ -61,13 +65,13 @@
add_random_children(b, "items", rows=4, randomize = {
"qty": (1, 5),
- "item_code": ("Item", {"has_variants": 0, "is_fixed_asset": 0})
+ "item_code": ("Item", {"has_variants": 0, "is_fixed_asset": 0, "domain": domain})
}, unique="item_code")
b.insert()
frappe.db.commit()
-def make_quotation():
+def make_quotation(domain):
# get open opportunites
opportunity = get_random("Opportunity", {"status": "Open", "with_items": 1})
@@ -84,8 +88,8 @@
# get customer, currency and exchange_rate
customer = get_random("Customer")
- company_currency = frappe.get_cached_value('Company', "Wind Power LLC", "default_currency")
- party_account_currency = get_party_account_currency("Customer", customer, "Wind Power LLC")
+ company_currency = frappe.get_cached_value('Company', erpnext.get_default_company(), "default_currency")
+ party_account_currency = get_party_account_currency("Customer", customer, erpnext.get_default_company())
if company_currency == party_account_currency:
exchange_rate = 1
else:
@@ -104,7 +108,7 @@
add_random_children(qtn, "items", rows=3, randomize = {
"qty": (1, 5),
- "item_code": ("Item", {"has_variants": "0", "is_fixed_asset": 0})
+ "item_code": ("Item", {"has_variants": "0", "is_fixed_asset": 0, "domain": domain})
}, unique="item_code")
qtn.insert()
@@ -115,8 +119,8 @@
def make_sales_order():
q = get_random("Quotation", {"status": "Submitted"})
if q:
- from erpnext.selling.doctype.quotation.quotation import make_sales_order
- so = frappe.get_doc(make_sales_order(q))
+ from erpnext.selling.doctype.quotation.quotation import make_sales_order as mso
+ so = frappe.get_doc(mso(q))
so.transaction_date = frappe.flags.current_date
so.delivery_date = frappe.utils.add_days(frappe.flags.current_date, 10)
so.insert()
diff --git a/erpnext/demo/user/stock.py b/erpnext/demo/user/stock.py
index a6b0e00..6036a26 100644
--- a/erpnext/demo/user/stock.py
+++ b/erpnext/demo/user/stock.py
@@ -3,7 +3,7 @@
from __future__ import print_function, unicode_literals
-import frappe, random
+import frappe, random, erpnext
from frappe.desk import query_report
from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.serial_no.serial_no import SerialNoRequiredError, SerialNoQtyError
@@ -45,7 +45,7 @@
# make purchase requests
# make delivery notes (if possible)
- if random.random() < 0.3:
+ if random.random() < 0.6:
from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
report = "Ordered Items To Be Delivered"
for so in list(set([r[0] for r in query_report.run(report)["result"]
@@ -56,8 +56,9 @@
if not d.expense_account:
d.expense_account = ("Cost of Goods Sold - {0}".format(
frappe.get_cached_value('Company', dn.company, 'abbr')))
- dn.insert()
+
try:
+ dn.insert()
dn.submit()
frappe.db.commit()
except (NegativeStockError, SerialNoRequiredError, SerialNoQtyError, UnableToSelectBatchError):
@@ -68,9 +69,10 @@
from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation \
import OpeningEntryAccountError, EmptyStockReconciliationItemsError
- if random.random() < 0.1:
+ if random.random() < 0.4:
stock_reco = frappe.new_doc("Stock Reconciliation")
stock_reco.posting_date = frappe.flags.current_date
+ stock_reco.company = erpnext.get_default_company()
stock_reco.get_items_for("Stores - WP")
if stock_reco.items:
for item in stock_reco.items:
@@ -87,7 +89,7 @@
def submit_draft_stock_entries():
from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
- DuplicateEntryForProductionOrderError, OperationsNotCompleteError
+ DuplicateEntryForWorkOrderError, OperationsNotCompleteError
# try posting older drafts (if exists)
frappe.db.commit()
@@ -98,7 +100,7 @@
ste.save()
ste.submit()
frappe.db.commit()
- except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForProductionOrderError,
+ except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForWorkOrderError,
OperationsNotCompleteError):
frappe.db.rollback()
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 363db39..3b20b1c 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -254,7 +254,7 @@
def get_items_for(self, warehouse):
self.items = []
- for item in get_items(warehouse, self.posting_date, self.posting_time):
+ for item in get_items(warehouse, self.posting_date, self.posting_time, self.company):
self.append("items", item)
def submit(self):
diff --git a/erpnext/templates/pages/demo.html b/erpnext/templates/pages/demo.html
index 10743b8..8eec800 100644
--- a/erpnext/templates/pages/demo.html
+++ b/erpnext/templates/pages/demo.html
@@ -10,7 +10,7 @@
"method": "login",
args: {
usr: "demo@erpnext.com",
- pwd: "demo",
+ pwd: "Demo1234567!!!",
lead_email: $("#lead-email").val(),
},
callback: function(r) {