[IMP] stock_quant_package_move_wizard: more accurate source location on picking when all quants have the same location
This commit is contained in:
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-02-13 21:59+0000\n"
|
||||
"PO-Revision-Date: 2023-02-13 21:59+0000\n"
|
||||
"POT-Creation-Date: 2025-06-23 09:19+0000\n"
|
||||
"PO-Revision-Date: 2025-06-23 09:19+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -109,6 +109,11 @@ msgstr "Lot/numéro de série"
|
||||
msgid "Move"
|
||||
msgstr "Déplacer"
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_package_move_wizard.stock_quant_move_wizard_form
|
||||
msgid "Move and Show Picking"
|
||||
msgstr "Déplacer et afficher le bon de transfert"
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.actions.act_window,name:stock_quant_package_move_wizard.stock_quant_move_wizard_action
|
||||
msgid "Move to Another Location"
|
||||
@@ -137,7 +142,7 @@ msgstr "Qté à déplacer"
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.model.fields,field_description:stock_quant_package_move_wizard.field_stock_quant_move_wizard_line__quant_id
|
||||
msgid "Quant"
|
||||
msgstr "Quant"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.model.fields,field_description:stock_quant_package_move_wizard.field_stock_quant_move_wizard_line__wizard_id
|
||||
@@ -154,7 +159,7 @@ msgstr ""
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.model,name:stock_quant_package_move_wizard.model_stock_quant
|
||||
msgid "Quants"
|
||||
msgstr "Quants"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.model.fields,field_description:stock_quant_package_move_wizard.field_stock_quant_move_wizard__origin
|
||||
@@ -196,7 +201,8 @@ msgid ""
|
||||
"%(product_name)s to %(dest_location)s, but it is already on that location!"
|
||||
msgstr ""
|
||||
"Vous essayez de déplacer %(qty)s %(uom)s d'un quant de l'article "
|
||||
"%(product_name)s vers %(dest_location)s, mais il est déjà sur cet emplacement !"
|
||||
"%(product_name)s vers %(dest_location)s, mais il est déjà sur cet "
|
||||
"emplacement !"
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#. odoo-python
|
||||
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-02-13 21:58+0000\n"
|
||||
"PO-Revision-Date: 2023-02-13 21:58+0000\n"
|
||||
"POT-Creation-Date: 2025-06-23 09:19+0000\n"
|
||||
"PO-Revision-Date: 2025-06-23 09:19+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -109,6 +109,11 @@ msgstr ""
|
||||
msgid "Move"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model_terms:ir.ui.view,arch_db:stock_quant_package_move_wizard.stock_quant_move_wizard_form
|
||||
msgid "Move and Show Picking"
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_quant_package_move_wizard
|
||||
#: model:ir.actions.act_window,name:stock_quant_package_move_wizard.stock_quant_move_wizard_action
|
||||
msgid "Move to Another Location"
|
||||
|
||||
@@ -100,6 +100,11 @@ class StockQuant(models.Model):
|
||||
"location_dest_id": dest_location.id,
|
||||
"origin": origin,
|
||||
}
|
||||
source_loc_ids = set()
|
||||
for quant in self:
|
||||
source_loc_ids.add(quant.location_id.id)
|
||||
if len(source_loc_ids) == 1:
|
||||
vals['location_id'] = list(source_loc_ids)[0]
|
||||
return vals
|
||||
|
||||
def move_full_quant_to(self, dest_location, picking_type=False, origin=False):
|
||||
|
||||
@@ -60,22 +60,9 @@ class StockQuantMoveWizard(models.TransientModel):
|
||||
|
||||
def run(self):
|
||||
self.ensure_one()
|
||||
picking_id = False
|
||||
if self.picking_type_id:
|
||||
picking_vals = self.env["stock.quant"]._prepare_move_to_stock_picking(
|
||||
self.location_dest_id, self.picking_type_id, origin=self.origin
|
||||
)
|
||||
picking_id = self.env["stock.picking"].create(picking_vals).id
|
||||
smo = self.env["stock.move"]
|
||||
for line in self.line_ids:
|
||||
quant = line.quant_id
|
||||
assert not quant.package_id
|
||||
vals = quant._prepare_move_to_stock_move(
|
||||
line.quantity, self.location_dest_id, picking_id, origin=self.origin
|
||||
)
|
||||
new_move = smo.create(vals)
|
||||
new_move._action_done()
|
||||
assert new_move.state == "done"
|
||||
res = self.line_ids.quant_id.move_full_quant_to(
|
||||
self.location_dest_id, self.picking_type_id, origin=self.origin)
|
||||
picking_id = res['picking_id']
|
||||
action = {}
|
||||
if picking_id and self._context.get("run_show_picking"):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="run" string="Move" type="object" class="btn-primary" />
|
||||
<button name="run" string="Move and Show Picking" type="object" class="btn-primary" context="{'run_show_picking': True}" />
|
||||
<button name="run" string="Move" type="object" />
|
||||
<button string="Cancel" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user