Prevent catalog/invoice cost edits if receiving batch is complete
This commit is contained in:
parent
1f97d4f5e5
commit
6274e33a8c
|
@ -737,14 +737,36 @@ class ReceivingBatchView(PurchasingBatchView):
|
||||||
return breakdown
|
return breakdown
|
||||||
|
|
||||||
def allow_edit_catalog_unit_cost(self, batch):
|
def allow_edit_catalog_unit_cost(self, batch):
|
||||||
return (not batch.executed
|
|
||||||
and self.has_perm('edit_row')
|
# batch must not yet be frozen
|
||||||
and self.batch_handler.allow_receiving_edit_catalog_unit_cost())
|
if batch.executed or batch.complete:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# user must have edit_row perm
|
||||||
|
if not self.has_perm('edit_row'):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# config must allow this generally
|
||||||
|
if not self.batch_handler.allow_receiving_edit_catalog_unit_cost():
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def allow_edit_invoice_unit_cost(self, batch):
|
def allow_edit_invoice_unit_cost(self, batch):
|
||||||
return (not batch.executed
|
|
||||||
and self.has_perm('edit_row')
|
# batch must not yet be frozen
|
||||||
and self.batch_handler.allow_receiving_edit_invoice_unit_cost())
|
if batch.executed or batch.complete:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# user must have edit_row perm
|
||||||
|
if not self.has_perm('edit_row'):
|
||||||
|
return False
|
||||||
|
|
||||||
|
# config must allow this generally
|
||||||
|
if not self.batch_handler.allow_receiving_edit_invoice_unit_cost():
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def template_kwargs_view(self, **kwargs):
|
def template_kwargs_view(self, **kwargs):
|
||||||
kwargs = super(ReceivingBatchView, self).template_kwargs_view(**kwargs)
|
kwargs = super(ReceivingBatchView, self).template_kwargs_view(**kwargs)
|
||||||
|
|
Loading…
Reference in a new issue