changeset 57b7fe208133 in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=57b7fe208133
description:
        Rename inventory count field quantity_added to quantity

        issue7873
        review287621002
diffstat:

 CHANGELOG                                |   1 +
 inventory.py                             |  18 +++++++++---------
 tests/scenario_stock_inventory_count.rst |   6 +++---
 view/inventory_count_quantity_form.xml   |   4 ++--
 4 files changed, 15 insertions(+), 14 deletions(-)

diffs (94 lines):

diff -r cbd95ac133f8 -r 57b7fe208133 CHANGELOG
--- a/CHANGELOG Sat Apr 10 23:46:24 2021 +0200
+++ b/CHANGELOG Sun Apr 11 22:25:13 2021 +0100
@@ -1,3 +1,4 @@
+* Rename inventory count quantity_added to quantity
 * Add document source on move of product quantities by warehouse
 * Add relate from assigned shipment to products quantities by warehouse
 * Show quantities by warehouse for many products
diff -r cbd95ac133f8 -r 57b7fe208133 inventory.py
--- a/inventory.py      Sat Apr 10 23:46:24 2021 +0200
+++ b/inventory.py      Sun Apr 11 22:25:13 2021 +0100
@@ -600,7 +600,7 @@
         values['uom'] = line.uom.id
         values['unit_digits'] = line.unit_digits
         if line.uom.rounding == 1:
-            values['quantity_added'] = 1
+            values['quantity'] = 1
         return values
 
     def get_line_domain(self, inventory):
@@ -623,12 +623,12 @@
         return values
 
     def transition_add(self):
-        if self.quantity.line and self.quantity.quantity_added:
+        if self.quantity.line and self.quantity.quantity:
             line = self.quantity.line
             if line.quantity:
-                line.quantity += self.quantity.quantity_added
+                line.quantity += self.quantity.quantity
             else:
-                line.quantity = self.quantity.quantity_added
+                line.quantity = self.quantity.quantity
             line.save()
         return 'search'
 
@@ -682,15 +682,15 @@
         readonly=True, depends=['unit_digits'],
         help="The total amount of the line counted so far.")
 
-    quantity_added = fields.Float(
-        "Added Quantity", digits=(16, Eval('unit_digits', 2)), required=True,
+    quantity = fields.Float(
+        "Quantity", digits=(16, Eval('unit_digits', 2)), required=True,
         depends=['unit_digits'],
         help="The quantity to add to the existing count.")
 
     unit_digits = fields.Integer("Unit Digits", readonly=True)
 
-    @fields.depends('quantity_added', 'line')
-    def on_change_quantity_added(self):
+    @fields.depends('quantity', 'line')
+    def on_change_quantity(self):
         if self.line:
             self.total_quantity = (
-                (self.line.quantity or 0) + (self.quantity_added or 0))
+                (self.line.quantity or 0) + (self.quantity or 0))
diff -r cbd95ac133f8 -r 57b7fe208133 tests/scenario_stock_inventory_count.rst
--- a/tests/scenario_stock_inventory_count.rst  Sat Apr 10 23:46:24 2021 +0200
+++ b/tests/scenario_stock_inventory_count.rst  Sun Apr 11 22:25:13 2021 +0100
@@ -82,7 +82,7 @@
     ...     name='stock.inventory,%s.product.product,%s.count_create' % (
     ...     inventory.id, product.id)).save()
     >>> count.execute('quantity')
-    >>> count.form.quantity_added
+    >>> count.form.quantity
     1
     >>> count.form.total_quantity
     1
@@ -99,9 +99,9 @@
     ...     name='stock.inventory,%s.product.product,%s.count_create' % (
     ...     inventory.id, product2.id)).save()
     >>> count.execute('quantity')
-    >>> count.form.quantity_added
+    >>> count.form.quantity
     >>> count.form.total_quantity
-    >>> count.form.quantity_added = 10
+    >>> count.form.quantity = 10
     >>> count.form.total_quantity
     10.0
     >>> count.execute('add')
diff -r cbd95ac133f8 -r 57b7fe208133 view/inventory_count_quantity_form.xml
--- a/view/inventory_count_quantity_form.xml    Sat Apr 10 23:46:24 2021 +0200
+++ b/view/inventory_count_quantity_form.xml    Sun Apr 11 22:25:13 2021 +0100
@@ -6,7 +6,7 @@
     <field name="product"/>
     <label name="total_quantity"/>
     <field name="total_quantity" symbol="uom"/>
-    <label name="quantity_added"/>
-    <field name="quantity_added" symbol="uom"/>
+    <label name="quantity"/>
+    <field name="quantity" symbol="uom"/>
     <field name="line" colspan="-1" invisible="1"/>
 </form>

Reply via email to