Merge pull request #25374 from ankush/shipment_status_update
fix: commit changes to shipment status in database
This commit is contained in:
commit
4ed5d994a4
@ -7,11 +7,29 @@ rules:
|
||||
- pattern-inside: |
|
||||
def on_submit(self, ...):
|
||||
...
|
||||
- metavariable-regex:
|
||||
metavariable: '$ATTR'
|
||||
# this is negative look-ahead, add more attrs to ignore like (ignore|ignore_this_too|ignore_me)
|
||||
regex: '^(?!status_updater)(.*)$'
|
||||
message: |
|
||||
Doctype modified after submission. Please check if modification of self.$ATTR is commited to database.
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
|
||||
- id: frappe-modifying-after-cancel
|
||||
patterns:
|
||||
- pattern: self.$ATTR = ...
|
||||
- pattern-inside: |
|
||||
def on_cancel(self, ...):
|
||||
...
|
||||
- metavariable-regex:
|
||||
metavariable: '$ATTR'
|
||||
regex: '^(?!ignore_linked_doctypes|status_updater)(.*)$'
|
||||
message: |
|
||||
Doctype modified after cancellation. Please check if modification of self.$ATTR is commited to database.
|
||||
languages: [python]
|
||||
severity: ERROR
|
||||
|
||||
- id: frappe-print-function-in-doctypes
|
||||
pattern: print(...)
|
||||
message: |
|
||||
|
@ -772,3 +772,4 @@ erpnext.patches.v12_0.purchase_receipt_status
|
||||
erpnext.patches.v13_0.fix_non_unique_represents_company
|
||||
erpnext.patches.v12_0.add_document_type_field_for_italy_einvoicing
|
||||
erpnext.patches.v13_0.make_non_standard_user_type #13-04-2021
|
||||
erpnext.patches.v13_0.update_shipment_status
|
||||
|
14
erpnext/patches/v13_0/update_shipment_status.py
Normal file
14
erpnext/patches/v13_0/update_shipment_status.py
Normal file
@ -0,0 +1,14 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "shipment")
|
||||
|
||||
# update submitted status
|
||||
frappe.db.sql("""UPDATE `tabShipment`
|
||||
SET status = "Submitted"
|
||||
WHERE status = "Draft" AND docstatus = 1""")
|
||||
|
||||
# update cancelled status
|
||||
frappe.db.sql("""UPDATE `tabShipment`
|
||||
SET status = "Cancelled"
|
||||
WHERE status = "Draft" AND docstatus = 2""")
|
@ -23,10 +23,10 @@ class Shipment(Document):
|
||||
frappe.throw(_('Please enter Shipment Parcel information'))
|
||||
if self.value_of_goods == 0:
|
||||
frappe.throw(_('Value of goods cannot be 0'))
|
||||
self.status = 'Submitted'
|
||||
self.db_set('status', 'Submitted')
|
||||
|
||||
def on_cancel(self):
|
||||
self.status = 'Cancelled'
|
||||
self.db_set('status', 'Cancelled')
|
||||
|
||||
def validate_weight(self):
|
||||
for parcel in self.shipment_parcel:
|
||||
|
Loading…
Reference in New Issue
Block a user