Skip to content

Commit

Permalink
[MIG] fieldservice_sale_recurring: Migration to 14.0
Browse files Browse the repository at this point in the history
implement OCA#735

Prefer fsm_order_template from product (directly)
else from product.fsm_recurring_template

Adapt product's view
  • Loading branch information
hparfr authored and brian10048 committed Dec 13, 2023
1 parent d9d79e2 commit a074e6d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion fieldservice_sale_recurring/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Field Service - Sales - Recurring",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"summary": "Sell recurring field services.",
"category": "Field Service",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
Expand Down
6 changes: 3 additions & 3 deletions fieldservice_sale_recurring/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ class SaleOrderLine(models.Model):
def _field_create_fsm_recurring_prepare_values(self):
self.ensure_one()
template = self.product_id.fsm_recurring_template_id
product = self.product_id
note = self.name
if template.description:
note += "\n " + template.description
return {
"customer_id": self.order_id.partner_id.id,
"location_id": self.order_id.fsm_location_id.id,
"start_date": self.order_id.expected_date,
"fsm_recurring_template_id": template.id,
"description": note,
"max_orders": template.max_orders,
"fsm_frequency_set_id": template.fsm_frequency_set_id.id,
"fsm_order_template_id": template.fsm_order_template_id.id,
"sale_id": self.order_id.id,
"fsm_order_template_id": product.fsm_order_template_id.id
or template.fsm_order_template_id.id,
"sale_line_id": self.id,
"company_id": self.company_id.id,
}
Expand Down
10 changes: 1 addition & 9 deletions fieldservice_sale_recurring/views/product_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,10 @@
ref="fieldservice_sale.view_product_fieldservice_form"
/>
<field name="arch" type="xml">
<field name="fsm_order_template_id" position="attributes">
<attribute
name="attrs"
>{'required': [('field_service_tracking', 'in', ['sale','line'])],
'invisible':[('field_service_tracking', 'in', ['no','recurring'])]}
</attribute>
</field>
<field name="fsm_order_template_id" position="after">
<field
name="fsm_recurring_template_id"
attrs="{'invisible':[('field_service_tracking', 'not in', ['recurring'])],
'required': [('field_service_tracking', '=', 'recurring')]}"
attrs="{'invisible':[('field_service_tracking', 'not in', ['recurring'])]}"
/>
</field>
</field>
Expand Down

0 comments on commit a074e6d

Please sign in to comment.