Skip to content

Commit

Permalink
[FIX] fieldservice_account_analytic: automatically fill Contact in FS…
Browse files Browse the repository at this point in the history
…M Order

When customer_id is not set in the order we have:

> "customer_id" not in vals and order.customer_id is False
> False

> "customer_id" not in vals and not order.customer_id
> True
  • Loading branch information
tafaRU committed Oct 14, 2024
1 parent 1762aae commit 8ef45b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fieldservice_account_analytic/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def _onchange_customer_id_location(self):
def write(self, vals):
res = super(FSMOrder, self).write(vals)
for order in self:
if "customer_id" not in vals and order.customer_id is False:
if "customer_id" not in vals and not order.customer_id:
order.customer_id = order.location_id.customer_id.id
return res
1 change: 1 addition & 0 deletions fieldservice_account_analytic/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Michael Allen <mallen@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Brian McMaster <brian@mcmpest.com>
* Alex Comba <alex.comba@agilebg.com>
4 changes: 1 addition & 3 deletions fieldservice_stock_account/tests/test_fsm_stock_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,5 @@ def test_fsm_order(self):
SR_2.action_confirm()
fsm_order2.account_no_invoice()
fsm_order2.bill_to = "contact"
with self.assertRaises(UserError):
fsm_order2.account_no_invoice()
fsm_order2.customer_id = self.test_partner.id
self.AssertEqual(fsm_order2.customer_id, fsm_order2.location_id.customer_id)
fsm_order2.account_no_invoice()

0 comments on commit 8ef45b0

Please sign in to comment.