Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UPD] ssi_stock_account #67

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions ssi_stock_account/models/stock_valuation_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ class StockValuationLayer(models.Model):
compute="_compute_date",
store=True,
)
account_move_date = fields.Date(
string="Account Move Date",
related="account_move_id.date",
store=True,
)
date_is_equal = fields.Boolean(
string="Date is Equal",
compute="_compute_date_is_equal",
store=True,
)
debit_move_line_id = fields.Many2one(
string="Debit Move Line",
comodel_name="account.move.line",
Expand Down Expand Up @@ -135,6 +145,19 @@ class StockValuationLayer(models.Model):
store=True,
)

@api.depends(
"date",
"account_move_date",
"account_move_id",
"account_move_id.date",
)
def _compute_date_is_equal(self):
for record in self:
result = True
if record.date != record.account_move_date:
result = False
record.date_is_equal = result

@api.depends(
"quantity",
"incoming_usage_quantity",
Expand Down
3 changes: 3 additions & 0 deletions ssi_stock_account/views/stock_valuation_layer_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<field name="credit_account_id" />
<field name="analytic_account_id" />
<field name="journal_id" />
<field name="account_move_id" />
<field name="account_move_date" />
<field name="date_is_equal" />
<field name="debit_move_line_id" />
<field name="credit_move_line_id" />
</xpath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ def _update_svl_actual_movement_date(self):
"svl_ids": tuple(self.picking_ids.stock_valuation_layer_ids.ids),
}
self._cr.execute(query, params)
self.picking_ids.stock_valuation_layer_ids._compute_date()
Loading