parameters: (self)
return_statement: return sale_order
docstring: Private implementation of generating the sales order
docstring_summary: Private implementation of generating the sales order
docstring_tokens: Private implementation of generating the sales order
function: def _create_sale_order(self):
          """ Private implementation of generating the sales order """
          sale_order = self.env['sale.order'].create({
              'project_id': self.project_id.id,
              'partner_id': self.partner_id.id,
              'analytic_account_id': self.project_id.analytic_account_id.id,
              'client_order_ref': self.project_id.name,
              'company_id': self.project_id.company_id.id,
          })
          sale_order.onchange_partner_id()
          sale_order.onchange_partner_shipping_id()
          # rewrite the user as the onchange_partner_id erases it
          sale_order.write({'user_id': self.project_id.user_id.id})
          sale_order.onchange_user_id()
  
          # create the sale lines, the map (optional), and assign existing timesheet to sale lines
          self._make_billable(sale_order)
  
          # confirm SO
          sale_order.action_confirm()
          return sale_order
function_tokens: def _create_sale_order ( self ) : sale_order = self . env [ 'sale.order' ] . create ( { 'project_id' : self . project_id . id , 'partner_id' : self . partner_id . id , 'analytic_account_id' : self . project_id . analytic_account_id . id , 'client_order_ref' : self . project_id . name , 'company_id' : self . project_id . company_id . id , } ) sale_order . onchange_partner_id ( ) sale_order . onchange_partner_shipping_id ( ) # rewrite the user as the onchange_partner_id erases it sale_order . write ( { 'user_id' : self . project_id . user_id . id } ) sale_order . onchange_user_id ( ) # create the sale lines, the map (optional), and assign existing timesheet to sale lines self . _make_billable ( sale_order ) # confirm SO sale_order . action_confirm ( ) return sale_order