mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] sale_subscription: get sales_team with consistent company on SO
This commit is contained in:
@@ -265,14 +265,22 @@ class SaleSubscription(models.Model):
|
|||||||
|
|
||||||
def _prepare_sale_order(self, line_ids=False):
|
def _prepare_sale_order(self, line_ids=False):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
company = self.company_id
|
||||||
|
# Fix for multi-company issue with team_id
|
||||||
|
# Cannot assign team belonging to a different company
|
||||||
|
team_id = self.env["sale.order"]._get_default_team()
|
||||||
|
if team_id.company_id and team_id.company_id != company:
|
||||||
|
team_id = False
|
||||||
return {
|
return {
|
||||||
"partner_id": self.partner_id.id,
|
"partner_id": self.partner_id.id,
|
||||||
|
"company_id": company.id,
|
||||||
"fiscal_position_id": self.fiscal_position_id.id,
|
"fiscal_position_id": self.fiscal_position_id.id,
|
||||||
"date_order": datetime.now(),
|
"date_order": datetime.now(),
|
||||||
"payment_term_id": self.partner_id.property_payment_term_id.id,
|
"payment_term_id": self.partner_id.property_payment_term_id.id,
|
||||||
"user_id": self.user_id.id,
|
"user_id": self.user_id.id,
|
||||||
"origin": self.name,
|
"origin": self.name,
|
||||||
"order_line": line_ids,
|
"order_line": line_ids,
|
||||||
|
"team_id": team_id and team_id.id or False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _prepare_account_move(self, line_ids):
|
def _prepare_account_move(self, line_ids):
|
||||||
|
|||||||
Reference in New Issue
Block a user