Ejemplo n.º 1
0
 def check_for_waiting(self):
     if not self.warehouse:
         for line in self.lines:
             if line.product and line.product.type in {'goods', 'assets'}:
                 raise RequiredValidationError(
                     gettext('purchase_requisition.msg_warehouse_required',
                         requisition=self.rec_name))
Ejemplo n.º 2
0
 def check_lot(self):
     "Check if lot is required"
     if (self.state == 'done' and self.internal_quantity
             and not self.lot and self.product.lot_is_required(
                 self.from_location, self.to_location)):
         raise RequiredValidationError(
             gettext('stock_lot.msg_lot_required',
                     product=self.product.rec_name))
Ejemplo n.º 3
0
 def check_for_quotation(self):
     super(Purchase, self).check_for_quotation()
     if self.customer and not self.delivery_address:
         raise RequiredValidationError(
             gettext('sale_supply_drop_shipment'
                     '.msg_delivery_address_required_quotation_purchase') %
             {
                 'purchase': self.rec_name,
             })
Ejemplo n.º 4
0
 def default_quantity(self, fields):
     pool = Pool()
     Product = pool.get('product.product')
     inventory = self.record
     if isinstance(self.search.search, Product):
         product = self.search.search
         if product.lot_is_required(inventory.location,
                                    inventory.location.lost_found_used):
             raise RequiredValidationError(
                 gettext('stock_lot.msg_only_lot',
                         product=product.rec_name))
     return super(InventoryCount, self).default_quantity(fields)
Ejemplo n.º 5
0
 def default_quantity(self, fields):
     pool = Pool()
     Product = pool.get('product.product')
     Inventory = pool.get('stock.inventory')
     context = Transaction().context
     inventory = Inventory(context['active_id'])
     if isinstance(self.search.search, Product):
         product = self.search.search
         if product.lot_is_required(inventory.location,
                                    inventory.lost_found):
             raise RequiredValidationError(
                 gettext('stock_lot.msg_only_lot',
                         product=product.rec_name))
     return super(InventoryCount, self).default_quantity(fields)