Allow manual removal of CORE ID for Product
This commit is contained in:
parent
b1e2af84b1
commit
ca1b865c0f
|
@ -57,9 +57,22 @@ class ProductView(base.ProductsView):
|
|||
def configure_form(self, f):
|
||||
super(ProductView, self).configure_form(f)
|
||||
|
||||
f.set_required('corepos_id', False)
|
||||
if self.creating:
|
||||
f.remove('corepos_id')
|
||||
|
||||
def objectify(self, form, data=None):
|
||||
if data is None:
|
||||
data = form.validated
|
||||
product = super(ProductView, self).objectify(form, data)
|
||||
|
||||
# remove the corepos extension record outright, if we just lost the ID
|
||||
if product._corepos and not product.corepos_id:
|
||||
self.Session.delete(product._corepos)
|
||||
self.Session.flush()
|
||||
|
||||
return product
|
||||
|
||||
def get_version_child_classes(self):
|
||||
model = self.rattail_config.get_model()
|
||||
return super(ProductView, self).get_version_child_classes() + [
|
||||
|
|
Loading…
Reference in a new issue