fixes related to Material Request; added button to make Stock Entry of type Material Transfer; calculate ordered_qty and per_ordered in Material Request using observer pattern when Stock Entry against it is submitted or cancelled

This commit is contained in:
Anand Doshi
2013-02-20 18:44:10 +05:30
parent 7ce7d7cad4
commit cf05580f8e
18 changed files with 348 additions and 85 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2011-05-20 10:07:55",
"docstatus": 0,
"modified": "2013-02-18 13:41:21",
"modified": "2013-02-20 18:20:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -40,6 +40,13 @@
"match_id": 0,
"to_field": "transaction_date"
},
{
"doctype": "Field Mapper Detail",
"from_field": "eval:\"Purchase\"",
"map": "Yes",
"match_id": 0,
"to_field": "material_request_type"
},
{
"checking_operator": "=",
"doctype": "Field Mapper Detail",

View File

@@ -109,7 +109,11 @@ cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = fun
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {
return 'SELECT DISTINCT `tabMaterial Request`.`name` FROM `tabMaterial Request` WHERE `tabMaterial Request`.company = "' + doc.company + '" and `tabMaterial Request`.`docstatus` = 1 and `tabMaterial Request`.`status` != "Stopped" and ifnull(`tabMaterial Request`.`per_ordered`,0) < 99.99 and `tabMaterial Request`.%(key)s LIKE "%s" ORDER BY `tabMaterial Request`.`name` DESC LIMIT 50';
return 'SELECT DISTINCT `name` FROM `tabMaterial Request` \
WHERE material_request_type="Purchase" and company = "' + doc.company
+ '" and `docstatus` = 1 and `status` != "Stopped" \
and ifnull(`per_ordered`,0) < 99.99 and %(key)s LIKE "%s" \
ORDER BY `name` DESC LIMIT 50';
}

View File

@@ -261,7 +261,6 @@ class DocType(BuyingController):
self.delete_irrelevant_raw_material()
#---------------calculate amt in Purchase Order Item Supplied-------------
self.calculate_amount(d)
def add_bom(self, d):
#----- fetching default bom from Bill of Materials instead of Item Master --
@@ -314,15 +313,6 @@ class DocType(BuyingController):
d.parent = 'old_par:'+self.doc.name
d.save()
def calculate_amount(self, d):
amt = 0
for i in getlist(self.doclist,'po_raw_material_details'):
if(i.reference_name == d.name):
i.amount = flt(i.required_qty)* flt(i.rate)
amt += i.amount
d.rm_supp_cost = amt
# On Update
# ----------------------------------------------------------------------------------------------------
def on_update(self):

View File

@@ -88,13 +88,11 @@ cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query
}
cur_frm.fields_dict['indent_no'].get_query = function(doc) {
return "select distinct `tabMaterial Request`.`name` from `tabMaterial Request` \
where `tabMaterial Request`.company = \"" + doc.company +
"\" and `tabMaterial Request`.`docstatus` = 1 and \
`tabMaterial Request`.`status` != \"Stopped\" and \
ifnull(`tabMaterial Request`.`per_ordered`,0) < 99.99 and \
`tabMaterial Request`.%(key)s LIKE \"%s\" \
order by `tabMaterial Request`.`name` desc limit 50";
return "select distinct `name` from `tabMaterial Request` \
where material_request_type='Purchase' and company = \"" + doc.company +
"\" and `docstatus` = 1 and `status` != \"Stopped\" and \
ifnull(`per_ordered`,0) < 99.99 and \
%(key)s LIKE \"%s\" order by `name` desc limit 50";
}
cur_frm.cscript.supplier_address = function(doc, dt, dn) {