delivery, not and sales_bom

This commit is contained in:
Rushabh Mehta 2012-05-04 10:02:09 +05:30
parent d093ca4c16
commit 5a774db021
5 changed files with 31 additions and 23 deletions

View File

@ -183,7 +183,6 @@ class DocType(TransactionBase):
self.validate_reference_value()
self.validate_for_items()
sales_com_obj.make_packing_list(self,'delivery_note_details')
get_obj('Stock Ledger').validate_serial_no(self, 'packing_details')
sales_com_obj.validate_max_discount(self, 'delivery_note_details') #verify whether rate is not greater than max discount
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
sales_com_obj.check_conversion_rate(self)
@ -325,6 +324,7 @@ class DocType(TransactionBase):
# Check for Approving Authority
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self)
sl_obj = get_obj("Stock Ledger")
sl_obj.validate_serial_no(self, 'packing_details')
sl_obj.validate_serial_no_warehouse(self, 'packing_details')
sl_obj.update_serial_record(self, 'packing_details', is_submit = 1, is_incoming = 0)
get_obj("Sales Common").update_prevdoc_detail(1,self)

View File

@ -22,7 +22,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(!doc.__islocal) {
hide_field('new_item_code');
}
}
/* Get Item Code */

View File

@ -38,8 +38,7 @@ class DocType:
self.doc, self.doclist = d,dl
def autoname(self):
self.doc.name = make_autoname(self.doc.new_item_code)
self.doc.name = self.doc.new_item_code
# Get Ref Rates
# --------------
@ -67,9 +66,9 @@ class DocType:
msgprint("Sales Bom Item " + d.item_code +" cannot be child item.")
raise Exception
# Check if is_main_item is modified once saved
if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.new_item_code)[:-3] :
msgprint("Modifying the main item is not allowed.")
raise Exception
#if not self.doc.fields.get('__islocal') and d.is_main_item == "Yes" and cstr(d.item_code) != cstr(self.doc.new_item_code)[:-3] :
# msgprint("Modifying the main item is not allowed.")
# raise Exception
if len(is_main_item) > 1:
msgprint('Main item cannot be more than one.')
raise Exception , " Validation Error."

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-04-26 13:04:56',
'creation': '2012-04-30 12:08:49',
'docstatus': 0,
'modified': '2012-04-27 11:00:18',
'modified': '2012-05-04 09:53:08',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -15,6 +15,7 @@
'_last_update': u'1322549701',
'allow_trash': 1,
'colour': u'White:FFF',
'description': u'Aggregate item and accessories to form a Sales Item. There is no inventory of the new item but of the sub-components.',
'doctype': 'DocType',
'document_type': u'Master',
'is_submittable': 1,
@ -143,6 +144,8 @@
# DocField
{
'colour': u'White:FFF',
'description': u'Item code of the new aggregate item.',
'doctype': u'DocField',
'fieldname': u'new_item_code',
'fieldtype': u'Data',
@ -150,12 +153,12 @@
'no_copy': 1,
'oldfieldname': u'new_item_code',
'oldfieldtype': u'Data',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'new_item_name',
'fieldtype': u'Data',
@ -221,7 +224,8 @@
'oldfieldname': u'stock_uom',
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0
'permlevel': 0,
'reqd': 1
},
# DocField
@ -280,17 +284,7 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'find_sales_bom',
'fieldtype': u'Button',
'label': u'Find Sales BOM',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'description': u'List items that form a package. One of the items has to be a "main item".',
'doctype': u'DocField',
'fieldname': u'item_section',
'fieldtype': u'Section Break',
@ -310,6 +304,19 @@
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Add a few items and find if there are any Sales BOM created with the same combination to help you identify duplication.',
'doctype': u'DocField',
'fieldname': u'find_sales_bom',
'fieldtype': u'Button',
'label': u'Find Sales BOM',
'oldfieldtype': u'Button',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',

View File

@ -1719,7 +1719,7 @@ _f.Frm.prototype.check_doctype_conflict=function(docname){var me=this;if(this.do
throw'doctype open conflict'}}else{if(wn.views.formview.DocType&&wn.views.formview.DocType.frm.opendocs[this.doctype]){msgprint("Cannot open instance when its DocType is open")
throw'doctype open conflict'}}}
_f.Frm.prototype.setup=function(){var me=this;this.fields=[];this.fields_dict={};this.wrapper=this.parent;this.setup_print_layout();this.saved_wrapper=$a(this.wrapper,'div');this.setup_std_layout();this.setup_client_script();this.setup_done=true;}
_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px',minHeight:'800px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.back();});}
_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px',minHeight:'800px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.history.back();});}
_f.Frm.prototype.onhide=function(){if(_f.cur_grid_cell)_f.cur_grid_cell.grid.cell_deselect();}
_f.Frm.prototype.setup_std_layout=function(){this.page_layout=new wn.PageLayout({parent:this.wrapper,main_width:this.meta.in_dialog?'100%':'75%',sidebar_width:this.meta.in_dialog?'0%':'25%'})
this.meta.section_style='Simple';this.layout=new Layout(this.page_layout.body,'100%');if(this.meta.in_dialog){$(this.page_layout.wrapper).removeClass('layout-wrapper-background');$(this.page_layout.main).removeClass('layout-main-section');$(this.page_layout.sidebar_area).toggle(false);}else{this.setup_sidebar();}