Setting the status of the document when doing Submit

Hello;

I have trip order which is a customized document created under the customized application (taxi). The trip order existed in this path: (/home/frappe/frappe-bench/apps/taxi/taxi/taxi/doctype/trip_order$)

I used set_status() but it is not working.
I am sure there is a way to set the document status, but how?
What I am missing?

from erpnext.controllers.selling_controller import SellingController

#class TripOrder(Document):
class TripOrder(SellingController):

    def on_submit(self):

            self.status = "Upaid"
            self.set_status(update=True, status=self.status)

    def set_indicator(self):
            self.indicator_color = "orange"
            self.indicator_title = _("Unpaid")

Regards
Bilal

OK. I got to know that status of the document can be set using frappe.listview_settings in file: doctype_list.js, but the question is:

What is the using for (what it does): set_status and the set_indicator methods that are used in .py files (example in sales_invoice.py).

Because in sales_invoice_list.js, I noticed that the status is not depending on the doc.status value, so why self.set_status was used in sales_invoice.py?

This code shows the usage of self.set_status() in sales_invoice.py:

    def validate(self):
            super(SalesInvoice, self).validate()
            self.validate_auto_set_posting_time()

            if not self.is_pos:
                    self.so_dn_required()

            self.validate_proj_cust()
            self.validate_with_previous_doc()
            self.validate_uom_is_integer("stock_uom", "stock_qty")
            self.validate_uom_is_integer("uom", "qty")
            self.check_close_sales_order("sales_order")
            self.validate_debit_to_acc()
            self.clear_unallocated_advances("Sales Invoice Advance", "advances")
            self.add_remarks()
            self.validate_write_off_account()
            self.validate_duplicate_offline_pos_entry()
            self.validate_account_for_change_amount()
            self.validate_fixed_asset()
            self.set_income_account_for_fixed_assets()

            if cint(self.is_pos):
                    self.validate_pos()

            if cint(self.update_stock):
                    self.validate_dropship_item()
                    self.validate_item_code()
                    self.validate_warehouse()
                    self.update_current_stock()
                    self.validate_delivery_note()

            if not self.is_opening:
                    self.is_opening = 'No'

            if self._action != 'submit' and self.update_stock and not self.is_return:
                    set_batch_nos(self, 'warehouse', True)


            self.set_against_income_account()
            self.validate_c_form()
            self.validate_time_sheets_are_submitted()
            self.validate_multiple_billing("Delivery Note", "dn_detail", "amount", "items")
            if not self.is_return:
                    self.validate_serial_numbers()
            self.update_packing_list()
            self.set_billing_hours_and_amount()
            self.update_timesheet_billing_for_project()
            self.set_status()

I would to know what it does this set_status and what is the difference of using it and setting the status at: sales_invoice_list.js?

Regards
Bilal

As per our new policy, developer help will be given over a pull request :slight_smile:

1 Like

Hello @rmehta

I am ready to contribute with the Taxi module code (although it is really not ready and need more work). Well, let us start this: Do you advise me to open issue and assign it for my self, or still there is earlier step to be done?

Thanks for ERPNext team and it is your right and I understand you totally, and I will be proud when I place my code to be part of ERPNext. Please guide me and take in my hand. :slight_smile:

Regards
Bilal