[IMP] stock: stockable term rename

"Stockable" term is not a proper english word. We change it
to"Storable"This commit is related to task ID 38933

PR:22085
TASK:38933
This commit is contained in:
William Henrotin
2018-07-26 15:21:32 +02:00
committed by Simon Lejeune
parent 5c1f2126f7
commit c0794649f3
16 changed files with 26 additions and 27 deletions
+1 -1
View File
@@ -19,5 +19,5 @@ class ProductTemplate(models.Model):
@api.onchange('type')
def _onchange_type_for_expense(self):
if self.type not in ['consu', 'service']: # stockable can not be expensed.
if self.type not in ['consu', 'service']: # storable can not be expensed.
self.can_be_expensed = False
+1 -1
View File
@@ -49,7 +49,7 @@ class ProductTemplate(models.Model):
type = fields.Selection([
('consu', _('Consumable')),
('service', _('Service'))], string='Product Type', default='consu', required=True,
help='A stockable product is a product for which you manage stock. The "Inventory" app has to be installed.\n'
help='A storable product is a product for which you manage stock. The "Inventory" app has to be installed.\n'
'A consumable product, on the other hand, is a product for which stock is not managed.\n'
'A service is a non-material product you provide.\n'
'A digital content is a non-material product you sell online. The files attached to the products are the one that are sold on '
+1 -1
View File
@@ -351,7 +351,7 @@ class TestSaleMrpFlow(common.TransactionCase):
# confirm our standard so, check the picking
so.action_confirm()
self.assertTrue(so.picking_ids, 'Sale MRP: no picking created for "invoice on delivery" stockable products')
self.assertTrue(so.picking_ids, 'Sale MRP: no picking created for "invoice on delivery" storable products')
# invoice in on delivery, nothing should be invoiced
with self.assertRaises(UserError):
+1 -1
View File
@@ -9,7 +9,7 @@ class ProductTemplate(models.Model):
@api.onchange('type')
def _onchange_type(self):
""" We want to prevent stockable product to be expensed, since it make no sense as when confirm
""" We want to prevent storable product to be expensed, since it make no sense as when confirm
expenses, the product is already out of our stock.
"""
super(ProductTemplate, self)._onchange_type()
+1 -1
View File
@@ -148,7 +148,7 @@ class SaleOrderLine(models.Model):
def _compute_qty_delivered_method(self):
""" Stock module compute delivered qty for product [('type', 'in', ['consu', 'product'])]
For SO line coming from expense, no picking should be generate: we don't manage stock for
thoses lines, even if the product is a stockable.
thoses lines, even if the product is a storable.
"""
super(SaleOrderLine, self)._compute_qty_delivered_method()
+8 -9
View File
@@ -25,7 +25,7 @@ class TestSaleStock(TestSale):
# confirm our standard so, check the picking
self.so.action_confirm()
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" stockable products')
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" storable products')
# invoice on order
self.so.action_invoice_create()
@@ -40,7 +40,7 @@ class TestSaleStock(TestSale):
del_qties = [sol.qty_delivered for sol in self.so.order_line]
del_qties_truth = [1.0 if sol.product_id.type in ['product', 'consu'] else 0.0 for sol in self.so.order_line]
self.assertEqual(del_qties, del_qties_truth, 'Sale Stock: delivered quantities are wrong after partial delivery')
# invoice on delivery: only stockable products
# invoice on delivery: only storable products
inv_id = self.so.action_invoice_create()
inv_1 = inv_obj.browse(inv_id)
self.assertTrue(all([il.product_id.invoice_policy == 'delivery' for il in inv_1.invoice_line_ids]),
@@ -85,7 +85,7 @@ class TestSaleStock(TestSale):
self.so.action_confirm()
self.so.order_line._compute_product_updatable()
self.assertFalse(self.so.order_line[0].product_updatable)
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on order" stockable products')
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on order" storable products')
# let's do an invoice for a deposit of 5%
adv_wiz = self.env['sale.advance.payment.inv'].with_context(active_ids=[self.so.id]).create({
'advance_payment_method': 'percentage',
@@ -135,7 +135,7 @@ class TestSaleStock(TestSale):
# confirm our standard so, check the picking
self.so.action_confirm()
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" stockable products')
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" storable products')
# invoice in on delivery, nothing should be invoiced
self.assertEqual(self.so.invoice_status, 'no', 'Sale Stock: so invoice_status should be "no" instead of "%s".' % self.so.invoice_status)
@@ -207,7 +207,7 @@ class TestSaleStock(TestSale):
# confirm our standard so, check the picking
self.so.action_confirm()
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" stockable products')
self.assertTrue(self.so.picking_ids, 'Sale Stock: no picking created for "invoice on delivery" storable products')
# invoice in on delivery, nothing should be invoiced
self.assertEqual(self.so.invoice_status, 'no', 'Sale Stock: so invoice_status should be "nothing to invoice"')
@@ -242,7 +242,7 @@ class TestSaleStock(TestSale):
# sell two products
item1 = self.products['prod_order'] # consumable
item1.type = 'consu'
item2 = self.products['prod_del'] # stockable
item2 = self.products['prod_del'] # storable
self.so = self.env['sale.order'].create({
'partner_id': self.partner.id,
@@ -255,7 +255,7 @@ class TestSaleStock(TestSale):
# deliver them
# One of the move is for a consumable product, thus is assigned. The second one is for a
# stockable product, thus is unavailable. Hitting `button_validate` will first ask to
# storable product, thus is unavailable. Hitting `button_validate` will first ask to
# process all the reserved quantities and, if the user chose to process, a second wizard
# will ask to create a backorder for the unavailable product.
self.assertEquals(len(self.so.picking_ids), 1)
@@ -301,7 +301,7 @@ class TestSaleStock(TestSale):
"""
# sell two products
item1 = self.products['prod_order'] # consumable
item2 = self.products['prod_del'] # stockable
item2 = self.products['prod_del'] # storable
self.env['stock.quant']._update_available_quantity(item2, self.env.ref('stock.stock_location_stock'), 2)
self.so = self.env['sale.order'].create({
@@ -416,4 +416,3 @@ class TestSaleStock(TestSale):
# check the delivered quantity
self.assertEqual(so1.order_line.qty_delivered, 3.0)
@@ -24,7 +24,7 @@ class ProjectCreateInvoice(models.TransientModel):
project_id = fields.Many2one('project.project', "Project", help="Project to make billable", required=True)
sale_order_id = fields.Many2one('sale.order', string="Choose the Sales Order to invoice", required=True)
amount_to_invoice = fields.Monetary("Amount to invoice", compute='_compute_amount_to_invoice', currency_field='currency_id', help="Total amount to invoice on the sales order, including all items (services, stockables, expenses, ...)")
amount_to_invoice = fields.Monetary("Amount to invoice", compute='_compute_amount_to_invoice', currency_field='currency_id', help="Total amount to invoice on the sales order, including all items (services, storables, expenses, ...)")
currency_id = fields.Many2one(related='sale_order_id.currency_id', readonly=True)
@api.onchange('project_id')
+1 -1
View File
@@ -383,7 +383,7 @@ class ProductTemplate(models.Model):
responsible_id = fields.Many2one(
'res.users', string='Responsible', default=lambda self: self.env.uid, required=True,
help="This user will be responsible of the next activities related to logistic operations for this product.")
type = fields.Selection(selection_add=[('product', 'Stockable Product')])
type = fields.Selection(selection_add=[('product', 'Storable Product')])
property_stock_production = fields.Many2one(
'stock.location', "Production Location",
company_dependent=True, domain=[('usage', 'like', 'production')],
+1 -1
View File
@@ -417,7 +417,7 @@ class InventoryLine(models.Model):
"""
for line in self:
if line.product_id.type != 'product':
raise UserError(_("You can only adjust stockable products."))
raise UserError(_("You can only adjust storable products."))
def _get_quants(self):
return self.env['stock.quant'].search([
+1 -1
View File
@@ -3359,7 +3359,7 @@ class StockMove(TransactionCase):
def test_scrap_1(self):
""" Check the created stock move and the impact on quants when we scrap a
stockable product.
storable product.
"""
self.env['stock.quant']._update_available_quantity(self.product1, self.stock_location, 1)
scrap = self.env['stock.scrap'].create({
+1 -1
View File
@@ -8,7 +8,7 @@ class TestPackingNeg(TransactionCase):
def test_packing_neg(self):
# Create a new "negative" stockable product
# Create a new "negative" storable product
product_neg = self.env['product.product'].create({
'name': 'Negative product',
'type': 'product',
+1 -1
View File
@@ -12,7 +12,7 @@ class TestVirtualAvailable(TestStockCommon):
def setUp(self):
super(TestVirtualAvailable, self).setUp()
# Make `product3` a stockable product for this test. Indeed, creating quants
# Make `product3` a storable product for this test. Indeed, creating quants
# and playing with owners is not possible for consumables.
self.product_3.type = 'product'
+1 -1
View File
@@ -8,7 +8,7 @@ class TestWiseOperator(TransactionCase):
def test_wise_operator(self):
# Create a new stockable product
# Create a new storable product
product_wise = self.env['product.product'].create({
'name': 'Wise Unit',
'type': 'product',
@@ -36,22 +36,22 @@ class WebsiteSaleDelivery(WebsiteSale):
def _get_shop_payment_values(self, order, **kwargs):
values = super(WebsiteSaleDelivery, self)._get_shop_payment_values(order, **kwargs)
has_stockable_products = any(line.product_id.type in ['consu', 'product'] for line in order.order_line)
has_storable_products = any(line.product_id.type in ['consu', 'product'] for line in order.order_line)
if not order._get_delivery_methods() and has_stockable_products:
if not order._get_delivery_methods() and has_storable_products:
values['errors'].append(
(_('Sorry, we are unable to ship your order'),
_('No shipping method is available for your current order and shipping address. '
'Please contact us for more information.')))
if has_stockable_products:
if has_storable_products:
if order.carrier_id and not order.delivery_rating_success:
order._remove_delivery_line()
delivery_carriers = order._get_delivery_methods()
values['deliveries'] = delivery_carriers.sudo()
values['delivery_has_stockable'] = has_stockable_products
values['delivery_has_storable'] = has_storable_products
values['delivery_action_id'] = request.env.ref('delivery.action_delivery_carrier_form').id
return values
@@ -65,7 +65,7 @@
</xpath>
<!-- we shouldn't be able to pay if there is no way to deliver -->
<xpath expr="//div[@id='payment_method']" position="attributes">
<attribute name="t-att-style">'display: none!important' if not deliveries and delivery_has_stockable else ''</attribute>
<attribute name="t-att-style">'display: none!important' if not deliveries and delivery_has_storable else ''</attribute>
</xpath>
</template>
@@ -12,7 +12,7 @@
<xpath expr="//div[@name='stock_inventory_availability']" position="inside">
<div class="content-group">
<div class="row mt16" title="Default availability mode set on newly created stockable products. This can be changed at the product level.">
<div class="row mt16" title="Default availability mode set on newly created storable products. This can be changed at the product level.">
<label for="inventory_availability" string="Default Availability Mode" class="col-md-3 o_light_label" />
<field name="inventory_availability" string="Inventory"/>
</div><br/>