Add basic edit support for Purchases
This commit is contained in:
parent
0dc344b821
commit
36d4f0a5f7
|
@ -42,7 +42,6 @@ class PurchaseView(MasterView):
|
|||
"""
|
||||
model_class = model.Purchase
|
||||
creatable = False
|
||||
editable = False
|
||||
|
||||
has_rows = True
|
||||
model_row_class = model.PurchaseItem
|
||||
|
@ -73,7 +72,6 @@ class PurchaseView(MasterView):
|
|||
'status',
|
||||
'buyer',
|
||||
'date_ordered',
|
||||
'date_received',
|
||||
'po_number',
|
||||
'po_total',
|
||||
'ship_method',
|
||||
|
@ -81,6 +79,7 @@ class PurchaseView(MasterView):
|
|||
'invoice_date',
|
||||
'invoice_number',
|
||||
'invoice_total',
|
||||
'date_received',
|
||||
'created',
|
||||
'created_by',
|
||||
'batches',
|
||||
|
@ -201,22 +200,57 @@ class PurchaseView(MasterView):
|
|||
def configure_form(self, f):
|
||||
super(PurchaseView, self).configure_form(f)
|
||||
|
||||
# id
|
||||
f.set_renderer('id', self.render_id_str)
|
||||
f.set_readonly('id')
|
||||
|
||||
f.set_renderer('store', self.render_store)
|
||||
|
||||
# vendor
|
||||
f.set_renderer('vendor', self.render_vendor)
|
||||
f.set_readonly('vendor')
|
||||
|
||||
# department
|
||||
f.set_renderer('department', self.render_department)
|
||||
|
||||
# buyer
|
||||
f.set_readonly('buyer')
|
||||
|
||||
# date_ordered
|
||||
f.set_type('date_ordered', 'date_jquery')
|
||||
|
||||
# po_number
|
||||
f.set_label('po_number', "PO Number")
|
||||
|
||||
# po_total
|
||||
f.set_type('po_total', 'currency')
|
||||
f.set_readonly('po_total')
|
||||
f.set_label('po_total', "PO Total")
|
||||
|
||||
# notes_to_vendor
|
||||
f.set_type('notes_to_vendor', 'text_wrapped')
|
||||
|
||||
# date_received
|
||||
f.set_type('date_received', 'date_jquery')
|
||||
|
||||
# invoice_date
|
||||
f.set_type('invoice_date', 'date_jquery')
|
||||
|
||||
# invoice_total
|
||||
f.set_type('invoice_total', 'currency')
|
||||
f.set_readonly('invoice_total')
|
||||
|
||||
# status
|
||||
f.set_readonly('status')
|
||||
f.set_enum('status', self.enum.PURCHASE_STATUS)
|
||||
|
||||
f.set_label('po_number', "PO Number")
|
||||
f.set_label('po_total', "PO Total")
|
||||
f.set_type('po_total', 'currency')
|
||||
|
||||
f.set_type('invoice_total', 'currency')
|
||||
|
||||
# batches
|
||||
f.set_renderer('batches', self.render_batches)
|
||||
f.set_readonly('batches')
|
||||
|
||||
# created
|
||||
f.set_readonly('created')
|
||||
f.set_readonly('created_by')
|
||||
|
||||
if self.viewing:
|
||||
purchase = f.model_instance
|
||||
|
|
|
@ -539,7 +539,7 @@ class ReceivingBatchView(PurchasingBatchView):
|
|||
f.set_widget('purchase_uuid', dfwidget.SelectWidget(values=values))
|
||||
f.set_label('purchase_uuid', "Purchase Order")
|
||||
f.set_required('purchase_uuid')
|
||||
else:
|
||||
elif self.creating or not batch.purchase:
|
||||
f.remove_field('purchase')
|
||||
|
||||
# department
|
||||
|
|
Loading…
Reference in a new issue