Skip to content

Commit

Permalink
[UPD] ssi_stock_account
Browse files Browse the repository at this point in the history
* Menambahkan informasi apakah semua accounting entries sudah dibuat
  • Loading branch information
andhit-r committed Nov 18, 2024
1 parent 2998e25 commit e3689f7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ssi_stock_account/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,33 @@ class StockPicking(models.Model):
compute="_compute_create_accounting_entry_ok",
store=False,
)
account_move_created = fields.Boolean(
string="All Accounting Entries Created?",
compute="_compute_account_move_created",
store=True,
compute_sudo=True,
)

@api.depends(
"move_lines.stock_valuation_layer_ids",
"move_lines.stock_valuation_layer_ids.account_move_id",
"move_lines.stock_valuation_layer_ids.quantity",
"state",
)
def _compute_account_move_created(self):
SVL = self.env["stock.valuation.layer"]
for record in self:
result = False
if record.state == "done":
result = True
criteria = [
("account_move_id", "=", False),
("stock_move_id.picking_id.id", "=", record.id),
("quantity", "!=", 0.0),
]
if SVL.search_count(criteria) > 0:
result = False
record.account_move_created = result

@api.onchange(
"picking_type_id",
Expand Down
1 change: 1 addition & 0 deletions ssi_stock_account/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<group name="accounting_1" colspan="4" col="2">
<field name="journal_id" />
<field name="create_accounting_entry_ok" invisible="1" />
<field name="account_move_created" invisible="1" />
</group>
<separator string="SVL" />
<button
Expand Down

0 comments on commit e3689f7

Please sign in to comment.