We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[12.0] stock_secondary_unit "secondary qty" value in picking not affecting "initial demand"
AFFECTED VERSIONS

12.0 (it works ok on 13.0)

STEPS TO REPRODUCE

Activate Units of Measure in general settings > inventory

Inventory > Master Data > Products > Set a secondary unit in a product

![image](https://user-images.githubusercontent.com/55489873/123983258-04aa0200-d9c4-11eb-90a1-e32686f07ac4.png)

Create a new transfer > add product > select secondary UoM > input secondary qty

![image](https://user-images.githubusercontent.com/55489873/123983462-2e632900-d9c4-11eb-9b3c-c813bd2be121.png)

CURRENT BEHAVIOR

Value "Initial demand" is not affected by secondary qty input
In the same way, if "Initial demand" is set, "secondary qty" does not change - basically there is no relation between the two fields

![image](https://user-images.githubusercontent.com/55489873/123983876-7f731d00-d9c4-11eb-9686-bf8d54618d2b.png)

REQUIRED BEHAVIOR 

When "secondary qty" is updated, also "initial demand" should update - and viceversa, as it happens in SO with secondary unit modules

VIDEO

https://recordit.co/zcuDUx6xco







--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `stock_secondary_unit/models/stock_move.py`
Content:
```
1 # Copyright 2018 Tecnativa - Sergio Teruel
2 # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3 from odoo import api, fields, models
4 from odoo.addons import decimal_precision as dp
5 from odoo.tools.float_utils import float_compare, float_round
6 
7 
8 class StockSecondaryUnitMixin(models.AbstractModel):
9     _name = 'stock.secondary.unit.mixin'
10     _description = 'Stock Secondary Unit Mixin'
11 
12     secondary_uom_id = fields.Many2one(
13         comodel_name='product.secondary.unit',
14         string='Second unit',
15     )
16     secondary_uom_qty = fields.Float(
17         string='Secondary Qty',
18         digits=dp.get_precision('Product Unit of Measure'),
19     )
20 
21 
22 class StockMove(models.Model):
23     _inherit = ['stock.move', 'stock.secondary.unit.mixin']
24     _name = 'stock.move'
25 
26     def _merge_moves_fields(self):
27         res = super(StockMove, self)._merge_moves_fields()
28         res['secondary_uom_qty'] = self[-1:].secondary_uom_qty
29         return res
30 
31     @api.onchange('secondary_uom_id', 'secondary_uom_qty')
32     def onchange_secondary_uom(self):
33         if not self.secondary_uom_id:
34             return
35         factor = self.secondary_uom_id.factor * self.product_uom.factor
36 
37         qty = float_round(
38             self.secondary_uom_qty * factor,
39             precision_rounding=self.product_uom.rounding
40         )
41         if float_compare(
42             self.product_uom_qty, qty, precision_rounding=self.product_uom.rounding
43         ) != 0:
44             self.product_uom_qty = qty
45 
46     @api.onchange('product_uom_qty')
47     def onchange_secondary_unit_product_uom_qty(self):
48         if not self.secondary_uom_id:
49             return
50         factor = self.secondary_uom_id.factor * self.product_uom.factor
51 
52         qty = float_round(
53             self.product_uom_qty / (factor or 1.0),
54             precision_rounding=self.secondary_uom_id.uom_id.rounding
55         )
56         if float_compare(
57             self.secondary_uom_qty,
58             qty,
59             precision_rounding=self.secondary_uom_id.uom_id.rounding
60         ) != 0:
61             self.secondary_uom_qty = qty
62 
63     @api.onchange('product_uom')
64     def onchange_product_uom_for_secondary(self):
65         if not self.secondary_uom_id:
66             return
67         factor = self.product_uom.factor * self.secondary_uom_id.factor
68         qty = float_round(
69             self.product_uom_qty / (factor or 1.0),
70             precision_rounding=self.product_uom.rounding
71         )
72         if float_compare(
73             self.secondary_uom_qty, qty, precision_rounding=self.product_uom.rounding
74         ) != 0:
75             self.secondary_uom_qty = qty
76 
77 
78 class StockMoveLine(models.Model):
79     _inherit = ['stock.move.line', 'stock.secondary.unit.mixin']
80     _name = 'stock.move.line'
81 
82     @api.model
83     def create(self, vals):
84         move = self.env['stock.move'].browse(vals.get('move_id', False))
85         if move.secondary_uom_id:
86             uom = self.env['uom.uom'].browse(vals['product_uom_id'])
87             factor = move.secondary_uom_id.factor * uom.factor
88             move_line_qty = vals.get(
89                 'product_uom_qty', vals.get('qty_done', 0.0))
90             qty = float_round(
91                 move_line_qty / (factor or 1.0),
92                 precision_rounding=move.secondary_uom_id.uom_id.rounding
93             )
94             vals.update({
95                 'secondary_uom_qty': qty,
96                 'secondary_uom_id': move.secondary_uom_id.id,
97             })
98         return super().create(vals)
99
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/stock_secondary_unit/models/stock_move.py b/stock_secondary_unit/models/stock_move.py
--- a/stock_secondary_unit/models/stock_move.py
+++ b/stock_secondary_unit/models/stock_move.py
@@ -96,3 +96,21 @@
                 'secondary_uom_id': move.secondary_uom_id.id,
             })
         return super().create(vals)
+
+    @api.multi
+    def write(self, vals):
+        for rec in self:
+            move = rec.move_id
+            if move.secondary_uom_id:
+                uom = rec.product_id.uom_id
+                factor = move.secondary_uom_id.factor * uom.factor
+                move_line_qty = vals.get('product_uom_qty', rec.product_uom_qty)
+                qty = float_round(
+                    move_line_qty / (factor or 1.0),
+                    precision_rounding=move.secondary_uom_id.uom_id.rounding
+                )
+                vals.update({
+                    'secondary_uom_qty': qty,
+                    'secondary_uom_id': move.secondary_uom_id.id,
+                })
+        return super().write(vals)

{"golden_diff": "diff --git a/stock_secondary_unit/models/stock_move.py b/stock_secondary_unit/models/stock_move.py\n--- a/stock_secondary_unit/models/stock_move.py\n+++ b/stock_secondary_unit/models/stock_move.py\n@@ -96,3 +96,21 @@\n                 'secondary_uom_id': move.secondary_uom_id.id,\n             })\n         return super().create(vals)\n+\n+    @api.multi\n+    def write(self, vals):\n+        for rec in self:\n+            move = rec.move_id\n+            if move.secondary_uom_id:\n+                uom = rec.product_id.uom_id\n+                factor = move.secondary_uom_id.factor * uom.factor\n+                move_line_qty = vals.get('product_uom_qty', rec.product_uom_qty)\n+                qty = float_round(\n+                    move_line_qty / (factor or 1.0),\n+                    precision_rounding=move.secondary_uom_id.uom_id.rounding\n+                )\n+                vals.update({\n+                    'secondary_uom_qty': qty,\n+                    'secondary_uom_id': move.secondary_uom_id.id,\n+                })\n+        return super().write(vals)\n", "issue": "[12.0] stock_secondary_unit \"secondary qty\" value in picking not affecting \"initial demand\"\nAFFECTED VERSIONS\r\n\r\n12.0 (it works ok on 13.0)\r\n\r\nSTEPS TO REPRODUCE\r\n\r\nActivate Units of Measure in general settings > inventory\r\n\r\nInventory > Master Data > Products > Set a secondary unit in a product\r\n\r\n![image](https://user-images.githubusercontent.com/55489873/123983258-04aa0200-d9c4-11eb-90a1-e32686f07ac4.png)\r\n\r\nCreate a new transfer > add product > select secondary UoM > input secondary qty\r\n\r\n![image](https://user-images.githubusercontent.com/55489873/123983462-2e632900-d9c4-11eb-9b3c-c813bd2be121.png)\r\n\r\nCURRENT BEHAVIOR\r\n\r\nValue \"Initial demand\" is not affected by secondary qty input\r\nIn the same way, if \"Initial demand\" is set, \"secondary qty\" does not change - basically there is no relation between the two fields\r\n\r\n![image](https://user-images.githubusercontent.com/55489873/123983876-7f731d00-d9c4-11eb-9686-bf8d54618d2b.png)\r\n\r\nREQUIRED BEHAVIOR \r\n\r\nWhen \"secondary qty\" is updated, also \"initial demand\" should update - and viceversa, as it happens in SO with secondary unit modules\r\n\r\nVIDEO\r\n\r\nhttps://recordit.co/zcuDUx6xco\r\n\r\n\r\n\r\n\r\n\r\n\n", "before_files": [{"content": "# Copyright 2018 Tecnativa - Sergio Teruel\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).\nfrom odoo import api, fields, models\nfrom odoo.addons import decimal_precision as dp\nfrom odoo.tools.float_utils import float_compare, float_round\n\n\nclass StockSecondaryUnitMixin(models.AbstractModel):\n    _name = 'stock.secondary.unit.mixin'\n    _description = 'Stock Secondary Unit Mixin'\n\n    secondary_uom_id = fields.Many2one(\n        comodel_name='product.secondary.unit',\n        string='Second unit',\n    )\n    secondary_uom_qty = fields.Float(\n        string='Secondary Qty',\n        digits=dp.get_precision('Product Unit of Measure'),\n    )\n\n\nclass StockMove(models.Model):\n    _inherit = ['stock.move', 'stock.secondary.unit.mixin']\n    _name = 'stock.move'\n\n    def _merge_moves_fields(self):\n        res = super(StockMove, self)._merge_moves_fields()\n        res['secondary_uom_qty'] = self[-1:].secondary_uom_qty\n        return res\n\n    @api.onchange('secondary_uom_id', 'secondary_uom_qty')\n    def onchange_secondary_uom(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.secondary_uom_id.factor * self.product_uom.factor\n\n        qty = float_round(\n            self.secondary_uom_qty * factor,\n            precision_rounding=self.product_uom.rounding\n        )\n        if float_compare(\n            self.product_uom_qty, qty, precision_rounding=self.product_uom.rounding\n        ) != 0:\n            self.product_uom_qty = qty\n\n    @api.onchange('product_uom_qty')\n    def onchange_secondary_unit_product_uom_qty(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.secondary_uom_id.factor * self.product_uom.factor\n\n        qty = float_round(\n            self.product_uom_qty / (factor or 1.0),\n            precision_rounding=self.secondary_uom_id.uom_id.rounding\n        )\n        if float_compare(\n            self.secondary_uom_qty,\n            qty,\n            precision_rounding=self.secondary_uom_id.uom_id.rounding\n        ) != 0:\n            self.secondary_uom_qty = qty\n\n    @api.onchange('product_uom')\n    def onchange_product_uom_for_secondary(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.product_uom.factor * self.secondary_uom_id.factor\n        qty = float_round(\n            self.product_uom_qty / (factor or 1.0),\n            precision_rounding=self.product_uom.rounding\n        )\n        if float_compare(\n            self.secondary_uom_qty, qty, precision_rounding=self.product_uom.rounding\n        ) != 0:\n            self.secondary_uom_qty = qty\n\n\nclass StockMoveLine(models.Model):\n    _inherit = ['stock.move.line', 'stock.secondary.unit.mixin']\n    _name = 'stock.move.line'\n\n    @api.model\n    def create(self, vals):\n        move = self.env['stock.move'].browse(vals.get('move_id', False))\n        if move.secondary_uom_id:\n            uom = self.env['uom.uom'].browse(vals['product_uom_id'])\n            factor = move.secondary_uom_id.factor * uom.factor\n            move_line_qty = vals.get(\n                'product_uom_qty', vals.get('qty_done', 0.0))\n            qty = float_round(\n                move_line_qty / (factor or 1.0),\n                precision_rounding=move.secondary_uom_id.uom_id.rounding\n            )\n            vals.update({\n                'secondary_uom_qty': qty,\n                'secondary_uom_id': move.secondary_uom_id.id,\n            })\n        return super().create(vals)\n", "path": "stock_secondary_unit/models/stock_move.py"}], "after_files": [{"content": "# Copyright 2018 Tecnativa - Sergio Teruel\n# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).\nfrom odoo import api, fields, models\nfrom odoo.addons import decimal_precision as dp\nfrom odoo.tools.float_utils import float_compare, float_round\n\n\nclass StockSecondaryUnitMixin(models.AbstractModel):\n    _name = 'stock.secondary.unit.mixin'\n    _description = 'Stock Secondary Unit Mixin'\n\n    secondary_uom_id = fields.Many2one(\n        comodel_name='product.secondary.unit',\n        string='Second unit',\n    )\n    secondary_uom_qty = fields.Float(\n        string='Secondary Qty',\n        digits=dp.get_precision('Product Unit of Measure'),\n    )\n\n\nclass StockMove(models.Model):\n    _inherit = ['stock.move', 'stock.secondary.unit.mixin']\n    _name = 'stock.move'\n\n    def _merge_moves_fields(self):\n        res = super(StockMove, self)._merge_moves_fields()\n        res['secondary_uom_qty'] = self[-1:].secondary_uom_qty\n        return res\n\n    @api.onchange('secondary_uom_id', 'secondary_uom_qty')\n    def onchange_secondary_uom(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.secondary_uom_id.factor * self.product_uom.factor\n\n        qty = float_round(\n            self.secondary_uom_qty * factor,\n            precision_rounding=self.product_uom.rounding\n        )\n        if float_compare(\n            self.product_uom_qty, qty, precision_rounding=self.product_uom.rounding\n        ) != 0:\n            self.product_uom_qty = qty\n\n    @api.onchange('product_uom_qty')\n    def onchange_secondary_unit_product_uom_qty(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.secondary_uom_id.factor * self.product_uom.factor\n\n        qty = float_round(\n            self.product_uom_qty / (factor or 1.0),\n            precision_rounding=self.secondary_uom_id.uom_id.rounding\n        )\n        if float_compare(\n            self.secondary_uom_qty,\n            qty,\n            precision_rounding=self.secondary_uom_id.uom_id.rounding\n        ) != 0:\n            self.secondary_uom_qty = qty\n\n    @api.onchange('product_uom')\n    def onchange_product_uom_for_secondary(self):\n        if not self.secondary_uom_id:\n            return\n        factor = self.product_uom.factor * self.secondary_uom_id.factor\n        qty = float_round(\n            self.product_uom_qty / (factor or 1.0),\n            precision_rounding=self.product_uom.rounding\n        )\n        if float_compare(\n            self.secondary_uom_qty, qty, precision_rounding=self.product_uom.rounding\n        ) != 0:\n            self.secondary_uom_qty = qty\n\n\nclass StockMoveLine(models.Model):\n    _inherit = ['stock.move.line', 'stock.secondary.unit.mixin']\n    _name = 'stock.move.line'\n\n    @api.model\n    def create(self, vals):\n        move = self.env['stock.move'].browse(vals.get('move_id', False))\n        if move.secondary_uom_id:\n            uom = self.env['uom.uom'].browse(vals['product_uom_id'])\n            factor = move.secondary_uom_id.factor * uom.factor\n            move_line_qty = vals.get(\n                'product_uom_qty', vals.get('qty_done', 0.0))\n            qty = float_round(\n                move_line_qty / (factor or 1.0),\n                precision_rounding=move.secondary_uom_id.uom_id.rounding\n            )\n            vals.update({\n                'secondary_uom_qty': qty,\n                'secondary_uom_id': move.secondary_uom_id.id,\n            })\n        return super().create(vals)\n\n    @api.multi\n    def write(self, vals):\n        for rec in self:\n            move = rec.move_id\n            if move.secondary_uom_id:\n                uom = rec.product_id.uom_id\n                factor = move.secondary_uom_id.factor * uom.factor\n                move_line_qty = vals.get('product_uom_qty', rec.product_uom_qty)\n                qty = float_round(\n                    move_line_qty / (factor or 1.0),\n                    precision_rounding=move.secondary_uom_id.uom_id.rounding\n                )\n                vals.update({\n                    'secondary_uom_qty': qty,\n                    'secondary_uom_id': move.secondary_uom_id.id,\n                })\n        return super().write(vals)\n", "path": "stock_secondary_unit/models/stock_move.py"}]}