Allow consumable products on inventories
issue4945 review283991002
This commit is contained in:
1 parent
46e3596d95
commit
cd85fe4171
5 files changed
+39
-3
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Allow consumable product on inventories
|
||||
* Let the user select a default warehouse
|
||||
* Add method to get default warehouse
|
||||
* Improve moves synchronisation on shipments
|
||||
|
||||
+1
-3
@@ -246,8 +246,7 @@ class Inventory(Workflow, ModelSQL, ModelView):
|
||||
|
||||
# Update existing lines
|
||||
for line in inventory.lines:
|
||||
if not (line.product.type == 'goods'
|
||||
and not line.product.consumable):
|
||||
if line.product.type != 'goods':
|
||||
Line.delete([line])
|
||||
continue
|
||||
|
||||
@@ -297,7 +296,6 @@ class InventoryLine(ModelSQL, ModelView):
|
||||
product = fields.Many2One('product.product', 'Product', required=True,
|
||||
domain=[
|
||||
('type', '=', 'goods'),
|
||||
('consumable', '=', False),
|
||||
], states=_states, depends=_depends)
|
||||
uom = fields.Function(fields.Many2One('product.uom', 'UOM',
|
||||
help="The unit in which the quantity is specified."), 'get_uom')
|
||||
|
||||
@@ -75,6 +75,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="domain"
|
||||
eval="['OR', ('quantity', '!=', 0.0), ('forecast_quantity', '!=', 0.0)]"
|
||||
pyson="1"/>
|
||||
<field name="search_value"
|
||||
eval="[('consumable', '=', False)]"
|
||||
pyson="1"/>
|
||||
<field name="context_model">stock.products_by_locations.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_product_form_view2">
|
||||
|
||||
@@ -58,6 +58,18 @@ Create products::
|
||||
>>> template2.save()
|
||||
>>> product2, = template2.products
|
||||
|
||||
>>> template = ProductTemplate()
|
||||
>>> template.name = 'Product'
|
||||
>>> template.default_uom = unit
|
||||
>>> template.type = 'goods'
|
||||
>>> template.consumable = True
|
||||
>>> template.list_price = Decimal('300')
|
||||
>>> template.cost_price_method = 'average'
|
||||
>>> consumable, = template.products
|
||||
>>> consumable.cost_price = Decimal('80')
|
||||
>>> template.save()
|
||||
>>> consumable, = template.products
|
||||
|
||||
Fill storage::
|
||||
|
||||
>>> StockMove = Model.get('stock.move')
|
||||
@@ -202,6 +214,27 @@ Empty storage::
|
||||
3.8
|
||||
>>> inventory.click('confirm')
|
||||
|
||||
Add quantity of consumable product::
|
||||
|
||||
>>> inventory = Inventory()
|
||||
>>> inventory.location = storage_loc
|
||||
>>> inventory.empty_quantity = 'keep'
|
||||
>>> line = inventory.lines.new()
|
||||
>>> line.product = consumable
|
||||
>>> line.quantity = 5.0
|
||||
>>> inventory.click('complete_lines')
|
||||
>>> len(inventory.lines)
|
||||
1
|
||||
>>> inventory.click('confirm')
|
||||
>>> line, = inventory.lines
|
||||
>>> move, = line.moves
|
||||
>>> move.quantity
|
||||
5.0
|
||||
>>> move.from_location == inventory.lost_found
|
||||
True
|
||||
>>> move.to_location == inventory.location
|
||||
True
|
||||
|
||||
Create an inventory that should be empty after completion::
|
||||
|
||||
>>> Inventory = Model.get('stock.inventory')
|
||||
|
||||
@@ -8,4 +8,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="forecast_quantity"/>
|
||||
<field name="default_uom"/>
|
||||
<field name="cost_value" sum="Cost Value"/>
|
||||
<field name="consumable" tree_invisible="1"/>
|
||||
</tree>
|
||||
Reference in new issue
Block a user