def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.set_label(_('Price:')) self.cost.set_editable(True) delivery = self._find_delivery() if delivery is not None: self._delivery_item = delivery.service_item self._delivery = CreateDeliveryModel( price=self._delivery_item.price, notes=self._delivery_item.notes, transporter=delivery.transporter, address=delivery.address, estimated_fix_date=self._delivery_item.estimated_fix_date) else: self._delivery = None self._delivery_item = None if isinstance(self.model, Sale): self.delivery_btn = self.slave.add_extra_button( label=_("Add delivery")) self.delivery_btn.set_sensitive(bool(len(self.slave.klist))) else: self.delivery_btn = None self.discount_btn = self.slave.add_extra_button( label=_("Apply discount")) self.discount_btn.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has-rows', self._on_klist__has_rows) self.slave.klist.connect('selection-changed', self._on_klist__selection_changed)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.set_label(_('Price:')) self.cost.set_editable(True) delivery = self._find_delivery() if delivery is not None: self._delivery_item = delivery.service_item self._delivery = CreateDeliveryModel( price=self._delivery_item.price, notes=self._delivery_item.notes, transporter=delivery.transporter, address=delivery.address, estimated_fix_date=self._delivery_item.estimated_fix_date) else: self._delivery = None self._delivery_item = None if isinstance(self.model, Sale): self.delivery_btn = self.slave.add_extra_button(label=_("Add delivery")) self.delivery_btn.set_sensitive(bool(len(self.slave.klist))) else: self.delivery_btn = None self.discount_btn = self.slave.add_extra_button(label=_("Apply discount")) self.discount_btn.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has-rows', self._on_klist__has_rows) self.slave.klist.connect('selection-changed', self._on_klist__selection_changed)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost.set_editable(True) self.quantity.connect('validate', self._on_quantity__validate) self.slave.klist.connect('selection-changed', self._on_klist_selection_changed)
def update_total(self): SellableItemStep.update_total(self) quantities = {} missing = {} lead_time = 0 for i in self.slave.klist: sellable = i.sellable if sellable.service or not sellable.product.manage_stock: continue quantities.setdefault(sellable, 0) quantities[sellable] += i.quantity if quantities[sellable] > i._stock_quantity: _lead_time = sellable.product.get_max_lead_time( quantities[sellable], self.model.branch) max_lead_time = max(lead_time, _lead_time) missing[sellable] = Settable( description=sellable.get_description(), stock=i._stock_quantity, ordered=quantities[sellable], lead_time=_lead_time, ) self.missing = missing if missing: msg = _('Not enough stock. ' 'Estimated time to obtain missing items: %d days.') % max_lead_time self.slave.set_message( '<b>%s</b>' % (api.escape(msg)), self._show_missing_details) else: self.slave.clear_message()
def _update_total(self): SellableItemStep._update_total(self) quantities = {} missing = {} lead_time = 0 for i in self.slave.klist: sellable = i.sellable if sellable.service or not sellable.product.manage_stock: continue quantities.setdefault(sellable, 0) quantities[sellable] += i.quantity if quantities[sellable] > i._stock_quantity: _lead_time = sellable.product.get_max_lead_time( quantities[sellable], self.model.branch) max_lead_time = max(lead_time, _lead_time) missing[sellable] = Settable( description=sellable.get_description(), stock=i._stock_quantity, ordered=quantities[sellable], lead_time=_lead_time, ) self.missing = missing if missing: msg = _('Not enough stock. ' 'Estimated time to obtain missing items: %d days.' ) % max_lead_time self.slave.set_message('<b>%s</b>' % (api.escape(msg)), self._show_missing_details) else: self.slave.clear_message()
def sellable_selected(self, sellable, batch=None): SellableItemStep.sellable_selected(self, sellable, batch=batch) if sellable: price = sellable.get_price_for_category( self.model.client_category) self.cost.set_text("%s" % price) self.proxy.update('cost')
def sellable_selected(self, sellable, batch=None): # We may receive a batch if the user typed a batch number instead of a # product code, but we pass batch=None here since the user must select # the batch when confirming a sale. SellableItemStep.sellable_selected(self, sellable, batch=None) if sellable: price = sellable.get_price_for_category(self.model.client_category) self.cost.update(price)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() if not self.wizard.create_payments: self.cost_label.hide() self.cost.hide() self.quantity.connect('validate', self._on_quantity__validate)
def sellable_selected(self, sellable, batch=None): # We may receive a batch if the user typed a batch number instead of a # product code, but we pass batch=None here since the user must select # the batch when confirming a sale. SellableItemStep.sellable_selected(self, sellable, batch=None) if sellable: price = sellable.get_price_for_category( self.model.client_category) self.cost.update(price)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.set_label(_('Price:')) self.cost.set_editable(True) self.discount_btn = self.slave.add_extra_button(label=_("Apply discount")) self.discount_btn.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has-rows', self._on_klist__has_rows)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.set_label(_('Price:')) self.cost.set_editable(True) self.discount_btn = self.slave.add_extra_button( label=_("Apply discount")) self.discount_btn.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has-rows', self._on_klist__has_rows)
def sellable_selected(self, sellable): SellableItemStep.sellable_selected(self, sellable) if sellable is None: return storable = sellable.product_storable # FIXME: We should not have to override this method. This should # be done automatically on SellableItemStep self.stock_quantity.set_label( "%s" % storable.get_balance_for_branch(branch=self.model.branch))
def sellable_selected(self, sellable, batch=None): SellableItemStep.sellable_selected(self, sellable, batch=batch) if sellable is None or not sellable.product.manage_stock: return storable = sellable.product_storable # FIXME: We should not have to override this method. This should # be done automatically on SellableItemStep self.stock_quantity.set_label( "%s" % storable.get_balance_for_branch(branch=self.model.branch))
def setup_slaves(self): SellableItemStep.setup_slaves(self) self._delivery = None self._delivery_item = None self.delivery_button = self.slave.add_extra_button(label=_("Add Delivery")) self.delivery_button.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has_rows', self._on_klist__has_rows) self.delivery_button.connect('clicked', self._on_delivery_button__clicked)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self._delivery = None self._delivery_item = None self.delivery_button = self.slave.add_extra_button( label=_("Add Delivery")) self.delivery_button.set_sensitive(bool(len(self.slave.klist))) self.slave.klist.connect('has_rows', self._on_klist__has_rows) self.delivery_button.connect('clicked', self._on_delivery_button__clicked)
def sellable_selected(self, sellable): SellableItemStep.sellable_selected(self, sellable) if sellable is None: return storable = sellable.product_storable stock_item = storable.get_stock_item(self.branch) self.stock_quantity.set_label("%s" % stock_item.quantity or 0) quantity = self._get_stock_balance(sellable) has_quantity = quantity > 0 self.quantity.set_sensitive(has_quantity) self.add_sellable_button.set_sensitive(has_quantity) if has_quantity: self.quantity.set_range(1, quantity)
def sellable_selected(self, sellable): SellableItemStep.sellable_selected(self, sellable) if sellable is None: return storable = sellable.product_storable # TODO: Add batch information here. stock_item = storable.get_stock_item(self.branch, batch=None) self.stock_quantity.set_label("%s" % stock_item.quantity or 0) quantity = self._get_stock_balance(sellable) has_quantity = quantity > 0 self.quantity.set_sensitive(has_quantity) self.add_sellable_button.set_sensitive(has_quantity) if has_quantity: self.quantity.set_range(1, quantity)
def add_sellable(self, sellable): price = sellable.get_price_for_category(self.model.client_category) new_price = self.cost.read() # Percentage of discount discount = 100 - new_price * 100 / price if discount > 0 and self.manager: Event.log_sale_item_discount(store=self.store, sale_number=self.model.identifier, user_name=self.manager.username, discount_value=discount, product=sellable.description, original_price=price, new_price=new_price) SellableItemStep.add_sellable(self, sellable)
def add_sellable(self, sellable): price = sellable.get_price_for_category(self.model.client_category) new_price = self.cost.read() # Percentage of discount discount = 100 - new_price * 100 / price if discount > 0 and self.manager: Event.log_sale_item_discount( store=self.store, sale_number=self.model.identifier, user_name=self.manager.username, discount_value=discount, product=sellable.description, original_price=price, new_price=new_price) SellableItemStep.add_sellable(self, sellable)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.set_label('Price:') self.cost.set_editable(True)
def __init__(self, wizard, previous, store, model): manager = get_plugin_manager() nfe_is_active = manager.is_active('nfe') if nfe_is_active: self.cost_editable = True SellableItemStep.__init__(self, wizard, previous, store, model)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost_label.hide() self.cost.hide()
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.item_lbl.set_text(_(u'Services:')) self.hide_add_button() self.cost_label.hide() self.cost.hide()
def sellable_selected(self, sellable, batch=None): SellableItemStep.sellable_selected(self, sellable, batch=batch) if sellable: self.cost.update(sellable.price)
def validate(self, value): SellableItemStep.validate(self, value) can_purchase = self.model.purchase_total > 0 self.wizard.refresh_next(value and can_purchase)
def setup_slaves(self): SellableItemStep.setup_slaves(self)
def setup_slaves(self): SellableItemStep.setup_slaves(self) self.hide_add_button() self.cost.set_editable(True) self.quantity.connect('validate', self._on_quantity__validate)
def sellable_selected(self, sellable): SellableItemStep.sellable_selected(self, sellable) if sellable: self.cost.update(sellable.price)
def post_init(self): self.hide_add_button() SellableItemStep.post_init(self)
def __init__(self, wizard, previous, store, model): self.branch = api.get_current_branch(store) SellableItemStep.__init__(self, wizard, previous, store, model)
def validate(self, value): SellableItemStep.validate(self, value) can_decrease = self.model.get_items().count() self.wizard.refresh_next(value and can_decrease)
def sellable_selected(self, sellable): SellableItemStep.sellable_selected(self, sellable) if sellable: price = sellable.get_price_for_category(self.model.client_category) self.cost.set_text("%s" % price) self.proxy.update('cost')