listview of purchase invoice and deletion of supplier
This commit is contained in:
parent
318eab813c
commit
486718250e
@ -4,6 +4,7 @@ wn.doclistviews['Purchase Invoice'] = wn.views.ListView.extend({
|
||||
this._super(d);
|
||||
this.fields = this.fields.concat([
|
||||
'`tabPurchase Invoice`.supplier_name',
|
||||
'`tabPurchase Invoice`.credit_to',
|
||||
'`tabPurchase Invoice`.currency',
|
||||
'IFNULL(`tabPurchase Invoice`.grand_total_import, 0) as grand_total_import',
|
||||
'IFNULL(`tabPurchase Invoice`.grand_total, 0) as grand_total',
|
||||
@ -24,7 +25,13 @@ wn.doclistviews['Purchase Invoice'] = wn.views.ListView.extend({
|
||||
{width: '5%', content: 'avatar'},
|
||||
{width: '3%', content: 'docstatus'},
|
||||
{width: '15%', content: 'name'},
|
||||
{width: '34%', content: 'supplier_name+tags', css: {color: '#222'}},
|
||||
{
|
||||
width: '34%',
|
||||
content: function(parent, data) {
|
||||
$(parent).html(data.supplier_name?data.supplier_name:data.credit_to)
|
||||
},
|
||||
css: {color: '#222'}
|
||||
},
|
||||
{
|
||||
width: '18%',
|
||||
content: function(parent, data) {
|
||||
|
@ -163,10 +163,21 @@ class DocType:
|
||||
delete from `tabCommunication`
|
||||
where supplier = %s and customer is null""", self.doc.name)
|
||||
|
||||
def delete_supplier_account(self):
|
||||
"""delete supplier's ledger if exist and check balance before deletion"""
|
||||
acc = sql("select name from `tabAccount` where master_type = 'Supplier' \
|
||||
and master_name = %s and docstatus < 2", self.doc.name)
|
||||
if acc:
|
||||
from webnotes.model import delete_doc
|
||||
delete_doc('Account', acc[0][0])
|
||||
|
||||
|
||||
def on_trash(self):
|
||||
self.delete_supplier_address()
|
||||
self.delete_supplier_contact()
|
||||
self.delete_supplier_communication()
|
||||
self.delete_supplier_account()
|
||||
|
||||
|
||||
# on rename
|
||||
# ---------
|
||||
|
Loading…
x
Reference in New Issue
Block a user