From 334330adc905b2cd732ae7f2f1b2862a1187affb Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Wed, 29 Oct 2025 15:09:11 +0700 Subject: [PATCH] add feature to automate when physical adjustment --- __pycache__/__init__.cpython-312.pyc | Bin 209 -> 209 bytes models/__pycache__/__init__.cpython-312.pyc | Bin 370 -> 370 bytes .../mrp_production.cpython-312.pyc | Bin 2316 -> 2311 bytes .../product_template.cpython-312.pyc | Bin 3564 -> 3546 bytes models/__pycache__/stock_lot.cpython-312.pyc | Bin 1399 -> 1392 bytes models/__pycache__/stock_move.cpython-312.pyc | Bin 3867 -> 3861 bytes .../stock_move_line.cpython-312.pyc | Bin 1612 -> 1612 bytes models/stock_quant.py | 39 ++++++++++++++++++ 8 files changed, 39 insertions(+) create mode 100644 models/stock_quant.py diff --git a/__pycache__/__init__.cpython-312.pyc b/__pycache__/__init__.cpython-312.pyc index b5e3dcabd978f6ed747ff791fd55f88b035e7e37..39e3b777f001c6adb6f20a6ded52da9ff0a9b0ca 100644 GIT binary patch delta 24 ecmcb}c#)C&G%qg~0}!PCxHFM^A>*xyYgGVUA_!6d delta 24 ecmcb}c#)C&G%qg~0}$x5-kQk0knz{VwJHEnzz0VF diff --git a/models/__pycache__/__init__.cpython-312.pyc b/models/__pycache__/__init__.cpython-312.pyc index a7341e99d9d9e772b18b9ae2bb99efae956cf869..93ddb1c0b0bb41b5701938747e268f5daa0cc066 100644 GIT binary patch delta 26 gcmeyw^ofc4G%qg~0}y=v@@XTt86)GZ$xe(00CvL&kN^Mx delta 26 gcmeyw^ofc4G%qg~0}yQEy|t0sjFIuzWG6-g0BCLpbN~PV diff --git a/models/__pycache__/mrp_production.cpython-312.pyc b/models/__pycache__/mrp_production.cpython-312.pyc index e83d3f5503b788c5798c54ee66adf300c46734f3..a6a86fd8c74315aef1445a509669771dd6aac31e 100644 GIT binary patch delta 48 zcmeAXY8T=@&CAQh00gN&?rh{vU}Ib}Ifu=SXJj2T&CAQh00h%`Z*AmGU}M}kIfu=SeRAd}20mV?$y?YaGXv?(UhJ)mjK3yd H;4lXOf1M9E diff --git a/models/__pycache__/product_template.cpython-312.pyc b/models/__pycache__/product_template.cpython-312.pyc index bd0e7948607f5c3801ae1ccb7946f776b19abffe..54df7519f8d6e9e24583320a79a18cface7efefe 100644 GIT binary patch delta 123 zcmaDOeM_4AG%qg~0}!PCxU-Qvm6cN!$ZlYGEFm+wo>i8aK~i?}0@hq+M#jl}oJR6D ztvoNwdF|BSU_7IEe$~vX6~;5`cj#Z>kiH=2bsMN9g>xlXiy+q~M$QztNf)_ez`_PR NEsTt}CU5062LSA9B|rcG delta 141 zcmca5{YIMmG%qg~0}#}+-rC5W%F3?;WH&H8kdXPrz{nZIIJuHlmIcJvJd-t-nUQ@m zJExJ#4J*%Ua$XyZXB5w`npw5NcxL?tIj;*G(m?VCNTVQU3FG7l&Xp`6#%30-O^ke* c2xB=o^(XJ=j$sDUo8@>~7#V*}Ud(F_0OeZGdD4V=unoojJGB`vzh<^ Dw`mY= delta 58 zcmeys^_`3RG%qg~0}y0#-P*{#iCJhVko}{9;R73ksN5$84$c_H$tRhcSilTFmbZ+* JCfl%@0086L5R?D_ diff --git a/models/__pycache__/stock_move.cpython-312.pyc b/models/__pycache__/stock_move.cpython-312.pyc index 4a68854710410b78f788d2bbb2e74b0cc6f395a0..c50dd49c1d7ca401b5761416c1bd836b008772b4 100644 GIT binary patch delta 138 zcmbO&H&u@NG%qg~0}y=v@@XUY4R*!dK=zLYh7WuU{KEYiof#9VFY+mOFn?fUkdo=( zyDcI+nUkZAnL$);a~DSd3*+a>w|R=iuQ&!>Rtvu97_`H2LGkjsg>_fe%`Z3xO-|y~ qmAt0rI+JS#%Z!v8+WJ5$>XL-U2WAF!H^$9tc+D6YZ%uy8X8{1!R4}vv delta 144 zcmbO#H(QSTG%qg~0}$-ty0ww}2D{n;Ap1uH!v{VFe&PO%&Ws7w7x|Psm_M*FNXc~Y z-4K!e#K6m`Gns{>ju}XAZsiDIVf-@r8c(svWyhdvYQZ}k7ZfkATUd8h-TZ=D@Z 0 and + not self.lot_id and + self.product_id.product_tmpl_id.lot_sequence_id): + + # Generate lot number using the product's sequence + lot_sequence = self.product_id.product_tmpl_id.lot_sequence_id + lot_name = lot_sequence.next_by_id() + + # Create the lot record + lot = self.env['stock.lot'].create({ + 'name': lot_name, + 'product_id': self.product_id.id, + 'company_id': self.company_id.id, + }) + + # Update the quant with the new lot BEFORE creating the move + self.lot_id = lot.id + + # Call the original method to get the move values + move_vals = super()._get_inventory_move_values(qty, location_id, location_dest_id, package_id, package_dest_id) + + # Make sure the lot_id is properly set in the move line values + if self.lot_id and 'move_line_ids' in move_vals: + for line_command in move_vals['move_line_ids']: + if line_command[0] in [0, 1] and line_command[2]: # create or update command + line_command[2]['lot_id'] = self.lot_id.id + + return move_vals \ No newline at end of file