Skip to content

Commit

Permalink
[UPD] ssi_revenue_recognition
Browse files Browse the repository at this point in the history
* Penambahan Qty. Accepted dan Excess Qty pada PoA
  • Loading branch information
andhit-r committed Oct 13, 2024
1 parent 9a3267d commit 8e65f51
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class PerformanceObligationAcceptance(models.Model):
compute_sudo=True,
)
qty_fulfilled_accumulated = fields.Float(
string="Qty Fulfilled - Accumulated",
string="Qty Fulfilled + Accumulated",
compute="_compute_qty_accumulated",
store=True,
compute_sudo=True,
Expand All @@ -170,6 +170,18 @@ class PerformanceObligationAcceptance(models.Model):
store=True,
compute_sudo=True,
)
qty_accepted = fields.Float(
string="Qty Accepted",
compute="_compute_qty_accumulated",
store=True,
compute_sudo=True,
)
qty_excess = fields.Float(
string="Excess Qty",
compute="_compute_qty_accumulated",
store=True,
compute_sudo=True,
)

@api.depends(
"date",
Expand Down Expand Up @@ -197,13 +209,21 @@ def _compute_previous_performance_obligation_acceptance_ids(self):
def _compute_qty_accumulated(self):
for record in self:
qty_total = record.performance_obligation_id.uom_quantity
qty_fulfilled = 0.0
qty_fulfilled = qty_accepted = qty_excess = 0.0
for poa in record.previous_performance_obligation_acceptance_ids:
qty_fulfilled += poa.qty_fulfilled
qty_fulfilled += record.qty_fulfilled
qty_diff = qty_total - qty_fulfilled
if qty_diff < 0.0:
qty_accepted = abs(qty_diff)
qty_excess = record.qty_fulfilled + qty_diff
else:
qty_accepted = record.qty_fulfilled

record.qty_fulfilled_accumulated = qty_fulfilled
record.qty_diff_accumulated = qty_diff
record.qty_accepted = qty_accepted
record.qty_excess = qty_excess

@api.depends(
"manual_fulfillment_ids",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
<field name="qty_fulfilled" />
<field name="qty_fulfilled_accumulated" />
<field name="qty_diff_accumulated" />
<field name="qty_accepted" />
<field name="qty_excess" />
</xpath>
<xpath expr="//page[1]" position="before">
<page name="manual" string="Manual Fulfillments">
Expand Down

0 comments on commit 8e65f51

Please sign in to comment.