mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
Merge branch 'wsgi' of https://github.com/webnotes/erpnext into i18n
Conflicts: accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js public/js/complete_setup.js selling/doctype/opportunity/opportunity.js selling/doctype/quotation/quotation.js
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def on_login(self):
|
||||
from webnotes.utils import validate_email_add
|
||||
import conf
|
||||
if hasattr(conf, "demo_notify_url"):
|
||||
if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
|
||||
import requests
|
||||
response = requests.post(conf.demo_notify_url, data={
|
||||
"cmd":"portal.utils.send_message",
|
||||
"subject":"Logged into Demo",
|
||||
"sender": webnotes.form_dict.lead_email,
|
||||
"message": "via demo.erpnext.com"
|
||||
})
|
||||
class CustomDocType(DocType):
|
||||
def on_login(self):
|
||||
from webnotes.utils import validate_email_add
|
||||
from webnotes import conf
|
||||
if "demo_notify_url" in conf:
|
||||
if webnotes.form_dict.lead_email and validate_email_add(webnotes.form_dict.lead_email):
|
||||
import requests
|
||||
response = requests.post(conf.demo_notify_url, data={
|
||||
"cmd":"portal.utils.send_message",
|
||||
"subject":"Logged into Demo",
|
||||
"sender": webnotes.form_dict.lead_email,
|
||||
"message": "via demo.erpnext.com"
|
||||
})
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
Data Import Template,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Table:,Lead,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Notes:,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Please do not change the template headings.,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
First data column must be blank.,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"For updating, you can update only selective columns.",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Column Labels,ID,Contact Name,Status,Naming Series,Company Name,Email Id,Source,From Customer,Campaign Name,Remark,Phone,Mobile No.,Fax,Website,Territory,Lead Type,Lead Owner,Market Segment,Industry,Request Type,Lost Reason,Next Contact By,Next Contact Date,Last Contact Date,Company,Unsubscribed,Blog Subscriber
|
||||
Column Name:,name,lead_name,status,naming_series,company_name,email_id,source,customer,campaign_name,remark,phone,mobile_no,fax,website,territory,type,lead_owner,market_segment,industry,request_type,order_lost_reason,contact_by,contact_date,last_contact_date,company,unsubscribed,blog_subscriber
|
||||
Mandatory:,Yes,Yes,Yes,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No
|
||||
Type:,Data (text),Data,Select,Select,Data,Data,Select,Link,Link,Small Text,Data,Data,Data,Data,Link,Select,Link,Select,Link,Select,Link,Link,Date,Date,Link,Check,Check
|
||||
Info:,,,"One of: Open, Replied, Attempted to Contact, Contact in Future, Contacted, Interested, Not interested, Lead Lost, Converted","One of: LEAD, LEAD/10-11/, LEAD/MUMBAI/",,,"One of: Advertisement, Blog Post, Campaign, Call, Customer, Exhibition, Supplier, Website, Email",Valid Customer,Valid Campaign,,,,,,Valid Territory,"One of: Client, Channel Partner, Consultant",Valid Profile,"One of: Lower Income, Middle Income, Upper Income",Valid Industry Type,"One of: Product Enquiry, Request for Information, Suggestions, Other",Valid Quotation Lost Reason,Valid Profile,,,Valid Company,0 or 1,0 or 1
|
||||
Start entering data below this line,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mart Lakeman,Passive,,Zany Brainy,MartLakeman@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Saga Lundqvist,Passive,,Patterson-Fletcher,SagaLundqvist@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Adna Sjöberg,Passive,,Griff's Hamburgers,AdnaSjoberg@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Ida Svendsen,Passive,,Rhodes Furniture,IdaDSvendsen@superrito.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Emppu Hämeenniemi,Passive,,Burger Chef,EmppuHameenniemi@teleworm.us,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Eugenio Pisano,Passive,,Stratabiz,EugenioPisano@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Semhar Hagos,Passive,,Home Quarters Warehouse,SemharHagos@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Branimira Ivanković,Passive,,Enviro Architectural Designs,BranimiraIvankovic@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Shelly Fields,Passive,,Ideal Garden Management,ShellyLFields@superrito.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Leo Mikulić,Passive,,Listen Up,LeoMikulic@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Denisa Jarošová,Passive,,I. Magnin,DenisaJarosova@teleworm.us,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Janek Rutkowski,Passive,,First Rate Choice,JanekRutkowski@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,美月 宇藤,Passive,,Multi Tech Development,mm@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Даниил Афанасьев,Passive,,National Auto Parts,dd@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Zorislav Petković,Passive,,Integra Investment Plan,ZorislavPetkovic@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Nanao Niwa,Passive,,The Lawn Guru,NanaoNiwa@superrito.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Hreiðar Jörundsson,Passive,,Buena Vista Realty Service,HreiarJorundsson@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Lai Chu,Passive,,Bountiful Harvest Health Food Store,ChuThiBichLai@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Victor Aksakov,Passive,,P. Samuels Men's Clothiers,VictorAksakov@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Saidalim Bisliev,Passive,,Vinyl Fever,SaidalimBisliev@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Totte Jakobsson,Passive,,Garden Master,TotteJakobsson@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Naná Armas,Passive,,Big Apple,NanaArmasRobles@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Walerian Duda,Passive,,Monk House Sales,WalerianDuda@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Moarimikashi ,Passive,,ManCharm,Moarimikashi@teleworm.us,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Dobromił Dąbrowski ,Passive,,Custom Lawn Care,DobromilDabrowski@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Teigan Sinclair,Passive,,The Serendipity Dip,TeiganSinclair@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Fahad Guirguis,Passive,,Cavages,FahadSaidGuirguis@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Morten Olsen,Passive,,Gallenkamp,MortenJOlsen@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Christian Baecker,Passive,,Webcom Business Services,ChristianBaecker@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Sebastianus Dohmen,Passive,,Accord Investments,SebastianusDohmen@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Eero Koskinen,Passive,,American Appliance,EeroKoskinen@superrito.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,富奎 盧,Passive,,Bettendorf's,LuFuKui@teleworm.us,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Milica Jelić,Passive,,House Of Denmark,MilicaJelic@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Barbora Holubová,Passive,,10000 Auto Parts,BarboraHolubova@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Marta Kos,Passive,,Mages,MartaKos@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Simret Zula,Passive,,CSK Auto,SimretZula@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Kamil Chlubna,Passive,,Eagle Hardware & Garden,KamilChlubna@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Aceline Bolduc,Passive,,Rustler Steak House,AcelineBolduc@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Lucie Stupková,Passive,,ABCO Foods,LucieStupkova@gustr.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Roland Solvik,Passive,,Trak Auto,RolandSolvik@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mekirinzukushitakufu ,Passive,,Choices,Mekirinzukushitakufu@teleworm.us,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mukharbek Sultanovich,Passive,,Megatronic,MukharbekSultanovich@cuvox.de,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Osman Amanuel,Passive,,Handy Dan,OsmanAmanuel@dayrep.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,幸子 阪部,Passive,,Channel Home Centers,dd@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Masakazu Kamitani,Passive,,Honest Air Group,MasakazuKamitani@superrito.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Omran Sabbagh,Passive,,Pleasures and Pasttimes,OmranNuhaidSabbagh@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Rikako Matsumura,Passive,,Lazysize,RikakoMatsumura@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Anayolisa Chukwukadibia,Passive,,Prestiga-Biz,AnayolisaChukwukadibia@einrot.com,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Gudmunda Hinna,Passive,,Childs Restaurants,GudmundaHinna@armyspy.com,,,,,,,,,,,,,,,,,,,,,
|
||||
Data Import Template,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Table:,Lead,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Notes:,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Please do not change the template headings.,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
First data column must be blank.,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"For updating, you can update only selective columns.",,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
Column Labels,ID,Contact Name,Status,Naming Series,Company Name,Email Id,Source,From Customer,Campaign Name,Remark,Phone,Mobile No.,Fax,Website,Territory,Lead Type,Lead Owner,Market Segment,Industry,Request Type,Next Contact By,Next Contact Date,Company,Unsubscribed,Blog Subscriber,
|
||||
Column Name:,name,lead_name,status,naming_series,company_name,email_id,source,customer,campaign_name,remark,phone,mobile_no,fax,website,territory,type,lead_owner,market_segment,industry,request_type,contact_by,contact_date,company,unsubscribed,blog_subscriber,
|
||||
Mandatory:,Yes,Yes,Yes,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,
|
||||
Type:,Data (text),Data,Select,Select,Data,Data,Select,Link,Link,Small Text,Data,Data,Data,Data,Link,Select,Link,Select,Link,Select,Link,Date,Link,Check,Check,
|
||||
Info:,,,"Lead, Open, Replied, Opportunity, Interested, Converted, Do Not Contact","One of: LEAD, LEAD/10-11/, LEAD/MUMBAI/",,,"One of: Advertisement, Blog Post, Campaign, Call, Customer, Exhibition, Supplier, Website, Email",Valid Customer,Valid Campaign,,,,,,Valid Territory,"One of: Client, Channel Partner, Consultant",Valid Profile,"One of: Lower Income, Middle Income, Upper Income",Valid Industry Type,"One of: Product Enquiry, Request for Information, Suggestions, Other",Valid Profile,,Valid Company,0 or 1,0 or 1,
|
||||
Start entering data below this line,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mart Lakeman,Lead,,Zany Brainy,MartLakeman@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Saga Lundqvist,Lead,,Patterson-Fletcher,SagaLundqvist@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Adna Sjöberg,Lead,,Griff's Hamburgers,AdnaSjoberg@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Ida Svendsen,Lead,,Rhodes Furniture,IdaDSvendsen@superrito.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Emppu Hämeenniemi,Lead,,Burger Chef,EmppuHameenniemi@teleworm.us,,,,,,,,,,,,,,,,,,,,
|
||||
,,Eugenio Pisano,Lead,,Stratabiz,EugenioPisano@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Semhar Hagos,Lead,,Home Quarters Warehouse,SemharHagos@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Branimira Ivanković,Lead,,Enviro Architectural Designs,BranimiraIvankovic@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Shelly Fields,Lead,,Ideal Garden Management,ShellyLFields@superrito.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Leo Mikulić,Lead,,Listen Up,LeoMikulic@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Denisa Jarošová,Lead,,I. Magnin,DenisaJarosova@teleworm.us,,,,,,,,,,,,,,,,,,,,
|
||||
,,Janek Rutkowski,Lead,,First Rate Choice,JanekRutkowski@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,美月 宇藤,Lead,,Multi Tech Development,mm@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Даниил Афанасьев,Lead,,National Auto Parts,dd@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Zorislav Petković,Lead,,Integra Investment Plan,ZorislavPetkovic@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Nanao Niwa,Lead,,The Lawn Guru,NanaoNiwa@superrito.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Hreiðar Jörundsson,Lead,,Buena Vista Realty Service,HreiarJorundsson@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Lai Chu,Lead,,Bountiful Harvest Health Food Store,ChuThiBichLai@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Victor Aksakov,Lead,,P. Samuels Men's Clothiers,VictorAksakov@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Saidalim Bisliev,Lead,,Vinyl Fever,SaidalimBisliev@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Totte Jakobsson,Lead,,Garden Master,TotteJakobsson@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Naná Armas,Lead,,Big Apple,NanaArmasRobles@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Walerian Duda,Lead,,Monk House Sales,WalerianDuda@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Moarimikashi ,Lead,,ManCharm,Moarimikashi@teleworm.us,,,,,,,,,,,,,,,,,,,,
|
||||
,,Dobromił Dąbrowski ,Lead,,Custom Lawn Care,DobromilDabrowski@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Teigan Sinclair,Lead,,The Serendipity Dip,TeiganSinclair@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Fahad Guirguis,Lead,,Cavages,FahadSaidGuirguis@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Morten Olsen,Lead,,Gallenkamp,MortenJOlsen@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Christian Baecker,Lead,,Webcom Business Services,ChristianBaecker@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Sebastianus Dohmen,Lead,,Accord Investments,SebastianusDohmen@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Eero Koskinen,Lead,,American Appliance,EeroKoskinen@superrito.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,富奎 盧,Lead,,Bettendorf's,LuFuKui@teleworm.us,,,,,,,,,,,,,,,,,,,,
|
||||
,,Milica Jelić,Lead,,House Of Denmark,MilicaJelic@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Barbora Holubová,Lead,,10000 Auto Parts,BarboraHolubova@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Marta Kos,Lead,,Mages,MartaKos@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Simret Zula,Lead,,CSK Auto,SimretZula@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Kamil Chlubna,Lead,,Eagle Hardware & Garden,KamilChlubna@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Aceline Bolduc,Lead,,Rustler Steak House,AcelineBolduc@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Lucie Stupková,Lead,,ABCO Foods,LucieStupkova@gustr.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Roland Solvik,Lead,,Trak Auto,RolandSolvik@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mekirinzukushitakufu ,Lead,,Choices,Mekirinzukushitakufu@teleworm.us,,,,,,,,,,,,,,,,,,,,
|
||||
,,Mukharbek Sultanovich,Lead,,Megatronic,MukharbekSultanovich@cuvox.de,,,,,,,,,,,,,,,,,,,,
|
||||
,,Osman Amanuel,Lead,,Handy Dan,OsmanAmanuel@dayrep.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,幸子 阪部,Lead,,Channel Home Centers,dd@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Masakazu Kamitani,Lead,,Honest Air Group,MasakazuKamitani@superrito.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Omran Sabbagh,Lead,,Pleasures and Pasttimes,OmranNuhaidSabbagh@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Rikako Matsumura,Lead,,Lazysize,RikakoMatsumura@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Anayolisa Chukwukadibia,Lead,,Prestiga-Biz,AnayolisaChukwukadibia@einrot.com,,,,,,,,,,,,,,,,,,,,
|
||||
,,Gudmunda Hinna,Lead,,Childs Restaurants,GudmundaHinna@armyspy.com,,,,,,,,,,,,,,,,,,,,
|
||||
|
@@ -1,40 +1,40 @@
|
||||
Data Import Template,,,,,,,,,,,,,,,,,,,,,
|
||||
Table:,Profile,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,
|
||||
Notes:,,,,,,,,,,,,,,,,,,,,,
|
||||
Please do not change the template headings.,,,,,,,,,,,,,,,,,,,,,
|
||||
First data column must be blank.,,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,,,,,,,,,,,,,,,
|
||||
Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,,,,,,,,,,,,,,,
|
||||
"For updating, you can update only selective columns.",,,,,,,,,,,,,,,,,,,,,
|
||||
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,,
|
||||
DocType:,Profile,,,,,,,,,,,,,,,,,,,,
|
||||
Column Labels:,ID,Email,First Name,User Type,Enabled,Middle Name (Optional),Last Name,Send Invite Email,Language,Birth Date,Gender,New Password,User Image,Background Image,Bio,Email Signature,Login After,Login Before,Restrict IP,Last Login,Last IP
|
||||
Column Name:,name,email,first_name,user_type,enabled,middle_name,last_name,send_invite_email,language,birth_date,gender,new_password,user_image,background_image,bio,email_signature,login_after,login_before,restrict_ip,last_login,last_ip
|
||||
Mandatory:,Yes,Yes,Yes,Yes,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No
|
||||
Type:,Data (text),Data,Data,Select,Check,Data,Data,Check,Select,Date,Select,Password,Select,Select,Small Text,Small Text,Int,Int,Data,Read Only,Read Only
|
||||
Info:,,,,"One of: System User, Website User",0 or 1,,,0 or 1,"One of: العربية, Deutsch, english, español, français, हिंदी, Hrvatski, nederlands, português, português brasileiro, српски, தமிழ், ไทย",,"One of: Male, Female, Other",,One of: attach_files:,One of: attach_files:,,,Integer,Integer,,,
|
||||
Start entering data below this line,,,,,,,,,,,,,,,,,,,,,
|
||||
,,DikmanShervashidze@armyspy.com,Dikman,System User,1,V,Shervashidze,0,,,,testpass,,,,,,,,,
|
||||
,,Zukutakitoteka@teleworm.us,Zukutakitoteka,System User,1,,,0,,,,testpass,,,,,,,,,
|
||||
,,HatsueKashiwagi@cuvox.de,Hatsue,System User,1,H,Kashiwagi,0,,,,testpass,,,,,,,,,
|
||||
,,NuranVerkleij@einrot.com,Nuran,System User,1,T,Verkleij,0,,,,testpass,,,,,,,,,
|
||||
,,aromn@armyspy.com,Дмитрий,System User,1,З,Пирогов,0,,,,testpass,,,,,,,,,
|
||||
,,TildeLindqvist@cuvox.de,Tilde,System User,1,T,Lindqvist,0,,,,testpass,,,,,,,,,
|
||||
,,MichalSobczak@teleworm.us,Michał,System User,1,S,Sobczak,0,,,,testpass,,,,,,,,,
|
||||
,,GabrielleLoftus@superrito.com,Gabrielle,System User,1,J,Loftus,0,,,,testpass,,,,,,,,,
|
||||
,,VakhitaRyzaev@teleworm.us,Vakhita,System User,1,A,Ryzaev,0,,,,testpass,,,,,,,,,
|
||||
,,CharmaineGaudreau@cuvox.de,Charmaine,System User,1,D,Gaudreau,0,,,,testpass,,,,,,,,,
|
||||
,,RafaelaMaartens@cuvox.de,Rafaëla,System User,1,Z,Maartens,0,,,,testpass,,,,,,,,,
|
||||
,,NuguseYohannes@dayrep.com,Nuguse,System User,0,S,Yohannes,0,,,,testpass,,,,,,,,,
|
||||
,,panca@armyspy.com,Раиса,System User,0,В,Белякова,0,,,,testpass,,,,,,,,,
|
||||
,,CaYinLong@gustr.com,胤隆,System User,1,婷,蔡,0,,,,testpass,,,,,,,,,
|
||||
,,FreddieScott@armyspy.com,Freddie,System User,1,A,Scott,0,,,,testpass,,,,,,,,,
|
||||
,,BergoraVigfusdottir@superrito.com,Bergþóra,System User,1,Ö,Vigfúsdóttir,0,,,,testpass,,,,,,,,,
|
||||
,,WardNajmalDinKalb@cuvox.de,Ward,System User,1,N,Kalb,0,,,,testpass,,,,,,,,,
|
||||
,,WanMai@teleworm.us,Wan,System User,1,A,Mai,0,,,,testpass,,,,,,,,,
|
||||
,,LeonAbdulov@superrito.com,Leon,System User,1,A,Abdulov,0,,,,testpass,,,,,,,,,
|
||||
,,SabinaNovotna@superrito.com,Sabina,System User,1,J,Novotná,0,,,,testpass,,,,,,,,,
|
||||
Data Import Template,,,,,,,,,,,,,,,,,,,,
|
||||
Table:,Profile,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,
|
||||
Notes:,,,,,,,,,,,,,,,,,,,,
|
||||
Please do not change the template headings.,,,,,,,,,,,,,,,,,,,,
|
||||
First data column must be blank.,,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, leave the ""name"" (ID) column blank.",,,,,,,,,,,,,,,,,,,,
|
||||
"If you are uploading new records, ""Naming Series"" becomes mandatory, if present.",,,,,,,,,,,,,,,,,,,,
|
||||
Only mandatory fields are necessary for new records. You can delete non-mandatory columns if you wish.,,,,,,,,,,,,,,,,,,,,
|
||||
"For updating, you can update only selective columns.",,,,,,,,,,,,,,,,,,,,
|
||||
You can only upload upto 5000 records in one go. (may be less in some cases),,,,,,,,,,,,,,,,,,,,
|
||||
,,,,,,,,,,,,,,,,,,,,
|
||||
DocType:,Profile,,,,,,,,,,,,,,,,,,,
|
||||
Column Labels:,ID,Email,First Name,User Type,Enabled,Middle Name (Optional),Last Name,Language,Birth Date,Gender,New Password,User Image,Background Image,Bio,Email Signature,Login After,Login Before,Restrict IP,Last Login,Last IP
|
||||
Column Name:,name,email,first_name,user_type,enabled,middle_name,last_name,language,birth_date,gender,new_password,user_image,background_image,bio,email_signature,login_after,login_before,restrict_ip,last_login,last_ip
|
||||
Mandatory:,Yes,Yes,Yes,Yes,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No,No
|
||||
Type:,Data (text),Data,Data,Select,Check,Data,Data,Select,Date,Select,Password,Select,Select,Small Text,Small Text,Int,Int,Data,Read Only,Read Only
|
||||
Info:,,,,"One of: System User, Website User",0 or 1,,,"One of: العربية, Deutsch, english, español, français, हिंदी, Hrvatski, nederlands, português, português brasileiro, српски, தமிழ், ไทย",,"One of: Male, Female, Other",,One of: attach_files:,One of: attach_files:,,,Integer,Integer,,,
|
||||
Start entering data below this line,,,,,,,,,,,,,,,,,,,,
|
||||
,,DikmanShervashidze@armyspy.com,Dikman,System User,1,V,Shervashidze,,,,testpass,,,,,,,,,
|
||||
,,Zukutakitoteka@teleworm.us,Zukutakitoteka,System User,1,,,,,,testpass,,,,,,,,,
|
||||
,,HatsueKashiwagi@cuvox.de,Hatsue,System User,1,H,Kashiwagi,,,,testpass,,,,,,,,,
|
||||
,,NuranVerkleij@einrot.com,Nuran,System User,1,T,Verkleij,,,,testpass,,,,,,,,,
|
||||
,,aromn@armyspy.com,Дмитрий,System User,1,З,Пирогов,,,,testpass,,,,,,,,,
|
||||
,,TildeLindqvist@cuvox.de,Tilde,System User,1,T,Lindqvist,,,,testpass,,,,,,,,,
|
||||
,,MichalSobczak@teleworm.us,Michał,System User,1,S,Sobczak,,,,testpass,,,,,,,,,
|
||||
,,GabrielleLoftus@superrito.com,Gabrielle,System User,1,J,Loftus,,,,testpass,,,,,,,,,
|
||||
,,VakhitaRyzaev@teleworm.us,Vakhita,System User,1,A,Ryzaev,,,,testpass,,,,,,,,,
|
||||
,,CharmaineGaudreau@cuvox.de,Charmaine,System User,1,D,Gaudreau,,,,testpass,,,,,,,,,
|
||||
,,RafaelaMaartens@cuvox.de,Rafaëla,System User,1,Z,Maartens,,,,testpass,,,,,,,,,
|
||||
,,NuguseYohannes@dayrep.com,Nuguse,System User,0,S,Yohannes,,,,testpass,,,,,,,,,
|
||||
,,panca@armyspy.com,Раиса,System User,0,В,Белякова,,,,testpass,,,,,,,,,
|
||||
,,CaYinLong@gustr.com,胤隆,System User,1,婷,蔡,,,,testpass,,,,,,,,,
|
||||
,,FreddieScott@armyspy.com,Freddie,System User,1,A,Scott,,,,testpass,,,,,,,,,
|
||||
,,BergoraVigfusdottir@superrito.com,Bergþóra,System User,1,Ö,Vigfúsdóttir,,,,testpass,,,,,,,,,
|
||||
,,WardNajmalDinKalb@cuvox.de,Ward,System User,1,N,Kalb,,,,testpass,,,,,,,,,
|
||||
,,WanMai@teleworm.us,Wan,System User,1,A,Mai,,,,testpass,,,,,,,,,
|
||||
,,LeonAbdulov@superrito.com,Leon,System User,1,A,Abdulov,,,,testpass,,,,,,,,,
|
||||
,,SabinaNovotna@superrito.com,Sabina,System User,1,J,Novotná,,,,testpass,,,,,,,,,
|
||||
|
||||
|
@@ -30,17 +30,27 @@ prob = {
|
||||
}
|
||||
|
||||
def make(reset=False, simulate=True):
|
||||
#webnotes.print_messages = True
|
||||
webnotes.mute_emails = True
|
||||
webnotes.rollback_on_exception = True
|
||||
#webnotes.flags.print_messages = True
|
||||
webnotes.flags.mute_emails = True
|
||||
webnotes.flags.rollback_on_exception = True
|
||||
|
||||
if not webnotes.conf.demo_db_name:
|
||||
raise Exception("conf.py does not have demo_db_name")
|
||||
|
||||
if reset:
|
||||
setup()
|
||||
else:
|
||||
if webnotes.conn:
|
||||
webnotes.conn.close()
|
||||
|
||||
webnotes.connect(db_name=webnotes.conf.demo_db_name)
|
||||
|
||||
if simulate:
|
||||
_simulate()
|
||||
|
||||
|
||||
def setup():
|
||||
install()
|
||||
webnotes.connect(db_name=webnotes.conf.demo_db_name)
|
||||
complete_setup()
|
||||
make_customers_suppliers_contacts()
|
||||
make_items()
|
||||
@@ -65,7 +75,7 @@ def _simulate():
|
||||
|
||||
for i in xrange(runs_for):
|
||||
print current_date.strftime("%Y-%m-%d")
|
||||
webnotes.utils.current_date = current_date
|
||||
webnotes.local.current_date = current_date
|
||||
|
||||
if current_date.weekday() in (5, 6):
|
||||
current_date = webnotes.utils.add_days(current_date, 1)
|
||||
@@ -138,20 +148,23 @@ def run_stock(current_date):
|
||||
# make purchase requests
|
||||
if can_make("Purchase Receipt"):
|
||||
from buying.doctype.purchase_order.purchase_order import make_purchase_receipt
|
||||
from stock.stock_ledger import NegativeStockError
|
||||
report = "Purchase Order Items To Be Received"
|
||||
for po in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Purchase Receipt")]:
|
||||
pr = webnotes.bean(make_purchase_receipt(po))
|
||||
pr.doc.posting_date = current_date
|
||||
pr.doc.fiscal_year = "2013"
|
||||
pr.insert()
|
||||
pr.submit()
|
||||
webnotes.conn.commit()
|
||||
try:
|
||||
pr.submit()
|
||||
webnotes.conn.commit()
|
||||
except NegativeStockError: pass
|
||||
|
||||
# make delivery notes (if possible)
|
||||
if can_make("Delivery Note"):
|
||||
from selling.doctype.sales_order.sales_order import make_delivery_note
|
||||
from stock.stock_ledger import NegativeStockError
|
||||
from stock.doctype.stock_ledger_entry.stock_ledger_entry import SerialNoRequiredError, SerialNoQtyError
|
||||
from stock.doctype.serial_no.serial_no import SerialNoRequiredError, SerialNoQtyError
|
||||
report = "Ordered Items To Be Delivered"
|
||||
for so in list(set([r[0] for r in query_report.run(report)["result"] if r[0]!="Total"]))[:how_many("Delivery Note")]:
|
||||
dn = webnotes.bean(make_delivery_note(so))
|
||||
@@ -357,13 +370,14 @@ def how_many(doctype):
|
||||
def install():
|
||||
print "Creating Fresh Database..."
|
||||
from webnotes.install_lib.install import Installer
|
||||
import conf
|
||||
from webnotes import conf
|
||||
inst = Installer('root')
|
||||
inst.import_from_db(conf.demo_db_name, verbose = 1)
|
||||
inst.install(conf.demo_db_name, verbose=1, force=1)
|
||||
|
||||
def complete_setup():
|
||||
print "Complete Setup..."
|
||||
webnotes.get_obj("Setup Control").setup_account({
|
||||
from setup.page.setup_wizard.setup_wizard import setup_account
|
||||
setup_account({
|
||||
"first_name": "Test",
|
||||
"last_name": "User",
|
||||
"fy_start": "1st Jan",
|
||||
@@ -412,7 +426,7 @@ def import_data(dt, submit=False, overwrite=False):
|
||||
|
||||
for doctype in dt:
|
||||
print "Importing", doctype.replace("_", " "), "..."
|
||||
webnotes.form_dict = webnotes._dict()
|
||||
webnotes.local.form_dict = webnotes._dict()
|
||||
if submit:
|
||||
webnotes.form_dict["params"] = json.dumps({"_submit": 1})
|
||||
webnotes.uploaded_file = os.path.join(os.path.dirname(__file__), "demo_docs", doctype+".csv")
|
||||
|
||||
@@ -5,17 +5,21 @@ if __name__=="__main__":
|
||||
import webnotes, os
|
||||
import utilities.demo.make_demo
|
||||
|
||||
def make_demo_app():
|
||||
webnotes.mute_emails = 1
|
||||
webnotes.connect()
|
||||
def make_demo_app(site=None):
|
||||
webnotes.init(site=site)
|
||||
webnotes.flags.mute_emails = 1
|
||||
|
||||
utilities.demo.make_demo.make(reset=True, simulate=False)
|
||||
# setup demo user etc so that the site it up faster, while the data loads
|
||||
make_demo_user()
|
||||
make_demo_login_page()
|
||||
make_demo_on_login_script()
|
||||
utilities.demo.make_demo.make(reset=False, simulate=True)
|
||||
webnotes.destroy()
|
||||
|
||||
def make_demo_user():
|
||||
from webnotes.auth import _update_password
|
||||
|
||||
roles = ["Accounts Manager", "Analytics", "Expense Approver", "Accounts User",
|
||||
"Leave Approver", "Blogger", "Customer", "Sales Manager", "Employee", "Support Manager",
|
||||
"HR Manager", "HR User", "Maintenance Manager", "Maintenance User", "Material Manager",
|
||||
@@ -42,11 +46,10 @@ def make_demo_user():
|
||||
p.doc.last_name = "User"
|
||||
p.doc.enabled = 1
|
||||
p.doc.user_type = "ERPNext Demo"
|
||||
p.doc.send_invite_email = 0
|
||||
p.doc.new_password = "demo"
|
||||
p.insert()
|
||||
add_roles(p)
|
||||
p.save()
|
||||
_update_password("demo@erpnext.com", "demo")
|
||||
|
||||
# make system manager user
|
||||
if webnotes.conn.exists("Profile", "admin@erpnext.com"):
|
||||
@@ -58,12 +61,11 @@ def make_demo_user():
|
||||
p.doc.last_name = "User"
|
||||
p.doc.enabled = 1
|
||||
p.doc.user_type = "System User"
|
||||
p.doc.send_invite_email = 0
|
||||
p.doc.new_password = "admin010123"
|
||||
p.insert()
|
||||
roles.append("System Manager")
|
||||
add_roles(p)
|
||||
p.save()
|
||||
_update_password("admin@erpnext.com", "admin010123")
|
||||
|
||||
# only read for newsletter
|
||||
webnotes.conn.sql("""update `tabDocPerm` set `write`=0, `create`=0, `cancel`=0
|
||||
@@ -103,13 +105,12 @@ def make_demo_login_page():
|
||||
webnotes.conn.commit()
|
||||
|
||||
def make_demo_on_login_script():
|
||||
webnotes.conn.sql("""delete from `tabCustom Script` where dt='Control Panel'""")
|
||||
s = webnotes.new_bean("Custom Script")
|
||||
s.doc.dt = "Control Panel"
|
||||
s.doc.script_type = "Server"
|
||||
with open(os.path.join(os.path.dirname(__file__), "demo_control_panel.py"), "r") as dfile:
|
||||
s.doc.script = dfile.read()
|
||||
s.insert()
|
||||
import shutil
|
||||
from core.doctype.custom_script.custom_script import get_custom_server_script_path
|
||||
custom_script_path = get_custom_server_script_path("Control Panel")
|
||||
webnotes.create_folder(os.path.dirname(custom_script_path))
|
||||
|
||||
shutil.copyfile(os.path.join(os.path.dirname(__file__), "demo_control_panel.py"), custom_script_path)
|
||||
|
||||
cp = webnotes.bean("Control Panel")
|
||||
cp.doc.custom_startup_code = """wn.ui.toolbar.show_banner('You are using ERPNext Demo. To start your own ERPNext Trial, <a href="https://erpnext.com/pricing-and-signup" target="_blank">click here</a>')"""
|
||||
@@ -118,4 +119,6 @@ def make_demo_on_login_script():
|
||||
webnotes.conn.commit()
|
||||
|
||||
if __name__=="__main__":
|
||||
make_demo_app()
|
||||
import sys
|
||||
site = sys.argv[1:]
|
||||
make_demo_app(site=site and site[0] or None)
|
||||
|
||||
@@ -12,14 +12,6 @@ class DocType(TransactionBase):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def on_communication(self, comm):
|
||||
if webnotes.conn.get_value("Profile", extract_email_id(comm.sender), "user_type")=="System User":
|
||||
status = "Replied"
|
||||
else:
|
||||
status = "Open"
|
||||
|
||||
webnotes.conn.set(self.doc, 'status', status)
|
||||
|
||||
def autoname(self):
|
||||
# concat first and last name
|
||||
self.doc.name = " ".join(filter(None,
|
||||
@@ -32,28 +24,28 @@ class DocType(TransactionBase):
|
||||
break
|
||||
|
||||
def validate(self):
|
||||
self.set_status()
|
||||
self.validate_primary_contact()
|
||||
|
||||
def validate_primary_contact(self):
|
||||
sql = webnotes.conn.sql
|
||||
if self.doc.is_primary_contact == 1:
|
||||
if self.doc.customer:
|
||||
sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
|
||||
webnotes.conn.sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
|
||||
elif self.doc.supplier:
|
||||
sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
|
||||
webnotes.conn.sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
|
||||
elif self.doc.sales_partner:
|
||||
sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
|
||||
webnotes.conn.sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
|
||||
else:
|
||||
if self.doc.customer:
|
||||
if not sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
|
||||
if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
|
||||
self.doc.is_primary_contact = 1
|
||||
elif self.doc.supplier:
|
||||
if not sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
|
||||
if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
|
||||
self.doc.is_primary_contact = 1
|
||||
elif self.doc.sales_partner:
|
||||
if not sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
|
||||
if not webnotes.conn.sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
|
||||
self.doc.is_primary_contact = 1
|
||||
|
||||
def on_trash(self):
|
||||
webnotes.conn.sql("""update `tabSupport Ticket` set contact='' where contact=%s""",
|
||||
self.doc.name)
|
||||
self.doc.name)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:32",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-09-10 10:50:27",
|
||||
"modified": "2013-10-08 16:48:50",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -70,11 +70,12 @@
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "Passive",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "\nOpen\nReplied"
|
||||
"options": "Passive\nOpen\nReplied"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@@ -84,7 +85,7 @@
|
||||
"label": "Email Id",
|
||||
"oldfieldname": "email_id",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@@ -94,7 +95,7 @@
|
||||
"label": "Phone",
|
||||
"oldfieldname": "contact_no",
|
||||
"oldfieldtype": "Data",
|
||||
"reqd": 1
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
|
||||
@@ -10,8 +10,6 @@ from webnotes.model.doc import Document
|
||||
from webnotes import msgprint
|
||||
from webnotes.model.bean import getlist, copy_doclist
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
@@ -50,7 +48,7 @@ class DocType:
|
||||
def get_contact_number(self, arg):
|
||||
"returns mobile number of the contact"
|
||||
args = load_json(arg)
|
||||
number = sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" %
|
||||
number = webnotes.conn.sql("""select mobile_no, phone from tabContact where name=%s and %s=%s""" %
|
||||
('%s', args['key'], '%s'), (args['contact_name'], args['value']))
|
||||
return number and (number[0][0] or number[0][1]) or ''
|
||||
|
||||
@@ -119,4 +117,4 @@ class DocType:
|
||||
sl.message = arg['message']
|
||||
sl.no_of_requested_sms = len(arg['receiver_list'])
|
||||
sl.no_of_sent_sms = sent_sms
|
||||
sl.save(new=1)
|
||||
sl.save(new=1)
|
||||
|
||||
119
utilities/repost_stock.py
Normal file
119
utilities/repost_stock.py
Normal file
@@ -0,0 +1,119 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import flt
|
||||
|
||||
|
||||
def repost():
|
||||
"""
|
||||
Repost everything!
|
||||
"""
|
||||
webnotes.conn.auto_commit_on_many_writes = 1
|
||||
|
||||
for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
|
||||
repost_stock(d[0], d[1])
|
||||
|
||||
webnotes.conn.auto_commit_on_many_writes = 0
|
||||
|
||||
def repost_stock(item_code, warehouse):
|
||||
repost_actual_qty(item_code, warehouse)
|
||||
|
||||
if item_code and warehouse:
|
||||
update_bin(item_code, warehouse, {
|
||||
"reserved_qty": get_reserved_qty(item_code, warehouse),
|
||||
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||
"ordered_qty": get_ordered_qty(item_code, warehouse),
|
||||
"planned_qty": get_planned_qty(item_code, warehouse)
|
||||
})
|
||||
|
||||
def repost_actual_qty(item_code, warehouse):
|
||||
from stock.stock_ledger import update_entries_after
|
||||
update_entries_after({ "item_code": item_code, "warehouse": warehouse })
|
||||
|
||||
def get_reserved_qty(item_code, warehouse):
|
||||
reserved_qty = webnotes.conn.sql("""
|
||||
select
|
||||
sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty))
|
||||
from
|
||||
(
|
||||
(select
|
||||
qty as dnpi_qty,
|
||||
(
|
||||
select qty from `tabSales Order Item`
|
||||
where name = dnpi.parent_detail_docname
|
||||
) as so_item_qty,
|
||||
(
|
||||
select ifnull(delivered_qty, 0) from `tabSales Order Item`
|
||||
where name = dnpi.parent_detail_docname
|
||||
) as so_item_delivered_qty,
|
||||
parent, name
|
||||
from
|
||||
(
|
||||
select qty, parent_detail_docname, parent, name
|
||||
from `tabDelivery Note Packing Item` dnpi_in
|
||||
where item_code = %s and warehouse = %s
|
||||
and parenttype="Sales Order"
|
||||
and item_code != parent_item
|
||||
and exists (select * from `tabSales Order` so
|
||||
where name = dnpi_in.parent and docstatus = 1 and status != 'Stopped')
|
||||
) dnpi)
|
||||
union
|
||||
(select qty as dnpi_qty, qty as so_item_qty,
|
||||
ifnull(delivered_qty, 0) as so_item_delivered_qty, parent, name
|
||||
from `tabSales Order Item` so_item
|
||||
where item_code = %s and reserved_warehouse = %s
|
||||
and exists(select * from `tabSales Order` so
|
||||
where so.name = so_item.parent and so.docstatus = 1
|
||||
and so.status != 'Stopped'))
|
||||
) tab
|
||||
where
|
||||
so_item_qty >= so_item_delivered_qty
|
||||
""", (item_code, warehouse, item_code, warehouse))
|
||||
|
||||
return flt(reserved_qty[0][0]) if reserved_qty else 0
|
||||
|
||||
def get_indented_qty(item_code, warehouse):
|
||||
indented_qty = webnotes.conn.sql("""select sum(pr_item.qty - ifnull(pr_item.ordered_qty, 0))
|
||||
from `tabMaterial Request Item` pr_item, `tabMaterial Request` pr
|
||||
where pr_item.item_code=%s and pr_item.warehouse=%s
|
||||
and pr_item.qty > ifnull(pr_item.ordered_qty, 0) and pr_item.parent=pr.name
|
||||
and pr.status!='Stopped' and pr.docstatus=1""", (item_code, warehouse))
|
||||
|
||||
return flt(indented_qty[0][0]) if indented_qty else 0
|
||||
|
||||
def get_ordered_qty(item_code, warehouse):
|
||||
ordered_qty = webnotes.conn.sql("""
|
||||
select sum((po_item.qty - ifnull(po_item.received_qty, 0))*po_item.conversion_factor)
|
||||
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
|
||||
where po_item.item_code=%s and po_item.warehouse=%s
|
||||
and po_item.qty > ifnull(po_item.received_qty, 0) and po_item.parent=po.name
|
||||
and po.status!='Stopped' and po.docstatus=1""", (item_code, warehouse))
|
||||
|
||||
return flt(ordered_qty[0][0]) if ordered_qty else 0
|
||||
|
||||
def get_planned_qty(item_code, warehouse):
|
||||
planned_qty = webnotes.conn.sql("""
|
||||
select sum(ifnull(qty, 0) - ifnull(produced_qty, 0)) from `tabProduction Order`
|
||||
where production_item = %s and fg_warehouse = %s and status != "Stopped"
|
||||
and docstatus=1 and ifnull(qty, 0) > ifnull(produced_qty, 0)""", (item_code, warehouse))
|
||||
|
||||
return flt(planned_qty[0][0]) if planned_qty else 0
|
||||
|
||||
|
||||
def update_bin(item_code, warehouse, qty_dict=None):
|
||||
from stock.utils import get_bin
|
||||
bin = get_bin(item_code, warehouse)
|
||||
mismatch = False
|
||||
for fld, val in qty_dict.items():
|
||||
if flt(bin.doc.fields.get(fld)) != flt(val):
|
||||
bin.doc.fields[fld] = flt(val)
|
||||
mismatch = True
|
||||
|
||||
if mismatch:
|
||||
bin.doc.projected_qty = flt(bin.doc.actual_qty) + flt(bin.doc.ordered_qty) + \
|
||||
flt(bin.doc.indented_qty) + flt(bin.doc.planned_qty) - flt(bin.doc.reserved_qty)
|
||||
|
||||
bin.doc.save()
|
||||
@@ -144,7 +144,6 @@ class TransactionBase(StatusUpdater):
|
||||
|
||||
def get_customer_address(self, args):
|
||||
args = load_json(args)
|
||||
webnotes.errprint(args)
|
||||
ret = {
|
||||
'customer_address' : args["address"],
|
||||
'address_display' : get_address_display(args["address"]),
|
||||
@@ -426,19 +425,13 @@ def get_address_territory(address_doc):
|
||||
|
||||
def validate_conversion_rate(currency, conversion_rate, conversion_rate_label, company):
|
||||
"""common validation for currency and price list currency"""
|
||||
|
||||
if conversion_rate == 0:
|
||||
msgprint(conversion_rate_label + _(' cannot be 0'), raise_exception=True)
|
||||
|
||||
company_currency = webnotes.conn.get_value("Company", company, "default_currency")
|
||||
|
||||
# parenthesis for 'OR' are necessary as we want it to evaluate as
|
||||
# mandatory valid condition and (1st optional valid condition
|
||||
# or 2nd optional valid condition)
|
||||
valid_conversion_rate = (conversion_rate and
|
||||
((currency == company_currency and conversion_rate == 1.00)
|
||||
or (currency != company_currency and conversion_rate != 1.00)))
|
||||
|
||||
if not valid_conversion_rate:
|
||||
if not conversion_rate:
|
||||
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
|
||||
+ ("1 %s = [?] %s" % (currency, company_currency)),
|
||||
raise_exception=True)
|
||||
|
||||
Reference in New Issue
Block a user