Ejemplo n.º 1
0
    def _submit(self):
        stock = Stock()

        brand = self.brand_comboBox
        stock.brand_name(brand.currentText()).brand_id(brand.currentData())

        model = self.model_combo_box
        stock.model_name(model.currentText()).model_id(model.currentData())

        first_service = self.first_service_combo_box
        stock.first_service_id(first_service.currentData()).first_service_name(
            first_service.currentText())

        second_service = self.second_service_combo_box
        stock.second_service_name(
            second_service.currentText()).second_service_id(
                second_service.currentData())

        name = brand.currentText() + '-' + model.currentText()
        stock.name(name)
        stock.unit(self.unit.text())
        stock.create_op(common.config.login_user_info[0])
        stock.create_time(get_now())

        stock_id = stock_handler.add_stock_info(stock)

        stock.id(stock_id)
Ejemplo n.º 2
0
def add_stock_info(model, brand, model_id, brand_id, unit, second_service_id):
    second_service = service_handler.get_service_by_id(second_service_id)

    stock_info = Stock()

    stock_info.model_id(model_id).model_name(model)
    stock_info.brand_id(brand_id).brand_name(brand)
    stock_info.first_service_id(second_service['father_id']).first_service_name(second_service['father_name'])
    stock_info.second_service_id(second_service_id).second_service_name(second_service['name'])
    stock_info.unit(unit)
    stock_info.name(brand + '-' + model)
    stock_info.create_op(config.login_user_info[0]).create_time(time_utils.get_now())

    stock_id = stock_handler.add_stock_info(stock_info)
    stock_info.id(stock_id)
    return stock_info