[fixes][merge conflict]

This commit is contained in:
Nabin Hait
2013-06-05 12:53:53 +05:30
14 changed files with 397 additions and 133 deletions

View File

@@ -158,7 +158,7 @@ class DocType(AccountsController):
if r:
self.doc.remark = ("\n").join(r)
else:
webnotes.msgprint("Remarks is mandatory", raise_exception=1)
webnotes.msgprint("User Remarks is mandatory", raise_exception=1)
def set_aging_date(self):
if self.doc.is_opening != 'Yes':

View File

@@ -33,6 +33,28 @@ class DocType(BuyingController):
self.doc, self.doclist = d, dl
self.tname = 'Purchase Invoice Item'
self.fname = 'entries'
self.status_updater = [{
'source_dt': 'Purchase Invoice Item',
'target_dt': 'Purchase Order Item',
'join_field': 'po_detail',
'target_field': 'billed_amt',
'target_parent_dt': 'Purchase Order',
'target_parent_field': 'per_billed',
'target_ref_field': 'import_amount',
'source_field': 'import_amount',
'percent_join_field': 'purchase_order',
},
{
'source_dt': 'Purchase Invoice Item',
'target_dt': 'Purchase Receipt Item',
'join_field': 'pr_detail',
'target_field': 'billed_amt',
'target_parent_dt': 'Purchase Receipt',
'target_parent_field': 'per_billed',
'target_ref_field': 'import_amount',
'source_field': 'import_amount',
'percent_join_field': 'purchase_receipt',
}]
def validate(self):
super(DocType, self).validate()
@@ -391,8 +413,8 @@ class DocType(BuyingController):
self.make_gl_entries()
self.update_against_document_in_jv()
purchase_controller.update_prevdoc_detail(self, is_submit = 1)
self.update_prevdoc_status()
def make_gl_entries(self):
from accounts.general_ledger import make_gl_entries
@@ -503,7 +525,8 @@ class DocType(BuyingController):
def on_cancel(self):
from accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_voucher")
get_obj(dt = 'Purchase Common').update_prevdoc_detail(self, is_submit = 0)
self.update_prevdoc_status()
self.make_cancel_gl_entries()

View File

@@ -38,6 +38,35 @@ class DocType(SellingController):
self.log = []
self.tname = 'Sales Invoice Item'
self.fname = 'entries'
self.status_updater = [{
'source_dt': 'Sales Invoice Item',
'target_field': 'billed_amt',
'target_ref_field': 'export_amount',
'target_dt': 'Sales Order Item',
'join_field': 'so_detail',
'target_parent_dt': 'Sales Order',
'target_parent_field': 'per_billed',
'source_field': 'export_amount',
'join_field': 'so_detail',
'percent_join_field': 'sales_order',
'status_field': 'billing_status',
'keyword': 'Billed'
},
{
'source_dt': 'Sales Invoice Item',
'target_dt': 'Delivery Note Item',
'join_field': 'dn_detail',
'target_field': 'billed_amt',
'target_parent_dt': 'Delivery Note',
'target_parent_field': 'per_billed',
'target_ref_field': 'export_amount',
'source_field': 'export_amount',
'percent_join_field': 'delivery_note',
'status_field': 'billing_status',
'keyword': 'Billed',
'no_tolerance': True,
}]
def validate(self):
super(DocType, self).validate()
@@ -99,7 +128,9 @@ class DocType(SellingController):
self.set_buying_amount()
self.check_prev_docstatus()
get_obj("Sales Common").update_prevdoc_detail(1,self)
self.update_status_updater_args()
self.update_prevdoc_status()
# this sequence because outstanding may get -ve
self.make_gl_entries()
@@ -128,10 +159,30 @@ class DocType(SellingController):
from accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_invoice")
sales_com_obj.update_prevdoc_detail(0, self)
self.update_status_updater_args()
self.update_prevdoc_status()
self.make_cancel_gl_entries()
def update_status_updater_args(self):
if cint(self.doc.is_pos) and cint(self.doc.update_stock):
self.status_updater.append({
'source_dt':'Sales Invoice Item',
'target_dt':'Sales Order Item',
'target_parent_dt':'Sales Order',
'target_parent_field':'per_delivered',
'target_field':'delivered_qty',
'target_ref_field':'qty',
'source_field':'qty',
'join_field':'so_detail',
'percent_join_field':'sales_order',
'status_field':'delivery_status',
'keyword':'Delivered',
'second_source_dt': 'Delivery Note Item',
'second_source_field': 'qty',
'second_join_field': 'prevdoc_detail_docname'
})
def on_update_after_submit(self):
self.validate_recurring_invoice()
self.convert_to_recurring()
@@ -269,7 +320,7 @@ class DocType(SellingController):
ret = self.get_debit_to()
self.doc.debit_to = ret.get('debit_to')
def get_barcode_details(self, barcode):
return get_obj('Sales Common').get_barcode_details(barcode)