Skip to content

Commit

Permalink
Merge PR #1053 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by max3903
  • Loading branch information
OCA-git-bot committed Oct 1, 2023
2 parents 94d4290 + b6fa0fb commit f13ef10
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions fieldservice_sale_recurring/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"depends": [
"fieldservice_recurring",
"fieldservice_sale",
"fieldservice_account",
],
"data": [
"security/ir.model.access.csv",
Expand Down
5 changes: 5 additions & 0 deletions fieldservice_sale_recurring/models/fsm_recurring.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ def action_view_sales(self):
"context": {"create": False},
"name": _("Sales Orders"),
}

def _prepare_order_values(self, date=None):
res = super()._prepare_order_values(date)
res["sale_line_id"] = self.sale_line_id.id
return res
18 changes: 18 additions & 0 deletions fieldservice_sale_recurring/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,21 @@ def _field_create_fsm_recurring(self):
fsm_recurring.message_post(body=fsm_recurring_msg)
result[so_line.id] = fsm_recurring
return result

def _get_invoiceable_fsm_order_domain(self):
"""
add fsm_recurring_id to domain
:return:
"""
dom = super()._get_invoiceable_fsm_order_domain()
if self.fsm_recurring_id:
dom.append(("fsm_recurring_id", "=", self.fsm_recurring_id.id))
return dom

def _prepare_invoice_line(self, **optional_values):
res = super()._prepare_invoice_line(**optional_values)
if self.fsm_recurring_id:
fsm_orders = self._get_invoiceable_fsm_order()
if fsm_orders:
res.update({"fsm_order_ids": [(6, 0, fsm_orders.ids)]})
return res

0 comments on commit f13ef10

Please sign in to comment.