def get_order_item(self, sellable, cost, quantity, batch=None, parent=None): assert batch is None # Associate the product with the supplier if they are not yet. This # happens when the user checked the option to show all products on the # first step supplier_info = self._get_supplier_info() if not supplier_info: supplier_info = ProductSupplierInfo(product=sellable.product, supplier=self.model.supplier, store=self.store) if parent: component = self.get_component(parent, sellable) quantity = quantity * component.quantity else: if sellable.product.is_package: cost = Decimal('0') supplier_info.base_cost = cost item = self.model.add_item(sellable, quantity, parent=parent) self._set_expected_receival_date(item) item.cost = cost return item
def create_model(self): product = self._product supplier = self.target_combo.get_selected_data() if product.is_supplied_by(supplier): product_desc = self._product.sellable.get_description() info(_(u'%s is already supplied by %s') % (product_desc, supplier.person.name)) return model = ProductSupplierInfo(product=product, supplier=supplier, store=self.store) model.base_cost = product.sellable.cost return model
def get_order_item(self, sellable, cost, quantity): # Associate the product with the supplier if they are not yet. This # happens when the user checked the option to show all products on the # first step supplier_info = self._get_supplier_info() if not supplier_info: supplier_info = ProductSupplierInfo(product=sellable.product, supplier=self.model.supplier, store=self.store) supplier_info.base_cost = cost item = self.model.add_item(sellable, quantity) self._set_expected_receival_date(item) item.cost = cost return item
def maybe_create_product_supplier_info(self, nfe_item, supplier): from stoqlib.domain.product import ProductSupplierInfo product = nfe_item.sellable.product info = product.get_product_supplier_info(supplier, self.branch) if not info: info = ProductSupplierInfo(store=self.store, product=nfe_item.sellable.product, supplier_code=nfe_item.supplier_code, supplier=supplier, branch=self.branch) info.base_cost = Decimal(nfe_item.cost) extra_cost = nfe_item.ipi_cost + nfe_item.icmsst_cost nfe_item.sellable.cost = info.base_cost + extra_cost
def get_order_item(self, sellable, cost, quantity, batch=None, parent=None): assert batch is None # Associate the product with the supplier if they are not yet. This # happens when the user checked the option to show all products on the # first step supplier_info = self._get_supplier_info() if not supplier_info: supplier_info = ProductSupplierInfo(product=sellable.product, supplier=self.model.supplier, store=self.store) if parent: component_quantity = self.get_component_quantity(parent, sellable) quantity = quantity * component_quantity cost = Decimal('0') else: supplier_info.base_cost = cost item = self.model.add_item(sellable, quantity, parent=parent) self._set_expected_receival_date(item) item.cost = cost return item