def __init__(self, store, model, model_type, visual_mode=False): self._proxy = None self.model = model self.model_type = model_type self.default_max_discount = sysparam(store).MAX_SALE_DISCOUNT self.max_discount = self.default_max_discount BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, wizard, parent, store, order_obj, payment_method, outstanding_value=currency(0), first_duedate=None, installments_number=None): self.wizard = wizard self.parent = parent # Note that 'order' may be a Sale or a PurchaseOrder object self.order = order_obj self.method = payment_method self.payment_type = self._get_payment_type() self.total_value = outstanding_value or self._get_total_amount() self.payment_group = self.order.group self.payment_list = None # This is very useful when calculating the total amount outstanding # or overpaid of the payments self.interest_total = currency(0) self._first_duedate = first_duedate self._installments_number = installments_number BaseEditorSlave.__init__(self, store) self.register_validate_function(self._refresh_next) # Most of slaves don't have bank information self.bank_combo.hide() self.bank_label.hide()
def __init__(self, wizard, parent, store, order, payment_method, outstanding_value=currency(0), finish_on_total=True, allow_remove_paid=True): """ :param finish_on_total: finalize the payment when the total value is reached. """ self._has_modified_payments = False self._allow_remove_paid = allow_remove_paid self.finish_on_total = finish_on_total # We need a temporary object to hold the value that will be read from # the user. We will set a proxy with this temporary object to help # with the validation. self._holder = Settable(value=Decimal(0)) self._wizard = wizard # 'money' is the default payment method and it is always avaliable. self._method = PaymentMethod.get_by_name(store, u'money') BaseEditorSlave.__init__(self, store, order) self._outstanding_value = (outstanding_value or self._get_total_amount()) self._total_value = self._outstanding_value self._setup_widgets() self.register_validate_function(self._refresh_next) self.force_validation()
def __init__(self, store, product=None, visual_mode=False): self._product = product self._remove_component_list = [] # Temporary component value to prevent emmiting the signal when not # necessary self._previous_value = product.sellable.cost if product else 0 BaseEditorSlave.__init__(self, store, model=None, visual_mode=visual_mode)
def __init__(self, store, employee, edit_mode, visual_mode=False): self.employee = employee self.person = employee.person self.salesperson = self.person.salesperson self.is_edit_mode = edit_mode self.current_role_history = self._get_active_role_history() BaseEditorSlave.__init__(self, store, visual_mode=visual_mode)
def __init__(self, store, model, parent): self.model = model self.icms_slave = parent.icms_slave self.ipi_slave = parent.ipi_slave self.pis_slave = parent.pis_slave self.cofins_slave = parent.cofins_slave self.quantity_model = Settable(quantity=model.quantity) BaseEditorSlave.__init__(self, store, self.model)
def __init__(self, store, model, visual_mode=False): self.purchases = list(model.get_purchase_orders()) # Save the receiving order if there is only one for this receiving invoice try: self._receiving_order = model.receiving_orders.one() except NotOneError: self._receiving_order = None BaseEditorSlave.__init__(self, store, model, visual_mode)
def __init__(self, store, person, model=None, is_main_address=True, visual_mode=False, db_form=None): self.person = person self.is_main_address = (model and model.is_main_address or is_main_address) self.db_form = db_form if model is not None: model = store.fetch(model) model = _AddressModel(model, store) BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model=None, person_slave=None, visual_mode=False): """ Creates a new IndividualEditorTemplate object :param store: a store :param model: model :param person_slave: the person slave :param visual_model: """ self._person_slave = person_slave BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, workorder, show_finish_date=False): """ :param workorder: The |workorder| this slave is editing. We will actually edit another object, but the |workorder| will be used to fetch or create it. :param show_finish_date: If the estimated finish date property of the work order should be editable in this slave. """ self._show_finish_date = show_finish_date self._workorder = workorder model = self._create_model(store) BaseEditorSlave.__init__(self, store, model)
def __init__(self, store, model, model_type, visual_mode=False): self._proxy = None self.model = model self.model_type = model_type self.default_max_discount = sysparam.get_decimal('MAX_SALE_DISCOUNT') self.max_discount = self.default_max_discount # If there is an original discount, this means the sale was from a trade, # and the parameter USE_TRADE_AS_DISCOUNT must be set. self.original_discount = self.model.discount_value * 100 / self.model.get_sale_subtotal() if self.original_discount: assert sysparam.get_bool('USE_TRADE_AS_DISCOUNT') self.original_sale_amount = self.model.get_total_sale_amount() BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, sellable=None, visual_mode=False): self.image_model = model self._updating_widgets = False self._sellable = sellable BaseEditorSlave.__init__(self, store, model, visual_mode) self._setup_thumbnail() self._setup_widgets() self._app_info = Gio.app_info_get_default_for_type('image/png', False) if not self._app_info: # Hide view item if we don't have any app to visualize it. self.view_item.hide()
def __init__(self, store, person, model=None, is_main_address=True, visual_mode=False, db_form=None): self.person = person self.is_main_address = (model and model.is_main_address or is_main_address) self.db_form = db_form if model is not None: model = store.fetch(model) model = _AddressModel(model, store) plugin = get_plugin_manager() self._nfe_active = plugin.is_any_active(['nfe', 'nfce']) BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, parent): self.model = model self.icms_slave = parent.icms_slave self.ipi_slave = parent.ipi_slave # Use a temporary object to edit the quantities, so we can delay the # database constraint checks self.quantity_model = Settable(quantity=model.quantity, reserved=model.quantity_decreased) self.proxy = None BaseEditorSlave.__init__(self, store, self.model) sale = self.model.sale if sale.status == Sale.STATUS_CONFIRMED: self._set_not_editable()
def __init__(self, store, workorder, show_finish_date=False, visual_mode=False): """ :param workorder: The |workorder| this slave is editing. We will actually edit another object, but the |workorder| will be used to fetch or create it. :param show_finish_date: If the estimated finish date property of the work order should be editable in this slave. """ self._show_finish_date = show_finish_date self._workorder = workorder model = self._create_model(store) # This is used to correctly triangulate the values of the spherical # widgets self._update_order = {"re": [], "le": []} BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, workorder, show_finish_date=False, visual_mode=False): """ :param workorder: The |workorder| this slave is editing. We will actually edit another object, but the |workorder| will be used to fetch or create it. :param show_finish_date: If the estimated finish date property of the work order should be editable in this slave. """ self._show_finish_date = show_finish_date self._workorder = workorder model = self._create_model(store) # This is used to correctly triangulate the values of the spherical # widgets self._update_order = {'re': [], 'le': []} BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, can_change=True, can_erase=True, visual_mode=False): self._image_model = model model = _DummyImageModel() BaseEditorSlave.__init__(self, store, model, visual_mode) self._setup_image_model() self._setup_widgets() if not can_change: self.edit_item.hide() if not can_erase: self.erase_item.hide() self._app_info = gio.app_info_get_default_for_type('image/png', False) if not self._app_info: # Hide view item if we don't have any app to visualize it. self.view_item.hide()
def __init__(self, wizard, parent, store, order, payment_method, outstanding_value=currency(0), first_duedate=None, installments_number=None): self.order = order self.wizard = wizard self.method = payment_method self._payment_group = self.order.group self.total_value = (outstanding_value or self._get_total_amount()) self._selected_type = CreditCardData.TYPE_CREDIT BaseEditorSlave.__init__(self, store) self.register_validate_function(self._refresh_next) self.parent = parent self._order = order # this will change after the payment type is changed self.installments_number.set_range(1, 1) self._refresh_next(False)
def __init__(self, store, workorder, show_finish_date=False, visual_mode=False, description=u"", parent=None): """ :param workorder: The |workorder| this slave is editing. We will actually edit another object, but the |workorder| will be used to fetch or create it. :param show_finish_date: If the estimated finish date property of the work order should be editable in this slave. """ self._update_level = 0 self.parent = parent self._focus_change = False self._show_finish_date = show_finish_date self._workorder = workorder self._description = description model = self._create_model(store) # This is used to correctly triangulate the values of the spherical # widgets self._update_order = {'re': [], 'le': []} BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, parent): self.model = model self.icms_slave = parent.icms_slave self.ipi_slave = parent.ipi_slave # Use a temporary object to edit the quantities, so we can delay the # database constraint checks self.quantity_model = Settable(quantity=model.quantity, reserved=model.quantity_decreased) self.proxy = None BaseEditorSlave.__init__(self, store, self.model) sale = self.model.sale if sale.status == Sale.STATUS_CONFIRMED: self._set_not_editable() if model.parent_item: # We should not allow the user to edit the children self._set_not_editable() self.reserved.set_sensitive(False) sellable = model.sellable if sellable.product and sellable.product.is_package: # Do not allow the user to edit the price of the package self.price.set_sensitive(False)
def __init__(self, store, model=None, db_form=None, visual_mode=False): self.db_form = db_form BaseEditorSlave.__init__(self, store, model, visual_mode) self._setup_image_slave(model and model.image)
def __init__(self, store, *args, **kargs): self.is_updating = False self.proxy = None BaseEditorSlave.__init__(self, store, *args, **kargs)
def __init__(self, store, model=None, visual_mode=False, confirm_password=True): BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode) self._confirm_password = confirm_password self._setup_widgets()
def __init__(self, store, *args, **kargs): self.proxy = None BaseEditorSlave.__init__(self, store, *args, **kargs)
def __init__(self, store, model, wizard): self.wizard = wizard BaseEditorSlave.__init__(self, store, model) self._setup_widgets()
def __init__(self, store, product=None, visual_mode=False): self._product = product self._remove_component_list = [] BaseEditorSlave.__init__(self, store, model=None, visual_mode=visual_mode) self._setup_widgets()
def __init__(self, store, wizard, model=None, previous=None): logger.info('Entering wizard step: %s' % self.__class__.__name__) self.wizard = wizard WizardStep.__init__(self, previous) BaseEditorSlave.__init__(self, store, model)
def __init__(self, store, model, parent): self.model = model self.icms_slave = parent.icms_slave self.ipi_slave = parent.ipi_slave self.quantity_model = Settable(quantity=model.quantity) BaseEditorSlave.__init__(self, store, self.model)
def __init__(self, store, parent): self._parent = parent self._product = self._parent.model.product BaseEditorSlave.__init__(self, store)
def __init__(self, store, medic, model=None, visual_mode=False): self._medic = medic BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store): self._items = [] self._product = None BaseEditorSlave.__init__(self, store=store, model=None)
def __init__(self, store, model, visual_mode=False): BaseEditorSlave.__init__(self, store, model, visual_mode) self._setup_widgets()
def __init__(self, store, model, visual_mode=False): self.purchases = list(model.purchase_orders) BaseEditorSlave.__init__(self, store, model, visual_mode)
def __init__(self, model): self.model = model BaseEditorSlave.__init__(self, None, self.model)
def __init__(self, store, model, visual_mode=False, ui_form_name=None): self.model = model self.model_type = self.model_type or type(model) BaseEditorSlave.__init__(self, store, self.model, visual_mode=visual_mode) self.notes.set_accepts_tab(False)
def __init__(self, store, model, visual_mode=None, ui_form_name=None): self.db_form = DatabaseForm(ui_form_name) if ui_form_name else None BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, visual_mode=False, ui_form_name=None): # Even though we dont use ui_form_name anywhere in this class, its setup # is made in a way we need this argument. see persontemplate # attach_model_slave method BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, parent, *args, **kwargs): self.parent = parent BaseEditorSlave.__init__(self, *args, **kwargs)
def __init__(self, store, model, visual_mode=False): BaseEditorSlave.__init__(self, store, model, visual_mode) self._original_salary = self.model.salary
def __init__(self, store, model=None, person_slave=None, visual_mode=False): self._person_slave = person_slave BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, show_password_fields=True, visual_mode=False): self.show_password_fields = show_password_fields BaseEditorSlave.__init__(self, store, model, visual_mode=visual_mode)
def __init__(self, store, model, visual_mode=False): self._attr_list = list(model.attributes) self._option_list = {} self._widgets = {} BaseEditorSlave.__init__(self, store, model, visual_mode)
def __init__(self, store, model, db_form=None, visual_mode=False): self.db_form = db_form BaseEditorSlave.__init__(self, store, model, visual_mode)
def __init__(self, store, product, model=None): self._product = product BaseEditorSlave.__init__(self, store, model)