def _edit(self, **kw): """ 'manange_edit' function for ZSQLMethod needs to be called everytime after editing SQLMethod object. This would insure the update of _arg and template attribute for SQLMethod which are used while creating query. https://github.com/zopefoundation/Products.ZSQLMethods/blob/master/src/Shared/DC/ZRDB/DA.py#L353 """ XMLObject._edit(self, **kw) src = self.getSrc() title = self.title if title is None: title = '' connection_id = self.getConnectionId() self.manage_edit(title, connection_id, self.arguments_src, src)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if 'source_debit' in kw and 'source_credit' in kw: source_credit = kw.pop('source_credit') or 0 source_debit = kw.pop('source_debit') or 0 quantity += (source_credit - source_debit) kw['quantity'] = quantity kw['cancellation_amount'] = (source_credit < 0 or source_debit < 0) if 'destination_debit' in kw and 'destination_credit' in kw: destination_credit = kw.pop('destination_credit') or 0 destination_debit = kw.pop('destination_debit') or 0 quantity += (destination_debit - destination_credit) kw['quantity'] = quantity kw['cancellation_amount'] = (destination_credit < 0 or destination_debit < 0) # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get('source_asset_debit') or kw.get('source_asset_credit'): if kw.get('source_asset_debit') in (None, ''): kw.pop('source_asset_debit', None) if kw.get('source_asset_credit') in (None, ''): kw.pop('source_asset_credit', None) if kw.get('destination_asset_debit') or kw.get( 'destination_asset_credit'): if kw.get('destination_asset_debit') in (None, ''): kw.pop('destination_asset_debit', None) if kw.get('destination_asset_credit') in (None, ''): kw.pop('destination_asset_credit', None) if not edit_order: edit_order = ( 'variation_category_list', 'variation_property_dict', ) return XMLObject._edit(self, edit_order=edit_order, **kw)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if 'source_debit' in kw and 'source_credit' in kw: source_credit = kw.pop('source_credit') or 0 source_debit = kw.pop('source_debit') or 0 quantity += (source_credit - source_debit) kw['quantity'] = quantity kw['cancellation_amount'] = (source_credit < 0 or source_debit < 0) if 'destination_debit' in kw and 'destination_credit' in kw: destination_credit = kw.pop('destination_credit') or 0 destination_debit = kw.pop('destination_debit') or 0 quantity += (destination_debit - destination_credit) kw['quantity'] = quantity kw['cancellation_amount'] = (destination_credit < 0 or destination_debit < 0) # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get('source_asset_debit') or kw.get('source_asset_credit'): if kw.get('source_asset_debit') in (None, ''): kw.pop('source_asset_debit', None) if kw.get('source_asset_credit') in (None, ''): kw.pop('source_asset_credit', None) if kw.get('destination_asset_debit') or kw.get('destination_asset_credit'): if kw.get('destination_asset_debit') in (None, ''): kw.pop('destination_asset_debit', None) if kw.get('destination_asset_credit') in (None, ''): kw.pop('destination_asset_credit', None) if not edit_order: edit_order = ('variation_category_list', 'variation_property_dict',) return XMLObject._edit(self, edit_order=edit_order, **kw)
def _edit(self, edit_order=(), **kw): """Overloaded _edit to support setting debit and credit at the same time, which is required for the GUI. Also sets the variation category list and property dict at the end, because _setVariationCategoryList and _setVariationPropertyDict needs the resource to be set. """ quantity = 0 if "source_debit" in kw and "source_credit" in kw: source_credit = kw.pop("source_credit") or 0 source_debit = kw.pop("source_debit") or 0 quantity += source_credit - source_debit kw["quantity"] = quantity kw["cancellation_amount"] = source_credit < 0 or source_debit < 0 if "destination_debit" in kw and "destination_credit" in kw: destination_credit = kw.pop("destination_credit") or 0 destination_debit = kw.pop("destination_debit") or 0 quantity += destination_debit - destination_credit kw["quantity"] = quantity kw["cancellation_amount"] = destination_credit < 0 or destination_debit < 0 # If both asset debit and asset credit are passed, we have to take care not # to erase the asset price if one of them is unset. if kw.get("source_asset_debit") or kw.get("source_asset_credit"): if kw.get("source_asset_debit") in (None, ""): kw.pop("source_asset_debit", None) if kw.get("source_asset_credit") in (None, ""): kw.pop("source_asset_credit", None) if kw.get("destination_asset_debit") or kw.get("destination_asset_credit"): if kw.get("destination_asset_debit") in (None, ""): kw.pop("destination_asset_debit", None) if kw.get("destination_asset_credit") in (None, ""): kw.pop("destination_asset_credit", None) if not edit_order: edit_order = ("variation_category_list", "variation_property_dict") return XMLObject._edit(self, edit_order=edit_order, **kw)