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

[17.0] [IMP] fieldservice_account_analytic: Invoice customer not related to any location #1334

Open
wants to merge 2 commits into
base: 17.0
Choose a base branch
from

Conversation

brian10048
Copy link
Contributor

Port of #1322

@OCA-git-bot
Copy link
Contributor

Hi @bodedra, @osimallen,
some modules you are maintaining are being modified, check this out!

def _compute_total_cost(self):
"""To be overridden as needed from other modules"""
for order in self:
order.total_cost = 0.0

@api.onchange("customer_id")
def _onchange_customer_id_location(self):
Copy link

@BernatObrador BernatObrador Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this onchange can be set like this instead of deleting it:

@api.onchange("customer_id")
def _onchange_customer_id(self):
      if self.customer_id.fsm_location_id:
            self.location_id = self.customer_id.fsm_location_id
      else:
            self.location_id = False

This approach would avoid potential buggy behaviors like:

  1. Creating an FSM order.
  2. Selecting a location.
  3. Changing the customer to one without a location.
  4. Clicking on the Location internal link.
    image

However, I'm not sure if a customer can be delivered to a different location than their own.
What do you think about this approach?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another solution could be changing the context of the field to let the user freely select the location.

I guess it's just needed to delete this:

<field name="location_id" position="attributes">
                <attribute name="context">{"customer_id": customer_id}</attribute>
</field>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants